feat(ofs): 添加修改时间字段并优化查询逻辑

- 在 TocofsReturngoodsEntity 中添加 modified 字段,用于记录修改时间- 在 XML 配置文件中添加 modified 字段的映射和查询条件
- 优化查询逻辑,移除不必要的排序条件
- 更新测试用例中的订单代码
This commit is contained in:
liuy 2024-12-26 10:57:54 +08:00
parent 3043dcc9fa
commit 18867cda59
5 changed files with 50 additions and 31 deletions

View File

@ -130,5 +130,9 @@ public class TocofsReturngoodsEntity extends BaseEntity {
private String returncarrier;
private String refundedat;
private String refundstatus;
/**
* 2024-12-26 10:38:00
*/
private String modified;
}

View File

@ -3,7 +3,7 @@
<mapper namespace="com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDaoImpl">
<resultMap id="get-TocofsReturngoodsEntity-result" type="com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="clientcode" column="clientCode" jdbcType="VARCHAR"/>
<result property="companycode" column="companyCode" jdbcType="VARCHAR"/>
<result property="storecode" column="storeCode" jdbcType="VARCHAR"/>
@ -57,6 +57,7 @@
<result property="returncarrier" column="returnCarrier" jdbcType="VARCHAR"/>
<result property="refundedat" column="refundedAt" jdbcType="VARCHAR"/>
<result property="refundstatus" column="refundStatus" jdbcType="VARCHAR"/>
<result property="modified" column="modified" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
@ -114,8 +115,10 @@
,returnWaybillCode
,returnCarrier
,refundedAt
,refundStatus
,refundStatus
,modified
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-TocofsReturngoodsEntity-result" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity">
select
@ -176,10 +179,11 @@
<if test="returncarrier != null and returncarrier != ''"> and returnCarrier = #{returncarrier} </if>
<if test="refundedat != null and refundedat != ''"> and refundedAt = #{refundedat} </if>
<if test="refundstatus != null and refundstatus != ''"> and refundStatus = #{refundstatus} </if>
and sts='Y'
<if test="modified != null and modified != ''"> and modified = #{modified} </if>
-- and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
<!-- <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>-->
<!-- <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>-->
</select>
<!-- 查询符合条件的数量 -->
@ -240,13 +244,14 @@
<if test="returncarrier != null and returncarrier != ''"> and returnCarrier = #{returncarrier} </if>
<if test="refundedat != null and refundedat != ''"> and refundedAt = #{refundedat} </if>
<if test="refundstatus != null and refundstatus != ''"> and refundStatus = #{refundstatus} </if>
and sts='Y'
<if test="modified != null and modified != ''"> and modified = #{modified} </if>
-- and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
<!-- <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>-->
<!-- <if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>-->
</select>
<!-- 分页查询列表 采用like格式 -->
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-TocofsReturngoodsEntity-result" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity">
select
<include refid="TocofsReturngoodsEntity_Base_Column_List" />
@ -306,10 +311,11 @@
<if test="returncarrier != null and returncarrier != ''"> and returnCarrier like concat('%',#{returncarrier},'%') </if>
<if test="refundedat != null and refundedat != ''"> and refundedAt like concat('%',#{refundedat},'%') </if>
<if test="refundstatus != null and refundstatus != ''"> and refundStatus like concat('%',#{refundstatus},'%') </if>
and sts='Y'
<if test="modified != null and modified != ''"> and modified like concat('%',#{modified},'%') </if>
-- and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
<!-- <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>-->
<!-- <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>-->
</select>
<!-- 查询列表 字段采用or格式 -->
@ -372,10 +378,11 @@
<if test="returncarrier != null and returncarrier != ''"> or returnCarrier = #{returncarrier} </if>
<if test="refundedat != null and refundedat != ''"> or refundedAt = #{refundedat} </if>
<if test="refundstatus != null and refundstatus != ''"> or refundStatus = #{refundstatus} </if>
and sts='Y'
<if test="modified != null and modified != ''"> or modified = #{modified} </if>
-- and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
<!-- <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>-->
<!-- <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>-->
</select>
<!--新增所有列-->
@ -436,8 +443,9 @@
<if test="returncarrier != null and returncarrier != ''"> returnCarrier , </if>
<if test="refundedat != null and refundedat != ''"> refundedAt , </if>
<if test="refundstatus != null and refundstatus != ''"> refundStatus , </if>
<if test="sorts == null ">sorts,</if>
<if test="sts == null ">sts,</if>
<if test="modified != null and modified != ''"> modified , </if>
<!-- <if test="sorts == null ">sorts,</if>-->
<!-- <if test="sts == null ">sts,</if>-->
</trim>
)values(
<trim suffix="" suffixOverrides=",">
@ -495,27 +503,28 @@
<if test="returncarrier != null and returncarrier != ''"> #{returncarrier} ,</if>
<if test="refundedat != null and refundedat != ''"> #{refundedat} ,</if>
<if test="refundstatus != null and refundstatus != ''"> #{refundstatus} ,</if>
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from tocofs_returngoods a WHERE a.sts = 'Y' ),</if>
<if test="sts == null ">'Y',</if>
<if test="modified != null and modified != ''"> #{modified} ,</if>
<!-- <if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from tocofs_returngoods a WHERE a.sts = 'Y' ),</if>-->
<!-- <if test="sts == null ">'Y',</if>-->
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tocofs_returngoods(clientCode, companyCode, storeCode, facilityCode, code, internalInstructionType, bizChannel, refOrderId, refOrderCode, refOrderType, closed, closedBy, status, allowOverReceive, shipFromAttentionTo, shipFromAddress, shipFromCountry, shipFromState, shipFromCity, shipFromDistrict, shipFromPostalCode, shipFromMobile, shipFromEmail, totalLines, totalQty, totalAmount, totalWeight, totalVolume, totalVolumeWeight, totalFulfillAmount, totalFulfillWeight, totalFulfillVolume, totalFulfillVolumeWeight, totalFulfillQty, totalCases, totalContainers, closeAtQty, quantityUM, weightUM, volumeUM, checkInFrom, checkInTo, closedAt, sourcePlatformCode, sourceOrderCode, created, createdBy, lastUpdated, lastUpdatedBy, returnWaybillCode, returnCarrier, refundedAt, refundStatus, sts)
insert into tocofs_returngoods(id,clientCode, companyCode, storeCode, facilityCode, code, internalInstructionType, bizChannel, refOrderId, refOrderCode, refOrderType, closed, closedBy, status, allowOverReceive, shipFromAttentionTo, shipFromAddress, shipFromCountry, shipFromState, shipFromCity, shipFromDistrict, shipFromPostalCode, shipFromMobile, shipFromEmail, totalLines, totalQty, totalAmount, totalWeight, totalVolume, totalVolumeWeight, totalFulfillAmount, totalFulfillWeight, totalFulfillVolume, totalFulfillVolumeWeight, totalFulfillQty, totalCases, totalContainers, closeAtQty, quantityUM, weightUM, volumeUM, checkInFrom, checkInTo, closedAt, sourcePlatformCode, sourceOrderCode, created, createdBy, lastUpdated, lastUpdatedBy, returnWaybillCode, returnCarrier, refundedAt, refundStatus,modified)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.clientcode},#{entity.companycode},#{entity.storecode},#{entity.facilitycode},#{entity.code},#{entity.internalinstructiontype},#{entity.bizchannel},#{entity.reforderid},#{entity.refordercode},#{entity.refordertype},#{entity.closed},#{entity.closedby},#{entity.status},#{entity.allowoverreceive},#{entity.shipfromattentionto},#{entity.shipfromaddress},#{entity.shipfromcountry},#{entity.shipfromstate},#{entity.shipfromcity},#{entity.shipfromdistrict},#{entity.shipfrompostalcode},#{entity.shipfrommobile},#{entity.shipfromemail},#{entity.totallines},#{entity.totalqty},#{entity.totalamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.totalfulfillamount},#{entity.totalfulfillweight},#{entity.totalfulfillvolume},#{entity.totalfulfillvolumeweight},#{entity.totalfulfillqty},#{entity.totalcases},#{entity.totalcontainers},#{entity.closeatqty},#{entity.quantityum},#{entity.weightum},#{entity.volumeum},#{entity.checkinfrom},#{entity.checkinto},#{entity.closedat},#{entity.sourceplatformcode},#{entity.sourceordercode},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.returnwaybillcode},#{entity.returncarrier},#{entity.refundedat},#{entity.refundstatus}, 'Y')
(#{entity.id},#{entity.clientcode},#{entity.companycode},#{entity.storecode},#{entity.facilitycode},#{entity.code},#{entity.internalinstructiontype},#{entity.bizchannel},#{entity.reforderid},#{entity.refordercode},#{entity.refordertype},#{entity.closed},#{entity.closedby},#{entity.status},#{entity.allowoverreceive},#{entity.shipfromattentionto},#{entity.shipfromaddress},#{entity.shipfromcountry},#{entity.shipfromstate},#{entity.shipfromcity},#{entity.shipfromdistrict},#{entity.shipfrompostalcode},#{entity.shipfrommobile},#{entity.shipfromemail},#{entity.totallines},#{entity.totalqty},#{entity.totalamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.totalfulfillamount},#{entity.totalfulfillweight},#{entity.totalfulfillvolume},#{entity.totalfulfillvolumeweight},#{entity.totalfulfillqty},#{entity.totalcases},#{entity.totalcontainers},#{entity.closeatqty},#{entity.quantityum},#{entity.weightum},#{entity.volumeum},#{entity.checkinfrom},#{entity.checkinto},#{entity.closedat},#{entity.sourceplatformcode},#{entity.sourceordercode},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.returnwaybillcode},#{entity.returncarrier},#{entity.refundedat},#{entity.refundstatus},#{entity.modified})
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into tocofs_returngoods(id,clientCode, companyCode, storeCode, facilityCode, code, internalInstructionType, bizChannel, refOrderId, refOrderCode, refOrderType, closed, closedBy, status, allowOverReceive, shipFromAttentionTo, shipFromAddress, shipFromCountry, shipFromState, shipFromCity, shipFromDistrict, shipFromPostalCode, shipFromMobile, shipFromEmail, totalLines, totalQty, totalAmount, totalWeight, totalVolume, totalVolumeWeight, totalFulfillAmount, totalFulfillWeight, totalFulfillVolume, totalFulfillVolumeWeight, totalFulfillQty, totalCases, totalContainers, closeAtQty, quantityUM, weightUM, volumeUM, checkInFrom, checkInTo, closedAt, sourcePlatformCode, sourceOrderCode, created, createdBy, lastUpdated, lastUpdatedBy, returnWaybillCode, returnCarrier, refundedAt, refundStatus)
insert into tocofs_returngoods(id,clientCode, companyCode, storeCode, facilityCode, code, internalInstructionType, bizChannel, refOrderId, refOrderCode, refOrderType, closed, closedBy, status, allowOverReceive, shipFromAttentionTo, shipFromAddress, shipFromCountry, shipFromState, shipFromCity, shipFromDistrict, shipFromPostalCode, shipFromMobile, shipFromEmail, totalLines, totalQty, totalAmount, totalWeight, totalVolume, totalVolumeWeight, totalFulfillAmount, totalFulfillWeight, totalFulfillVolume, totalFulfillVolumeWeight, totalFulfillQty, totalCases, totalContainers, closeAtQty, quantityUM, weightUM, volumeUM, checkInFrom, checkInTo, closedAt, sourcePlatformCode, sourceOrderCode, created, createdBy, lastUpdated, lastUpdatedBy, returnWaybillCode, returnCarrier, refundedAt, refundStatus,modified)
values
<foreach collection="list" item="entity" separator=",">
(#{entity.id},#{entity.clientcode},#{entity.companycode},#{entity.storecode},#{entity.facilitycode},#{entity.code},#{entity.internalinstructiontype},#{entity.bizchannel},#{entity.reforderid},#{entity.refordercode},#{entity.refordertype},#{entity.closed},#{entity.closedby},#{entity.status},#{entity.allowoverreceive},#{entity.shipfromattentionto},#{entity.shipfromaddress},#{entity.shipfromcountry},#{entity.shipfromstate},#{entity.shipfromcity},#{entity.shipfromdistrict},#{entity.shipfrompostalcode},#{entity.shipfrommobile},#{entity.shipfromemail},#{entity.totallines},#{entity.totalqty},#{entity.totalamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.totalfulfillamount},#{entity.totalfulfillweight},#{entity.totalfulfillvolume},#{entity.totalfulfillvolumeweight},#{entity.totalfulfillqty},#{entity.totalcases},#{entity.totalcontainers},#{entity.closeatqty},#{entity.quantityum},#{entity.weightum},#{entity.volumeum},#{entity.checkinfrom},#{entity.checkinto},#{entity.closedat},#{entity.sourceplatformcode},#{entity.sourceordercode},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.returnwaybillcode},#{entity.returncarrier},#{entity.refundedat},#{entity.refundstatus})
(#{entity.id},#{entity.clientcode},#{entity.companycode},#{entity.storecode},#{entity.facilitycode},#{entity.code},#{entity.internalinstructiontype},#{entity.bizchannel},#{entity.reforderid},#{entity.refordercode},#{entity.refordertype},#{entity.closed},#{entity.closedby},#{entity.status},#{entity.allowoverreceive},#{entity.shipfromattentionto},#{entity.shipfromaddress},#{entity.shipfromcountry},#{entity.shipfromstate},#{entity.shipfromcity},#{entity.shipfromdistrict},#{entity.shipfrompostalcode},#{entity.shipfrommobile},#{entity.shipfromemail},#{entity.totallines},#{entity.totalqty},#{entity.totalamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.totalfulfillamount},#{entity.totalfulfillweight},#{entity.totalfulfillvolume},#{entity.totalfulfillvolumeweight},#{entity.totalfulfillqty},#{entity.totalcases},#{entity.totalcontainers},#{entity.closeatqty},#{entity.quantityum},#{entity.weightum},#{entity.volumeum},#{entity.checkinfrom},#{entity.checkinto},#{entity.closedat},#{entity.sourceplatformcode},#{entity.sourceordercode},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.returnwaybillcode},#{entity.returncarrier},#{entity.refundedat},#{entity.refundstatus},#{entity.modified})
</foreach>
on duplicate key update
id = values(id),
@ -571,7 +580,8 @@
returnWaybillCode = values(returnWaybillCode),
returnCarrier = values(returnCarrier),
refundedAt = values(refundedAt),
refundStatus = values(refundStatus)
refundStatus = values(refundStatus),
modified = values(modified)
</insert>
<!--通过主键修改方法-->
@ -631,14 +641,17 @@ update tocofs_returngoods set
<if test="returncarrier != null and returncarrier != ''"> returnCarrier = #{returncarrier},</if>
<if test="refundedat != null and refundedat != ''"> refundedAt = #{refundedat},</if>
<if test="refundstatus != null and refundstatus != ''"> refundStatus = #{refundstatus},</if>
<if test="modified != null and modified != ''"> modified = #{modified},</if>
</trim>
where id = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity" >
update tocofs_returngoods set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity" >
update tocofs_returngoods set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
@ -697,13 +710,14 @@ update tocofs_returngoods set sts= 'N' ,modify_time = #{modify_time},modify_use
<if test="returncarrier != null and returncarrier != ''"> and returnCarrier = #{returncarrier} </if>
<if test="refundedat != null and refundedat != ''"> and refundedAt = #{refundedat} </if>
<if test="refundstatus != null and refundstatus != ''"> and refundStatus = #{refundstatus} </if>
and sts='Y'
<if test="modified != null and modified != ''"> and modified = #{modified} </if>
-- and sts='Y'
</trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
delete from tocofs_returngoods where id = #{id}
</delete>
</mapper>
</mapper>

View File

@ -120,7 +120,7 @@ class SoSaleOutPluginInitializerToCTest {
// String aaa = "LETS-SH2024102800021196";
// soSaleOutPluginInitializerToC.startImplementStockByTime("2024-12-06 09:25:39", "2024-12-06 09:25:39");
soSaleOutPluginInitializerToC.startImplementStockByTime("2024-12-24 21:53:57", "2024-12-24 21:53:57", "2");
// soSaleOutPluginInitializerToC.startImplementStockByTime("2024-12-24 21:53:57", "2024-12-24 21:53:57", "2");
} catch (Exception e) {
e.printStackTrace();
}
@ -129,7 +129,7 @@ class SoSaleOutPluginInitializerToCTest {
try {
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110200030366", "stock");
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110500013375", "tran");
soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024121200024676", "tran");
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024111700013756", "tran");
} catch (Exception e) {

View File

@ -35,8 +35,8 @@ public class SoSaleReturnPluginInitializerToCTest {
public void startImplement() {
// soSaleReturnPluginInitializerToC.startImplement(null, null);
try {
String code = "LETS-RE2024121200000274";
soSaleReturnPluginInitializerToC.startImplementByCode(code, "tran");
String code = "LETS-RE2024122300000847";
soSaleReturnPluginInitializerToC.startImplementByCode(code, "stock");
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -70,6 +70,7 @@ public class StockinOrderSearchResponse extends ReturnMessageBasics {
private String refundStatus;//OFS退款完成状态
private RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData;//OFS售后订单
private com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto;//OFS销售订单
private String modified;
}
@Data