Commit 44cdffbb authored by zhaobiyan's avatar zhaobiyan

新增会员编码字段,刷新历史数据

parents 28f34692 31cd04db
...@@ -88,4 +88,13 @@ public class CustomerExportReqDTO { ...@@ -88,4 +88,13 @@ public class CustomerExportReqDTO {
private List<Integer> marketType; private List<Integer> marketType;
private int deptId ; private int deptId ;
@ApiModelProperty(value = "会员编号")
private String memberCode;
@ApiModelProperty(value = "会员名称")
private String memberName;
@ApiModelProperty(value = "会员手机")
private String memberMobile;
@ApiModelProperty(value = "会员区号")
private String memberAreaCode;
} }
...@@ -92,4 +92,12 @@ public class CustomerPageReqDTO extends PageParam { ...@@ -92,4 +92,12 @@ public class CustomerPageReqDTO extends PageParam {
@ApiModelProperty(value = "是否潜在客户") @ApiModelProperty(value = "是否潜在客户")
private Boolean isPotential; private Boolean isPotential;
@ApiModelProperty(value = "会员编号")
private String memberCode;
@ApiModelProperty(value = "会员名称")
private String memberName;
@ApiModelProperty(value = "会员手机")
private String memberMobile;
@ApiModelProperty(value = "会员区号")
private String memberAreaCode;
} }
...@@ -50,4 +50,13 @@ public class IndirectCustomerPageReqDTO { ...@@ -50,4 +50,13 @@ public class IndirectCustomerPageReqDTO {
* 客户来源 * 客户来源
*/ */
private List<Integer> source; private List<Integer> source;
@ApiModelProperty(value = "会员编号")
private String memberCode;
@ApiModelProperty(value = "会员名称")
private String memberName;
@ApiModelProperty(value = "会员手机")
private String memberMobile;
@ApiModelProperty(value = "会员区号")
private String memberAreaCode;
} }
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
left join ecw_customer_credit credit left join ecw_customer_credit credit
on contact.credit_level = credit.id on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id left join ecw_country ec on contact.country = ec.id
left join member_user mu on contact.member_id = mu.id
WHERE 1=1 AND contact.deleted = 0 WHERE 1=1 AND contact.deleted = 0
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
left join ecw_customer_credit credit left join ecw_customer_credit credit
on contact.credit_level = credit.id on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id left join ecw_country ec on contact.country = ec.id
left join member_user mu on contact.member_id = mu.id
WHERE 1=1 AND contact.deleted = 0 WHERE 1=1 AND contact.deleted = 0
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
left join ecw_customer_credit credit left join ecw_customer_credit credit
on contact.credit_level = credit.id on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id left join ecw_country ec on contact.country = ec.id
left join member_user mu on contact.member_id = mu.id
WHERE 1=1 AND contact.deleted = 0 WHERE 1=1 AND contact.deleted = 0
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
left join ecw_customer_credit credit left join ecw_customer_credit credit
on contact.credit_level = credit.id on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id left join ecw_country ec on contact.country = ec.id
left join member_user mu on contact.member_id = mu.id
WHERE 1=1 AND contact.deleted = 0 WHERE 1=1 AND contact.deleted = 0
...@@ -394,6 +394,19 @@ ...@@ -394,6 +394,19 @@
</foreach> </foreach>
</if> </if>
</if> </if>
<!-- 会员信息 -->
<if test="query.memberCode != null and query.memberCode != '' ">
AND mu.code like concat('%',#{query.memberCode},'%')
</if>
<if test="query.memberName != null and query.memberName != '' ">
AND mu.nickname like concat('%',#{query.memberName},'%')
</if>
<if test="query.memberMobile != null and query.memberMobile != '' ">
AND mu.mobile like concat('%',#{query.memberMobile},'%')
</if>
<if test="query.memberAreaCode != null and query.memberAreaCode != '' ">
AND mu.area_code like concat('%',#{query.memberAreaCode},'%')
</if>
</sql> </sql>
<select id="getMyCustomerExcelVoList" <select id="getMyCustomerExcelVoList"
resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO"> resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO">
...@@ -458,7 +471,7 @@ ...@@ -458,7 +471,7 @@
left join ecw_customer_credit credit left join ecw_customer_credit credit
on contact.credit_level = credit.id on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id left join ecw_country ec on contact.country = ec.id
left join member_user mu on contact.member_id = mu.id
WHERE 1=1 AND contact.deleted = 0 WHERE 1=1 AND contact.deleted = 0
<include refid="myCustomerQuery"/> <include refid="myCustomerQuery"/>
...@@ -660,6 +673,19 @@ ...@@ -660,6 +673,19 @@
</foreach> </foreach>
</if> </if>
</if> </if>
<!-- 会员信息 -->
<if test="query.memberCode != null and query.memberCode != '' ">
AND mu.code like concat('%',#{query.memberCode},'%')
</if>
<if test="query.memberName != null and query.memberName != '' ">
AND mu.nickname like concat('%',#{query.memberName},'%')
</if>
<if test="query.memberMobile != null and query.memberMobile != '' ">
AND mu.mobile like concat('%',#{query.memberMobile},'%')
</if>
<if test="query.memberAreaCode != null and query.memberAreaCode != '' ">
AND mu.area_code like concat('%',#{query.memberAreaCode},'%')
</if>
</sql> </sql>
<select id="searchCustomer" resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO"> <select id="searchCustomer" resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO">
select contact.*, select contact.*,
...@@ -1396,7 +1422,7 @@ ...@@ -1396,7 +1422,7 @@
left join ecw_customer_credit credit left join ecw_customer_credit credit
on contact.credit_level = credit.id on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id left join ecw_country ec on contact.country = ec.id
left join member_user mu on contact.member_id = mu.id
WHERE 1=1 AND contact.deleted = 0 WHERE 1=1 AND contact.deleted = 0
...@@ -1430,7 +1456,7 @@ ...@@ -1430,7 +1456,7 @@
left join ecw_customer_credit credit left join ecw_customer_credit credit
on contact.credit_level = credit.id on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id left join ecw_country ec on contact.country = ec.id
left join member_user mu on contact.member_id = mu.id
WHERE 1=1 AND contact.deleted = 0 WHERE 1=1 AND contact.deleted = 0
...@@ -1506,7 +1532,7 @@ ...@@ -1506,7 +1532,7 @@
on contact.credit_level = credit.id on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id left join ecw_country ec on contact.country = ec.id
left join member_user mu on contact.member_id = mu.id
WHERE 1=1 AND contact.deleted = 0 AND contact.enter_open_sea_time is NOT NULL WHERE 1=1 AND contact.deleted = 0 AND contact.enter_open_sea_time is NOT NULL
<include refid="myCustomerQuery"/> <include refid="myCustomerQuery"/>
...@@ -1541,7 +1567,7 @@ ...@@ -1541,7 +1567,7 @@
on contact.credit_level = credit.id on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id left join ecw_country ec on contact.country = ec.id
left join member_user mu on contact.member_id = mu.id
WHERE 1=1 AND contact.deleted = 0 AND contact.enter_open_sea_time is NOT NULL WHERE 1=1 AND contact.deleted = 0 AND contact.enter_open_sea_time is NOT NULL
<include refid="myCustomerQuery"/> <include refid="myCustomerQuery"/>
</select> </select>
...@@ -1612,7 +1638,7 @@ ...@@ -1612,7 +1638,7 @@
left join ecw_customer_credit credit left join ecw_customer_credit credit
on contact.credit_level = credit.id on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id left join ecw_country ec on contact.country = ec.id
left join member_user mu on contact.member_id = mu.id
WHERE 1=1 AND contact.deleted = 0 WHERE 1=1 AND contact.deleted = 0
<if test="deptId != null and deptId>0"> <if test="deptId != null and deptId>0">
...@@ -1649,7 +1675,7 @@ ...@@ -1649,7 +1675,7 @@
left join ecw_customer_credit credit left join ecw_customer_credit credit
on contact.credit_level = credit.id on contact.credit_level = credit.id
left join ecw_country ec on contact.country = ec.id left join ecw_country ec on contact.country = ec.id
left join member_user mu on contact.member_id = mu.id
WHERE 1=1 AND contact.deleted = 0 WHERE 1=1 AND contact.deleted = 0
<if test="deptId != null and deptId>0"> <if test="deptId != null and deptId>0">
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
LEFT JOIN ecw_indirect_customer_contacts c ON a.id = c.customer_id LEFT JOIN ecw_indirect_customer_contacts c ON a.id = c.customer_id
LEFT JOIN ecw_customer agent ON a.agent_customer_id = agent.id LEFT JOIN ecw_customer agent ON a.agent_customer_id = agent.id
LEFT JOIN system_user su ON a.customer_service = su.id LEFT JOIN system_user su ON a.customer_service = su.id
left join member_user mu on agent.member_id = mu.id
WHERE WHERE
c.is_default = 1 AND a.deleted = 0 c.is_default = 1 AND a.deleted = 0
AND c.deleted = 0 AND c.deleted = 0
...@@ -150,7 +151,19 @@ ...@@ -150,7 +151,19 @@
</foreach> </foreach>
</if> </if>
</if> </if>
<!-- 会员信息 -->
<if test="query.memberCode != null and query.memberCode != '' ">
AND mu.code like concat('%',#{query.memberCode},'%')
</if>
<if test="query.memberName != null and query.memberName != '' ">
AND mu.nickname like concat('%',#{query.memberName},'%')
</if>
<if test="query.memberMobile != null and query.memberMobile != '' ">
AND mu.mobile like concat('%',#{query.memberMobile},'%')
</if>
<if test="query.memberAreaCode != null and query.memberAreaCode != '' ">
AND mu.area_code like concat('%',#{query.memberAreaCode},'%')
</if>
</sql> </sql>
<select id="getOpenSeaCustomerPageReqCount" resultType="java.lang.Long" <select id="getOpenSeaCustomerPageReqCount" resultType="java.lang.Long"
parameterType="cn.iocoder.yudao.module.customer.dto.indirectCustomer.IndirectCustomerPageReqDTO"> parameterType="cn.iocoder.yudao.module.customer.dto.indirectCustomer.IndirectCustomerPageReqDTO">
...@@ -170,6 +183,7 @@ ...@@ -170,6 +183,7 @@
LEFT JOIN ecw_indirect_customer_contacts c ON a.id = c.customer_id LEFT JOIN ecw_indirect_customer_contacts c ON a.id = c.customer_id
LEFT JOIN ecw_customer agent ON a.agent_customer_id = agent.id LEFT JOIN ecw_customer agent ON a.agent_customer_id = agent.id
LEFT JOIN system_user su ON a.customer_service = su.id LEFT JOIN system_user su ON a.customer_service = su.id
left join member_user mu on agent.member_id = mu.id
WHERE WHERE
c.is_default = 1 AND a.deleted = 0 c.is_default = 1 AND a.deleted = 0
AND c.deleted = 0 AND c.deleted = 0
...@@ -196,6 +210,7 @@ ...@@ -196,6 +210,7 @@
LEFT JOIN ecw_indirect_customer_contacts c ON a.id = c.customer_id LEFT JOIN ecw_indirect_customer_contacts c ON a.id = c.customer_id
LEFT JOIN ecw_customer agent ON a.agent_customer_id = agent.id LEFT JOIN ecw_customer agent ON a.agent_customer_id = agent.id
LEFT JOIN system_user su ON a.customer_service = su.id LEFT JOIN system_user su ON a.customer_service = su.id
left join member_user mu on agent.member_id = mu.id
WHERE WHERE
c.is_default = 1 AND a.deleted = 0 c.is_default = 1 AND a.deleted = 0
AND c.deleted = 0 AND c.deleted = 0
......
package cn.iocoder.yudao.module.member.controller.admin.job;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 会员编号刷新任务
* @author zhaobiyan
*/
@Component
@Slf4j
public class MemberCodeFlushTask implements JobHandler {
@Resource
private MemberUserService userService;
@Override
public String execute(String param) throws Exception {
userService.historyCodeFlush();
return "";
}
}
...@@ -36,6 +36,7 @@ import cn.iocoder.yudao.module.member.vo.userCardAuth.UserCardAuthCreateReqVO; ...@@ -36,6 +36,7 @@ import cn.iocoder.yudao.module.member.vo.userCardAuth.UserCardAuthCreateReqVO;
import cn.iocoder.yudao.module.member.vo.userEnterpriseAuth.UserEnterpriseAuthBackVO; import cn.iocoder.yudao.module.member.vo.userEnterpriseAuth.UserEnterpriseAuthBackVO;
import cn.iocoder.yudao.module.member.vo.userEnterpriseAuth.UserEnterpriseAuthCreateReqVO; import cn.iocoder.yudao.module.member.vo.userEnterpriseAuth.UserEnterpriseAuthCreateReqVO;
import cn.iocoder.yudao.module.member.vo.userOperationLog.UserOperationLogBackVO; import cn.iocoder.yudao.module.member.vo.userOperationLog.UserOperationLogBackVO;
import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -458,6 +459,4 @@ public class MemberUserController { ...@@ -458,6 +459,4 @@ public class MemberUserController {
} }
return success(null); return success(null);
} }
} }
...@@ -234,6 +234,6 @@ public class MemberUserDO extends TenantBaseDO { ...@@ -234,6 +234,6 @@ public class MemberUserDO extends TenantBaseDO {
*/ */
private Boolean isDeal; private Boolean isDeal;
private String code;
} }
...@@ -171,8 +171,12 @@ public interface MemberUserMapper extends BaseMapperX<MemberUserDO> { ...@@ -171,8 +171,12 @@ public interface MemberUserMapper extends BaseMapperX<MemberUserDO> {
"</script>" "</script>"
}) })
MemberUserDO info(@Param("id") Long id); MemberUserDO info(@Param("id") Long id);
@Update("update ecw_customer_contacts set userid = null where userid = #{userId}") @Update("update ecw_customer_contacts set userid = null where userid = #{userId}")
void unbindingCustomer(@Param("userId") Long userId); void unbindingCustomer(@Param("userId") Long userId);
String getCurrentMaxMemberCode();
void updateMemberCodeById(@Param("code")String memberCode, @Param("id")Long id);
void clearMemberCode();
} }
...@@ -218,4 +218,7 @@ public interface MemberUserService { ...@@ -218,4 +218,7 @@ public interface MemberUserService {
void memberCancellation(Long userId); void memberCancellation(Long userId);
List<MemberUserDO> getByCursor(Long startUserId, long limit);
void historyCodeFlush();
} }
...@@ -12,6 +12,7 @@ import cn.iocoder.yudao.framework.i18n.core.I18nMessage; ...@@ -12,6 +12,7 @@ import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO; import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.module.ecw.api.customer.CustomerApi; import cn.iocoder.yudao.module.ecw.api.customer.CustomerApi;
import cn.iocoder.yudao.module.ecw.api.internalMessage.ClientInternalMessageApi; import cn.iocoder.yudao.module.ecw.api.internalMessage.ClientInternalMessageApi;
import cn.iocoder.yudao.module.ecw.api.internalMessage.dto.InternalMessageCreateDto; import cn.iocoder.yudao.module.ecw.api.internalMessage.dto.InternalMessageCreateDto;
...@@ -32,15 +33,18 @@ import cn.iocoder.yudao.module.member.dal.mysql.userEnterpriseAuth.UserEnterpris ...@@ -32,15 +33,18 @@ import cn.iocoder.yudao.module.member.dal.mysql.userEnterpriseAuth.UserEnterpris
import cn.iocoder.yudao.module.member.enums.UserOperationLogTypeEnum; import cn.iocoder.yudao.module.member.enums.UserOperationLogTypeEnum;
import cn.iocoder.yudao.module.member.enums.UserQueryAuthTypeEnum; import cn.iocoder.yudao.module.member.enums.UserQueryAuthTypeEnum;
import cn.iocoder.yudao.module.member.service.userOperationLog.UserOperationLogService; import cn.iocoder.yudao.module.member.service.userOperationLog.UserOperationLogService;
import cn.iocoder.yudao.module.member.util.MemberUserCodeUtils;
import cn.iocoder.yudao.module.member.vo.member.MemberUpdateReqVO; import cn.iocoder.yudao.module.member.vo.member.MemberUpdateReqVO;
import cn.iocoder.yudao.module.member.vo.userOperationLog.UserOperationLogCreateReqVO; import cn.iocoder.yudao.module.member.vo.userOperationLog.UserOperationLogCreateReqVO;
import cn.iocoder.yudao.module.product.service.coupon.CouponService; import cn.iocoder.yudao.module.product.service.coupon.CouponService;
import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi; import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi;
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO; import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum; import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -53,6 +57,7 @@ import javax.annotation.Resource; ...@@ -53,6 +57,7 @@ import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.InputStream; import java.io.InputStream;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
...@@ -102,6 +107,9 @@ public class MemberUserServiceImpl implements MemberUserService { ...@@ -102,6 +107,9 @@ public class MemberUserServiceImpl implements MemberUserService {
@Resource @Resource
private ParamValidatorApi paramValidatorApi; private ParamValidatorApi paramValidatorApi;
@Resource
private RedisHelper redisHelper;
@Override @Override
public MemberUserDO getUserByMobile(String mobile) { public MemberUserDO getUserByMobile(String mobile) {
...@@ -524,4 +532,53 @@ public class MemberUserServiceImpl implements MemberUserService { ...@@ -524,4 +532,53 @@ public class MemberUserServiceImpl implements MemberUserService {
memberUserMapper.unbindingCustomer(userId); memberUserMapper.unbindingCustomer(userId);
} }
@Override
public List<MemberUserDO> getByCursor(Long startUserId, long limit) {
if (startUserId == null) {
return Collections.emptyList();
}
LambdaQueryWrapper<MemberUserDO> wrapper = Wrappers.lambdaQuery();
wrapper.gt(MemberUserDO::getId, startUserId);
wrapper.orderByAsc(MemberUserDO::getId);
wrapper.last("limit " + limit);
return memberUserMapper.getList(wrapper);
}
@Override
public void historyCodeFlush() {
Long startUserId = 0L;
long limit = 500;
memberUserMapper.clearMemberCode();
redisHelper.delete("memberCode:max:number");
while(true) {
List<MemberUserDO> result = this.getByCursor(startUserId, limit);
if (CollectionUtils.isEmpty(result)) {
break;
}
result.forEach(memberUserDO -> {
String memberCode = getNextMemberCode();
memberUserMapper.updateMemberCodeById(memberCode, memberUserDO.getId());
});
startUserId = result.stream().mapToLong(MemberUserDO::getId).max().orElse(Long.MAX_VALUE);
}
}
private String getNextMemberCode() {
String key = "memberCode:max:number";
Boolean hasMemberCodeMaxNumber = redisHelper.hasKey(key);
if (hasMemberCodeMaxNumber) {
return MemberUserCodeUtils.generateMemberCode(redisHelper.incrBy(key, 1));
}
synchronized(this) {
hasMemberCodeMaxNumber = redisHelper.hasKey(key);
if (hasMemberCodeMaxNumber) {
return MemberUserCodeUtils.generateMemberCode(redisHelper.incrBy(key, 1));
}
String currentMaxMemberCode = memberUserMapper.getCurrentMaxMemberCode();
Long memberCodeMaxNumber = MemberUserCodeUtils.getMemberCodeNumber(currentMaxMemberCode);
redisHelper.set(key, String.valueOf(memberCodeMaxNumber), 5, TimeUnit.MINUTES);
return MemberUserCodeUtils.generateMemberCode(redisHelper.incrBy(key, 1));
}
}
} }
package cn.iocoder.yudao.module.member.util;
import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;
/**
* @author zhaobiyan
*/
public class MemberUserCodeUtils {
private static final String MEMBER_CODE_PREFIX = "EC";
private static final int DEFAULT_LENGTH = 6;
public static String generateMemberCode(Long codeNumber) {
StringBuilder codeNumberStr = new StringBuilder(String.valueOf(codeNumber));
if (codeNumberStr.length() >= DEFAULT_LENGTH) {
return MEMBER_CODE_PREFIX + codeNumberStr;
}
int supplyCount = DEFAULT_LENGTH - codeNumberStr.length();
for (int i = 0; i < supplyCount; i++) {
codeNumberStr.insert(0, "0");
}
return MEMBER_CODE_PREFIX + codeNumberStr;
}
public static Long getMemberCodeNumber(String currentMaxMemberCode) {
if (StringUtils.isBlank(currentMaxMemberCode)) {
return 0L;
}
String[] split = currentMaxMemberCode.split(MEMBER_CODE_PREFIX);
return Long.parseLong(split[1]);
}
}
...@@ -83,4 +83,15 @@ ...@@ -83,4 +83,15 @@
) as t ) as t
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
<select id="getCurrentMaxMemberCode" resultType="String">
select code from member_user order by code desc limit 1
</select>
<update id="updateMemberCodeById" >
update member_user set code = #{code} where id = #{id}
</update>
<update id="clearMemberCode">
update member_user set code = ''
</update>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment