Files
zxjp-web/coolstore-partner-dao/src/main/resources/mapper/AdjustmentOrderMapper.xml
正新 7c5a2c858d Merge #109 into master from cc_20260420_export
feat:数量不一致

* cc_20260420_export: (7 commits squashed)

  - feat:提示修改

  - feat:提示修改

  - feat:导出调整

  - feat:管理员查询所有 非管理员权限查询

  - feat:管理员查询所有 非管理员权限查询

  - feat:fix

  - feat:数量不一致

Signed-off-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>
Merged-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>

CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/109
2026-04-24 09:44:31 +00:00

160 lines
6.6 KiB
XML

<?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">
<mapper namespace="com.cool.store.mapper.AdjustmentOrderMapper">
<!-- 根据调整单号查询 -->
<select id="getByAdjustmentNo" resultType="com.cool.store.entity.AdjustmentOrderDO">
select *
from zxjp_adjustment_order
where adjustment_no = #{adjustmentNo}
</select>
<!-- 根据状态查询 -->
<select id="listByStatus" resultType="com.cool.store.entity.AdjustmentOrderDO">
select *
from zxjp_adjustment_order
where status = #{status}
order by create_time desc
</select>
<!-- 根据关联分账单号查询 -->
<select id="listByRelatedSplitNo" resultType="com.cool.store.entity.AdjustmentOrderDO">
select *
from zxjp_adjustment_order
where related_split_no = #{relatedSplitNo}
</select>
<!-- 根据门店ID查询 -->
<select id="listByStoreId" resultType="com.cool.store.entity.AdjustmentOrderDO">
select *
from zxjp_adjustment_order
where store_id = #{storeId}
order by create_time desc
</select>
<!-- 批量更新状态 -->
<update id="batchUpdateStatus">
update zxjp_adjustment_order
set status = #{status}
where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<!-- 根据ID更新关联分账单号 -->
<update id="updateRelatedSplitNo">
update zxjp_adjustment_order
set related_split_no = #{relatedSplitNo}
where id = #{id}
</update>
<!-- 分页查询 -->
<select id="pageQuery" resultType="com.cool.store.response.AdjustmentOrderResponse">
select
a.*,
b.store_name as storeName,
b.store_num as storeNum,
a.pay_time as payTime
from zxjp_adjustment_order a
left join store_${enterpriseId} b
on a.store_id = b.store_id
where a.deleted = 0
<if test="request.keyword != null and request.keyword != ''">
and (b.store_name like concat('%', #{request.keyword}, '%')
or b.store_num like concat('%', #{request.keyword}, '%'))
</if>
<if test="request.adjustmentNo != null and request.adjustmentNo != ''">
and a.adjustment_no like concat('%', #{request.adjustmentNo}, '%')
</if>
<if test="request.storeId != null and request.storeId != ''">
and a.store_id = #{request.storeId}
</if>
<if test="request.expenseTypeCode != null and request.expenseTypeCode != ''">
and a.expense_type_code = #{request.expenseTypeCode}
</if>
<if test="request.adjustType != null">
and a.adjust_type = #{request.adjustType}
</if>
<if test="request.statusList != null and request.statusList.size() > 0">
and a.status in
<foreach collection="request.statusList" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="request.adjustReason != null and request.adjustReason != ''">
and a.adjust_reason like concat('%', #{request.adjustReason}, '%')
</if>
<if test="request.businessTypeCode != null and request.businessTypeCode != ''">
and a.business_type_code = #{request.businessTypeCode}
</if>
<if test="request.claimStartTime != null">
and a.claim_time &gt;= #{request.claimStartTime}
</if>
<if test="request.claimEndTime != null">
and a.claim_time &lt;= #{request.claimEndTime}
</if>
<if test="request.expenseSheetType != null and request.expenseSheetType != ''">
and a.expense_sheet_type = #{request.expenseSheetType}
</if>
<if test="request.regionIds != null and !request.regionIds.isEmpty()">
AND <foreach collection="request.regionIds" item="regionId" separator=" OR " open="(" close=")">
b.region_path LIKE CONCAT('%/', #{regionId}, '/%')
</foreach>
</if>
order by create_time desc
</select>
<!-- 分页查询总数 -->
<select id="pageCount" resultType="java.lang.Long">
select count(1)
from zxjp_adjustment_order a
left join store_${enterpriseId} b
on a.store_id = b.store_id
where a.deleted = 0
<if test="request.keyword != null and request.keyword != ''">
and (b.store_name like concat('%', #{request.keyword}, '%')
or b.store_num like concat('%', #{request.keyword}, '%'))
</if>
<if test="request.adjustmentNo != null and request.adjustmentNo != ''">
and a.adjustment_no like concat('%', #{request.adjustmentNo}, '%')
</if>
<if test="request.storeId != null and request.storeId != ''">
and a.store_id = #{request.storeId}
</if>
<if test="request.expenseTypeCode != null and request.expenseTypeCode != ''">
and a.expense_type_code = #{request.expenseTypeCode}
</if>
<if test="request.adjustType != null">
and a.adjust_type = #{request.adjustType}
</if>
<if test="request.statusList != null and request.statusList.size() > 0">
and a.status in
<foreach collection="request.statusList" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="request.adjustReason != null and request.adjustReason != ''">
and a.adjust_reason like concat('%', #{request.adjustReason}, '%')
</if>
<if test="request.businessTypeCode != null and request.businessTypeCode != ''">
and a.business_type_code = #{request.businessTypeCode}
</if>
<if test="request.claimStartTime != null">
and a.claim_time &gt;= #{request.claimStartTime}
</if>
<if test="request.claimEndTime != null">
and a.claim_time &lt;= #{request.claimEndTime}
</if>
<if test="request.expenseSheetType != null and request.expenseSheetType != ''">
and a.expense_sheet_type = #{request.expenseSheetType}
</if>
<if test="request.regionIds != null and !request.regionIds.isEmpty()">
AND <foreach collection="request.regionIds" item="regionId" separator=" OR " open="(" close=")">
b.region_path LIKE CONCAT('%/', #{regionId}, '/%')
</foreach>
</if>
</select>
</mapper>