mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-16 13:19:57 +08:00
update
This commit is contained in:
@@ -70,6 +70,10 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class MemberService {
|
||||
private static final int MAX_MEMBER_ID_GENERATE_RETRY_TIMES = 20;
|
||||
|
||||
private static final int MAX_MEMBER_REGISTER_RETRY_TIMES = 5;
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
@@ -413,14 +417,21 @@ public class MemberService {
|
||||
* @return 注册完成后的会员信息
|
||||
*/
|
||||
private MemberBasicInfo registerMemberForRegisterAndLoginV2(MemberRegisterAndLoginDTO dto) {
|
||||
MemberBasicInfo memberBasicInfo = buildNewMemberForRegisterAndLoginV2(dto);
|
||||
MemberTransactionDTO memberTransactionDTO = buildMemberTransactionForRegisterAndLoginV2(memberBasicInfo, dto.getFirstLevelMerchantId());
|
||||
try {
|
||||
transactionService.createMember(memberTransactionDTO);
|
||||
return memberBasicInfo;
|
||||
} catch (DuplicateKeyException e) {
|
||||
return reloadMemberAfterDuplicateKeyForRegisterAndLoginV2(dto);
|
||||
for (int attempt = 1; attempt <= MAX_MEMBER_REGISTER_RETRY_TIMES; attempt++) {
|
||||
MemberBasicInfo memberBasicInfo = buildNewMemberForRegisterAndLoginV2(dto);
|
||||
MemberTransactionDTO memberTransactionDTO = buildMemberTransactionForRegisterAndLoginV2(memberBasicInfo, dto.getFirstLevelMerchantId());
|
||||
try {
|
||||
transactionService.createMember(memberTransactionDTO);
|
||||
return memberBasicInfo;
|
||||
} catch (DuplicateKeyException e) {
|
||||
MemberBasicInfo existedMember = reloadMemberAfterDuplicateKeyForRegisterAndLoginV2(dto, memberBasicInfo.getMemberId(), attempt);
|
||||
if (existedMember != null) {
|
||||
return existedMember;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("会员注册重试多次后仍失败, phoneNumber:{}, merchantId:{}", dto.getMobileNumber(), dto.getFirstLevelMerchantId());
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_MEMBER_REGISTER_AND_LOGIN_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -468,12 +479,14 @@ public class MemberService {
|
||||
* @param dto 登录/注册入参
|
||||
* @return 已存在的会员信息
|
||||
*/
|
||||
private MemberBasicInfo reloadMemberAfterDuplicateKeyForRegisterAndLoginV2(MemberRegisterAndLoginDTO dto) {
|
||||
log.warn("会员注册时检测到唯一索引冲突,重新查询已存在的会员, phoneNumber:{}, merchantId:{}", dto.getMobileNumber(), dto.getFirstLevelMerchantId());
|
||||
private MemberBasicInfo reloadMemberAfterDuplicateKeyForRegisterAndLoginV2(MemberRegisterAndLoginDTO dto, String memberId, int attempt) {
|
||||
log.warn("会员注册时检测到唯一索引冲突,重新查询已存在的会员, phoneNumber:{}, merchantId:{}, candidateMemberId:{}, attempt:{}",
|
||||
dto.getMobileNumber(), dto.getFirstLevelMerchantId(), memberId, attempt);
|
||||
MemberBasicInfo memberBasicInfo = memberBasicInfoService.selectInfoByMobileNumber(dto.getMobileNumber(), dto.getFirstLevelMerchantId());
|
||||
if (memberBasicInfo == null) {
|
||||
log.error("唯一索引冲突后重新查询会员信息为空, phoneNumber:{}, merchantId:{}", dto.getMobileNumber(), dto.getFirstLevelMerchantId());
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_MEMBER_REGISTER_AND_LOGIN_ERROR);
|
||||
log.warn("唯一索引冲突后未查询到手机号对应会员,准备重新生成memberId重试, phoneNumber:{}, merchantId:{}, candidateMemberId:{}, attempt:{}",
|
||||
dto.getMobileNumber(), dto.getFirstLevelMerchantId(), memberId, attempt);
|
||||
return null;
|
||||
}
|
||||
return memberBasicInfo;
|
||||
}
|
||||
@@ -535,14 +548,14 @@ public class MemberService {
|
||||
}
|
||||
|
||||
private String generateNewMemberId() {
|
||||
while (true) {
|
||||
for (int attempt = 1; attempt <= MAX_MEMBER_ID_GENERATE_RETRY_TIMES; attempt++) {
|
||||
String memberId = IdUtils.getMemberId();
|
||||
// 通过memberId查询是否已经存在
|
||||
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(memberId);
|
||||
if (memberVO == null) {
|
||||
if (!memberBasicInfoService.existsByMemberId(memberId)) {
|
||||
return memberId;
|
||||
}
|
||||
log.warn("生成memberId命中已存在记录,准备重试, memberId:{}, attempt:{}", memberId, attempt);
|
||||
}
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_MEMBER_REGISTER_AND_LOGIN_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1594,7 +1594,8 @@ public class TempService {
|
||||
return ImportMemberBalanceItemResultDTO.success(phone);
|
||||
} catch (Exception e) {
|
||||
logger.error("导入会员余额失败, phone:{}, param:{}", phone, JSON.toJSONString(memberBalanceDTO), e);
|
||||
return ImportMemberBalanceItemResultDTO.fail(phone, e.getMessage());
|
||||
String errorMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
|
||||
return ImportMemberBalanceItemResultDTO.fail(phone, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1613,6 +1614,8 @@ public class TempService {
|
||||
|
||||
// 1. 根据手机号查询万车充会员信息;不存在则静默注册一个属于万车充体系的会员。
|
||||
MemberBasicInfo memberBasicInfo = findOrCreateJsowellMember(phone);
|
||||
logger.info("导入会员余额-会员准备完成, phone:{}, memberId:{}, memberMerchantId:{}, balance:{}",
|
||||
phone, memberBasicInfo.getMemberId(), memberBasicInfo.getMerchantId(), balance);
|
||||
|
||||
// 2. 给“南通晨鸣中锦置业有限责任公司”运营商钱包增加本金余额。
|
||||
increaseMemberWalletBalance(memberBasicInfo.getMemberId(), balance);
|
||||
@@ -1653,6 +1656,8 @@ public class TempService {
|
||||
* <p>如果该运营商钱包不存在,现有余额逻辑会自动创建钱包并记录流水。</p>
|
||||
*/
|
||||
private void increaseMemberWalletBalance(String memberId, BigDecimal balance) {
|
||||
logger.info("导入会员余额-开始增加钱包余额, memberId:{}, targetMerchantId:{}, balance:{}",
|
||||
memberId, NANTONG_CHENMING_WALLET_MERCHANT_ID, balance);
|
||||
UpdateMemberBalanceDTO updateMemberBalanceDTO = UpdateMemberBalanceDTO.builder()
|
||||
.memberId(memberId)
|
||||
.type(MemberWalletEnum.TYPE_IN.getValue())
|
||||
@@ -1661,6 +1666,8 @@ public class TempService {
|
||||
.targetMerchantId(NANTONG_CHENMING_WALLET_MERCHANT_ID)
|
||||
.build();
|
||||
memberBasicInfoService.updateMemberBalance(updateMemberBalanceDTO);
|
||||
logger.info("导入会员余额-钱包余额增加完成, memberId:{}, targetMerchantId:{}, balance:{}",
|
||||
memberId, NANTONG_CHENMING_WALLET_MERCHANT_ID, balance);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -147,15 +147,12 @@ public class IdUtils {
|
||||
* 生成八位会员id
|
||||
*/
|
||||
public static String getMemberId() {
|
||||
long id = Long.parseLong(SnowflakeIdWorker.getSnowflakeId());
|
||||
StringBuilder sb = new StringBuilder(id + "");
|
||||
StringBuilder reverse = sb.reverse();// 将id翻转:我们发现id很长,且高位很长部分是一样的数
|
||||
id = new Long(reverse.toString()) / 1000;// 切去部分长度
|
||||
while (id > 100000000) {
|
||||
id /= 10;
|
||||
}
|
||||
Integer num = Integer.parseInt(id + "");
|
||||
return String.valueOf(num);
|
||||
long snowflakeId = Long.parseLong(SnowflakeIdWorker.getSnowflakeId());
|
||||
|
||||
// 对雪花 ID 做轻量混洗,再压缩到 8 位数字区间,分布比原来的“反转后截断”更均匀。
|
||||
long mixed = snowflakeId ^ (snowflakeId >>> 33) ^ (snowflakeId >>> 17);
|
||||
long memberId = Math.floorMod(mixed, 90000000L) + 10000000L;
|
||||
return String.valueOf(memberId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,7 @@ public class MemberWalletInfo {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 会员id
|
||||
@@ -66,4 +66,4 @@ public class MemberWalletInfo {
|
||||
* 删除标识(0-正常;1-删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,14 @@ public interface MemberBasicInfoMapper {
|
||||
*/
|
||||
MemberBasicInfo selectInfoByMemberId(String memberId);
|
||||
|
||||
/**
|
||||
* 判断会员id是否已存在。
|
||||
*
|
||||
* @param memberId 会员id
|
||||
* @return 1-存在;null-不存在
|
||||
*/
|
||||
Integer existsByMemberId(@Param("memberId") String memberId);
|
||||
|
||||
/**
|
||||
* 更新会员余额
|
||||
* @param memberId 会员id
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
public interface MemberWalletInfoMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(MemberWalletInfo record);
|
||||
|
||||
@@ -17,7 +17,7 @@ public interface MemberWalletInfoMapper {
|
||||
|
||||
int insertSelective(MemberWalletInfo record);
|
||||
|
||||
MemberWalletInfo selectByPrimaryKey(Integer id);
|
||||
MemberWalletInfo selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByPrimaryKeySelective(MemberWalletInfo record);
|
||||
|
||||
|
||||
@@ -91,6 +91,14 @@ public interface MemberBasicInfoService {
|
||||
*/
|
||||
MemberBasicInfo selectInfoByMemberId(String memberId);
|
||||
|
||||
/**
|
||||
* 判断指定会员id是否已经存在。
|
||||
*
|
||||
* @param memberId 会员id
|
||||
* @return true-已存在;false-不存在
|
||||
*/
|
||||
boolean existsByMemberId(String memberId);
|
||||
|
||||
String generateWalletCode();
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,13 +6,13 @@ import com.jsowell.pile.vo.base.MemberWalletVO;
|
||||
import java.util.List;
|
||||
|
||||
public interface MemberWalletInfoService {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(MemberWalletInfo record);
|
||||
|
||||
int insertSelective(MemberWalletInfo record);
|
||||
|
||||
MemberWalletInfo selectByPrimaryKey(Integer id);
|
||||
MemberWalletInfo selectByPrimaryKey(Long id);
|
||||
|
||||
MemberWalletInfo selectByMemberId(String memberId, String merchantId);
|
||||
|
||||
|
||||
@@ -180,6 +180,11 @@ public class MemberBasicInfoServiceImpl implements MemberBasicInfoService {
|
||||
return memberBasicInfoMapper.selectInfoByMemberId(memberId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existsByMemberId(String memberId) {
|
||||
return memberBasicInfoMapper.existsByMemberId(memberId) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成钱包卡号WalletCode
|
||||
* @return
|
||||
@@ -267,8 +272,16 @@ public class MemberBasicInfoServiceImpl implements MemberBasicInfoService {
|
||||
createBy = SecurityUtils.getLoginUser().getUserId() + "";
|
||||
}
|
||||
|
||||
// 查询用户余额
|
||||
MemberWalletInfo walletInfo = memberWalletInfoService.selectByMemberId(memberId, targetMerchantId);
|
||||
log.info("修改用户余额-开始查询钱包, memberId:{}, targetMerchantId:{}, type:{}, subType:{}, updatePrincipalBalance:{}, updateGiftBalance:{}",
|
||||
memberId, targetMerchantId, type, dto.getSubType(), updatePrincipalBalance, updateGiftBalance);
|
||||
MemberWalletInfo walletInfo;
|
||||
try {
|
||||
walletInfo = memberWalletInfoService.selectByMemberId(memberId, targetMerchantId);
|
||||
} catch (Exception e) {
|
||||
log.error("修改用户余额-查询钱包异常, memberId:{}, targetMerchantId:{}, memberIdLength:{}, exceptionType:{}",
|
||||
memberId, targetMerchantId, memberId == null ? null : memberId.length(), e.getClass().getName(), e);
|
||||
throw e;
|
||||
}
|
||||
log.info("修改用户余额-根据会员id:{}, 目标运营商id:{}, 查询结果:{}", memberId, targetMerchantId, JSON.toJSONString(walletInfo));
|
||||
if (walletInfo == null) {
|
||||
log.info("修改用户余额-根据会员id:{}, 目标运营商id:{}, 查询会员信息为空, 新建会员钱包", memberId, targetMerchantId);
|
||||
@@ -282,6 +295,11 @@ public class MemberBasicInfoServiceImpl implements MemberBasicInfoService {
|
||||
.version(0)
|
||||
.build();
|
||||
memberWalletInfoService.insertSelective(walletInfo);
|
||||
log.info("修改用户余额-会员钱包创建完成, memberId:{}, targetMerchantId:{}, walletId:{}, walletCode:{}",
|
||||
memberId, targetMerchantId, walletInfo.getId(), walletInfo.getWalletCode());
|
||||
} else {
|
||||
log.info("修改用户余额-命中会员钱包, memberId:{}, targetMerchantId:{}, walletId:{}, walletCode:{}, version:{}",
|
||||
memberId, targetMerchantId, walletInfo.getId(), walletInfo.getWalletCode(), walletInfo.getVersion());
|
||||
}
|
||||
|
||||
// 钱包编号
|
||||
|
||||
@@ -25,7 +25,7 @@ public class MemberWalletInfoServiceImpl implements MemberWalletInfoService {
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(Integer id) {
|
||||
public int deleteByPrimaryKey(Long id) {
|
||||
return memberWalletInfoMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class MemberWalletInfoServiceImpl implements MemberWalletInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberWalletInfo selectByPrimaryKey(Integer id) {
|
||||
public MemberWalletInfo selectByPrimaryKey(Long id) {
|
||||
return memberWalletInfoMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,6 +173,14 @@
|
||||
and member_id = #{memberId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<select id="existsByMemberId" resultType="java.lang.Integer">
|
||||
select 1
|
||||
from member_basic_info
|
||||
where del_flag = '0'
|
||||
and member_id = #{memberId,jdbcType=VARCHAR}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<update id="updateMemberBalance">
|
||||
update member_wallet_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<resultMap id="BaseResultMap" type="com.jsowell.pile.domain.MemberWalletInfo">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table member_wallet_info-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="member_id" jdbcType="VARCHAR" property="memberId" />
|
||||
<result column="merchant_id" jdbcType="VARCHAR" property="merchantId" />
|
||||
<result column="wallet_code" jdbcType="VARCHAR" property="walletCode" />
|
||||
@@ -22,17 +22,17 @@
|
||||
id, member_id, merchant_id, wallet_code, principal_balance, gift_balance, version,
|
||||
create_by, create_time, update_by, update_time, del_flag
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
<!--@mbg.generated-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from member_wallet_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
<!--@mbg.generated-->
|
||||
delete from member_wallet_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.MemberWalletInfo" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
@@ -157,7 +157,7 @@
|
||||
del_flag = #{delFlag,jdbcType=CHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.jsowell.pile.domain.MemberWalletInfo">
|
||||
<!--@mbg.generated-->
|
||||
@@ -173,7 +173,7 @@
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
del_flag = #{delFlag,jdbcType=CHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateBatch" parameterType="java.util.List">
|
||||
<!--@mbg.generated-->
|
||||
@@ -181,63 +181,63 @@
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<trim prefix="member_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.memberId,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.memberId,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="merchant_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.merchantId,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.merchantId,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="wallet_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.walletCode,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.walletCode,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="principal_balance = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.principalBalance,jdbcType=DECIMAL}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.principalBalance,jdbcType=DECIMAL}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="gift_balance = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.giftBalance,jdbcType=DECIMAL}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.giftBalance,jdbcType=DECIMAL}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="version = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.version,jdbcType=INTEGER}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.version,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="create_by = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.createBy,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="create_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.createTime,jdbcType=TIMESTAMP}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_by = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.updateBy,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.updateTime,jdbcType=TIMESTAMP}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="del_flag = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.delFlag,jdbcType=CHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.delFlag,jdbcType=CHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
||||
#{item.id,jdbcType=INTEGER}
|
||||
#{item.id,jdbcType=BIGINT}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="updateBatchSelective" parameterType="java.util.List">
|
||||
@@ -247,84 +247,84 @@
|
||||
<trim prefix="member_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.memberId != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.memberId,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.memberId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="merchant_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.merchantId != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.merchantId,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.merchantId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="wallet_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.walletCode != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.walletCode,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.walletCode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="principal_balance = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.principalBalance != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.principalBalance,jdbcType=DECIMAL}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.principalBalance,jdbcType=DECIMAL}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="gift_balance = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.giftBalance != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.giftBalance,jdbcType=DECIMAL}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.giftBalance,jdbcType=DECIMAL}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="version = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.version != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.version,jdbcType=INTEGER}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.version,jdbcType=INTEGER}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="create_by = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.createBy != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.createBy,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="create_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.createTime != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.createTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_by = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.updateBy != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.updateBy,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.updateTime != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.updateTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="del_flag = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.delFlag != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.delFlag,jdbcType=CHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.delFlag,jdbcType=CHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
||||
#{item.id,jdbcType=INTEGER}
|
||||
#{item.id,jdbcType=BIGINT}
|
||||
</foreach>
|
||||
</update>
|
||||
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
||||
@@ -363,7 +363,7 @@
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
#{memberId,jdbcType=VARCHAR},
|
||||
#{merchantId,jdbcType=VARCHAR},
|
||||
@@ -380,7 +380,7 @@
|
||||
on duplicate key update
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id = #{id,jdbcType=INTEGER},
|
||||
id = #{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
member_id = #{memberId,jdbcType=VARCHAR},
|
||||
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
||||
@@ -439,7 +439,7 @@
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="memberId != null">
|
||||
#{memberId,jdbcType=VARCHAR},
|
||||
@@ -478,7 +478,7 @@
|
||||
on duplicate key update
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id = #{id,jdbcType=INTEGER},
|
||||
id = #{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="memberId != null">
|
||||
member_id = #{memberId,jdbcType=VARCHAR},
|
||||
|
||||
Reference in New Issue
Block a user