This commit is contained in:
shuo.wang
2025-04-12 18:52:03 +08:00
parent 49ec1df2c7
commit 8f15b46ab4
5 changed files with 124 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
package com.cool.store.dao;
import com.cool.store.entity.OldShopDO;
import com.cool.store.mapper.OldShopMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2025/04/12/18:36
* @Version 1.0
* @注释:
*/
@Repository
public class OldShopDAO {
@Resource
private OldShopMapper oldShopMapper;
public List<OldShopDO> getByMobile(String mobile) {
if (StringUtils.isBlank(mobile)){
return null;
}
Example example = new Example(OldShopDO.class);
example.createCriteria().andEqualTo("mobile", mobile);
return oldShopMapper.selectByExample(example);
}
}

View File

@@ -0,0 +1,14 @@
package com.cool.store.mapper;
import com.cool.store.entity.OldShopDO;
import tk.mybatis.mapper.common.BaseMapper;
import tk.mybatis.mapper.common.Mapper;
/**
* @Author: WangShuo
* @Date: 2025/04/12/18:33
* @Version 1.0
* @注释:
*/
public interface OldShopMapper extends Mapper<OldShopDO> {
}

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--mybatis-3-mapper.dtd:约束文件的名称限制和检查在当前文件中出现的标签和属性符合mybatis的要求-->
<!--namespace命名空间要有唯一的值要求使用dao接口的权限定名称一个dao接口对应一个mappernamespace指明对应哪个dao接口-->
<mapper namespace="com.cool.store.mapper.OldShopMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.OldShopDO">
<result column="id" property="id" jdbcType="BIGINT"/>
<result column="shop_code" property="shopCode" jdbcType="VARCHAR"/>
<result column="shop_name" property="shopName" jdbcType="VARCHAR"/>
<result column="mobile" property="mobile" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, shop_code, shop_name,mobile, create_time, update_time
</sql>
</mapper>

View File

@@ -0,0 +1,47 @@
package com.cool.store.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
@Data
@Table(name = "xfsg_old_shop")
public class OldShopDO {
/**
* 主键ID
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
/**
* 门店编码
*/
@Column(name = "shop_code")
private String shopCode;
@Column(name = "shop_name")
private String shopName;
/**
* 手机号
*/
@Column(name = "mobile")
private String mobile;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* 更新时间
*/
@Column(name = "update_time")
private Date updateTime;
}

View File

@@ -55,6 +55,9 @@ import static com.cool.store.enums.ErrorCodeEnum.UPDATE_INVESTMENT_MANAGER_FAIL;
@Service @Service
@Slf4j @Slf4j
public class ShopServiceImpl implements ShopService { public class ShopServiceImpl implements ShopService {
@Resource
private OldShopDAO oldShopDAO;
@Value("${mybatis.configuration.variables.enterpriseId}") @Value("${mybatis.configuration.variables.enterpriseId}")
private String eid; private String eid;
@Resource @Resource
@@ -578,6 +581,7 @@ public class ShopServiceImpl implements ShopService {
@Override @Override
public ShopResponse getShopNameAndCode(Long shopId, Long lineId) { public ShopResponse getShopNameAndCode(Long shopId, Long lineId) {
boolean flag = false; boolean flag = false;
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(lineId);
MiniShopsResponse shopInfo = shopInfoDAO.currentShopWhetherOpen(shopId,eid); MiniShopsResponse shopInfo = shopInfoDAO.currentShopWhetherOpen(shopId,eid);
ShopResponse response = new ShopResponse(); ShopResponse response = new ShopResponse();
if (Objects.nonNull(shopInfo)&&StringUtils.isNotBlank(shopInfo.getShopCode())) { if (Objects.nonNull(shopInfo)&&StringUtils.isNotBlank(shopInfo.getShopCode())) {
@@ -596,9 +600,19 @@ public class ShopServiceImpl implements ShopService {
dto.setShopCode(shopInfoDO.getShopCode()); dto.setShopCode(shopInfoDO.getShopCode());
list.add(dto); list.add(dto);
} }
response.setShopList(list);
flag = true; flag = true;
} }
List<OldShopDO> oldMobile = oldShopDAO.getByMobile(lineInfoDO.getMobile());
if (CollectionUtils.isNotEmpty(oldMobile)){
for (OldShopDO oldShopDO : oldMobile){
ShopNameAndCodeDTO dto = new ShopNameAndCodeDTO();
dto.setShopName(oldShopDO.getShopName());
dto.setShopCode(oldShopDO.getShopCode());
list.add(dto);
}
flag = true;
}
response.setShopList(list);
if (flag) { if (flag) {
return response; return response;
} else { } else {