用户仪器关联去除仪器名字段冗余

master
382696293@qq.com 2 years ago
parent 9068efe724
commit a85061927d

@ -316,24 +316,5 @@ public class WxUserInstrument extends BaseEntity
this.queryString = queryString;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("serial", getSerial())
.append("instrumentId", getInstrumentId())
.append("instrumentName", getInstrumentName())
.append("serialImage", getSerialImage())
.append("guarantee", getGuarantee())
.append("guaranteeEndtime", getGuaranteeEndtime())
.append("bindingStatus", getBindingStatus())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

@ -9,7 +9,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="userId" column="user_id" />
<result property="serial" column="serial" />
<result property="instrumentId" column="instrument_id" />
<result property="instrumentName" column="instrument_name" />
<result property="serialImage" column="serial_image" />
<result property="guarantee" column="guarantee" />
<result property="guaranteeEndtime" column="guarantee_endtime" />
@ -23,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWxUserInstrumentVo">
select id, user_id, serial, instrument_id, instrument_name, serial_image, guarantee, guarantee_endtime, binding_status, status, create_by, create_time, update_by, update_time, remark from wx_user_instrument
select id, user_id, serial, instrument_id, serial_image, guarantee, guarantee_endtime, binding_status, status, create_by, create_time, update_by, update_time, remark from wx_user_instrument
</sql>
<select id="selectListByCondition" parameterType="WxUserInstrument" resultMap="WxUserInstrumentResult">
@ -60,7 +59,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null "> and user_id = #{userId}</if>
<if test="serial != null and serial != ''"> and serial like concat('%', #{serial}, '%')</if>
<if test="instrumentId != null "> and instrument_id like concat('%', #{instrumentId}, '%')</if>
<if test="instrumentName != null and instrumentName != ''"> and instrument_name like concat('%', #{instrumentName}, '%')</if>
<if test="serialImage != null and serialImage != ''"> and serial_image = #{serialImage}</if>
<if test="guarantee != null "> and guarantee = #{guarantee}</if>
<if test="guaranteeEndtime != null "> and guarantee_endtime = #{guaranteeEndtime}</if>
@ -106,7 +104,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">user_id,</if>
<if test="serial != null and serial != ''">serial,</if>
<if test="instrumentId != null">instrument_id,</if>
<if test="instrumentName != null and instrumentName != ''">instrument_name,</if>
<if test="serialImage != null and serialImage != ''">serial_image,</if>
<if test="guarantee != null">guarantee,</if>
<if test="guaranteeEndtime != null">guarantee_endtime,</if>
@ -122,7 +119,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">#{userId},</if>
<if test="serial != null and serial != ''">#{serial},</if>
<if test="instrumentId != null">#{instrumentId},</if>
<if test="instrumentName != null and instrumentName != ''">#{instrumentName},</if>
<if test="serialImage != null and serialImage != ''">#{serialImage},</if>
<if test="guarantee != null">#{guarantee},</if>
<if test="guaranteeEndtime != null">#{guaranteeEndtime},</if>
@ -142,7 +138,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">user_id = #{userId},</if>
<if test="serial != null and serial != ''">serial = #{serial},</if>
<if test="instrumentId != null">instrument_id = #{instrumentId},</if>
<if test="instrumentName != null and instrumentName != ''">instrument_name = #{instrumentName},</if>
<if test="serialImage != null and serialImage != ''">serial_image = #{serialImage},</if>
<if test="guarantee != null">guarantee = #{guarantee},</if>
<if test="guaranteeEndtime != null">guarantee_endtime = #{guaranteeEndtime},</if>

@ -221,7 +221,6 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
saveEntity.setSerial(serial);
saveEntity.setSerialImage(serialImage);
saveEntity.setInstrumentId(wxInstrumentSerial.getInstrumentId());
saveEntity.setInstrumentName(wxInstrumentSerial.getInstrumentName());
saveEntity.setGuarantee(wxInstrument.getGuarantee());
if (wxInstrument.getGuarantee() != null && wxInstrument.getGuarantee() >= 0) {
Instant instant = LocalDateTime.now().plusYears(wxInstrument.getGuarantee()).atZone(ZoneId.systemDefault()).toInstant();
@ -380,7 +379,7 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
oldUserInstrumentLog.setUserId(wxUserMember.getId());
oldUserInstrumentLog.setSerial(wxUserInstrument.getSerial());
oldUserInstrumentLog.setInstrumentId(wxUserInstrument.getInstrumentId());
oldUserInstrumentLog.setInstrumentName(wxUserInstrument.getInstrumentName());
oldUserInstrumentLog.setInstrumentName(wxInstrument.getName());
oldUserInstrumentLog.setSerialImage(wxUserInstrument.getSerialImage());
oldUserInstrumentLog.setGuarantee(wxUserInstrument.getGuarantee());
oldUserInstrumentLog.setGuaranteeEndtime(wxUserInstrument.getGuaranteeEndtime());
@ -395,7 +394,7 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
newUserInstrumentLog.setUserId(wxUserMember.getId());
newUserInstrumentLog.setSerial(serial);
newUserInstrumentLog.setInstrumentId(wxUserInstrument.getInstrumentId());
newUserInstrumentLog.setInstrumentName(wxUserInstrument.getInstrumentName());
newUserInstrumentLog.setInstrumentName(wxInstrument.getName());
newUserInstrumentLog.setSerialImage(wxUserInstrument.getSerialImage());
newUserInstrumentLog.setGuarantee(wxUserInstrument.getGuarantee());
newUserInstrumentLog.setGuaranteeEndtime(updateEntity.getGuaranteeEndtime());

@ -124,7 +124,10 @@ public class WxUserInstrumentServiceImpl implements IWxUserInstrumentService
wxInstrumentSerialLog.setUserMobile(userMember.getMobile());
wxInstrumentSerialLog.setUserHeadimg(userMember.getHeadimg());
wxInstrumentSerialLog.setInstrumentId(userInstrument.getInstrumentId());
wxInstrumentSerialLog.setInstrumentName(userInstrument.getInstrumentName());
WxInstrument wxInstrument = wxInstrumentMapper.selectWxInstrumentById(userInstrument.getInstrumentId());
if(wxInstrument != null) {
wxInstrumentSerialLog.setInstrumentName(wxInstrument.getName());
}
wxInstrumentSerialLog.setSerial(userInstrument.getSerial());
wxInstrumentSerialLog.setBindingStatus(BindingStatusEnums.UN_BOUND.getCode());
instrumentSerialLogMapper.insertWxInstrumentSerialLog(wxInstrumentSerialLog);
@ -208,10 +211,6 @@ public class WxUserInstrumentServiceImpl implements IWxUserInstrumentService
WxInstrumentSerial instrumentSerialVo = serialList.get(0);
userInstrumentRecord.setInstrumentId(instrumentSerialVo.getInstrumentId());
userInstrumentRecord.setSerial(instrumentSerialVo.getSerial());
WxInstrument wxInstrument = wxInstrumentMapper.selectWxInstrumentById(instrumentSerialVo.getInstrumentId());
if(wxInstrument != null) {
userInstrumentRecord.setInstrumentName(wxInstrument.getName());
}
// userInstrumentRecord.setSerialImage(userInstrument.getSerialImage());
// 从新绑定
this.saveLog(userInstrumentRecord,0);
@ -345,7 +344,10 @@ public class WxUserInstrumentServiceImpl implements IWxUserInstrumentService
log.setGuarantee(userInstrumentRecord.getGuarantee());
log.setInstrumentId(userInstrumentRecord.getInstrumentId());
log.setUserId(userInstrumentRecord.getUserId());
log.setInstrumentName(userInstrumentRecord.getInstrumentName());
WxInstrument wxInstrument = wxInstrumentMapper.selectWxInstrumentById(userInstrumentRecord.getInstrumentId());
if(wxInstrument != null) {
log.setInstrumentName(wxInstrument.getName());
}
log.setSerialImage(userInstrumentRecord.getSerialImage());
log.setSerial(userInstrumentRecord.getSerial());
log.setGuaranteeEndtime(userInstrumentRecord.getGuaranteeEndtime());

@ -70,6 +70,9 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
@Autowired
private WxInstrumentSerialMapper wxInstrumentSerialMapper;
@Autowired
private WxInstrumentMapper wxInstrumentMapper;
/**
*
*
@ -424,7 +427,16 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
wxUserInstrument.setUserId(wxUserMemberRet.getId());
wxUserInstrument.setBindingStatus(BindingStatusEnums.BINDED.getCode());
wxUserInstrument.setStatus(Status.OK.getCode().longValue());
wxUserMemberRet.setInstrumentList(wxUserInstrumentMapper.selectWxUserInstrumentList(wxUserInstrument));
List<WxUserInstrument> userInstrumentList = wxUserInstrumentMapper.selectWxUserInstrumentList(wxUserInstrument);
if(userInstrumentList != null && userInstrumentList.size() > 0) {
userInstrumentList.forEach(ui -> {
WxInstrument wxInstrument = wxInstrumentMapper.selectWxInstrumentById(ui.getInstrumentId());
if(wxInstrument != null) {
ui.setInstrumentName(wxInstrument.getName());
}
});
}
wxUserMemberRet.setInstrumentList(userInstrumentList);
}
}
return wxUserMemberRetList;

Loading…
Cancel
Save