2025-10-16 10:30:21 +08:00
|
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
|
<!DOCTYPE mapper
|
2025-11-21 10:53:04 +08:00
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<mapper namespace="com.delivery.project.document.mapper.RkInfoMapper">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<resultMap type="RkInfo" id="RkInfoResult">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
|
|
<result property="rkType" column="rk_type"/>
|
|
|
|
|
|
<result property="wlType" column="wl_type"/>
|
|
|
|
|
|
<result property="cangku" column="cangku"/>
|
|
|
|
|
|
<result property="rkTime" column="rk_time"/>
|
|
|
|
|
|
<result property="lihuoY" column="lihuo_y"/>
|
|
|
|
|
|
<result property="isChuku" column="is_chuku"/>
|
|
|
|
|
|
<result property="status" column="status"/>
|
|
|
|
|
|
<result property="remark" column="remark"/>
|
|
|
|
|
|
<result property="billNo" column="bill_no"/>
|
|
|
|
|
|
<result property="isDelivery" column="is_delivery"/>
|
|
|
|
|
|
<result property="xj" column="xj"/>
|
|
|
|
|
|
<result property="xmNo" column="xm_no"/>
|
|
|
|
|
|
<result property="xmMs" column="xm_ms"/>
|
|
|
|
|
|
<result property="xmNoCk" column="xm_no_ck"/>
|
|
|
|
|
|
<result property="xmMsCk" column="xm_ms_ck"/>
|
|
|
|
|
|
<result property="wlNo" column="wl_no"/>
|
|
|
|
|
|
<result property="wlMs" column="wl_ms"/>
|
|
|
|
|
|
<result property="gysNo" column="gys_no"/>
|
|
|
|
|
|
<result property="gysMc" column="gys_mc"/>
|
|
|
|
|
|
<result property="jhAmt" column="jh_amt"/>
|
|
|
|
|
|
<result property="htDj" column="ht_dj"/>
|
|
|
|
|
|
<result property="sapNo" column="sap_no"/>
|
|
|
|
|
|
<result property="xh" column="xh"/>
|
|
|
|
|
|
<result property="jhQty" column="jh_qty"/>
|
|
|
|
|
|
<result property="htQty" column="ht_qty"/>
|
|
|
|
|
|
<result property="dw" column="dw"/>
|
|
|
|
|
|
<result property="realQty" column="real_qty"/>
|
|
|
|
|
|
<result property="pcode" column="pcode"/>
|
|
|
|
|
|
<result property="pcodeId" column="pcode_id"/>
|
|
|
|
|
|
<result property="trayCode" column="tray_code"/>
|
|
|
|
|
|
<result property="entityId" column="entity_id"/>
|
|
|
|
|
|
<result property="ckLihuoY" column="ck_lihuo_y"/>
|
|
|
|
|
|
<result property="teamCode" column="team_code"/>
|
|
|
|
|
|
<result property="ckType" column="ck_type"/>
|
|
|
|
|
|
<result property="ckRemark" column="ck_remark"/>
|
|
|
|
|
|
<result property="lyTime" column="ly_time"/>
|
|
|
|
|
|
<result property="billNoCk" column="bill_no_ck"/>
|
|
|
|
|
|
<result property="borrowTime" column="borrow_time"/>
|
|
|
|
|
|
<result property="returnTime" column="return_time"/>
|
|
|
|
|
|
<result property="hasMoved" column="has_moved"/>
|
|
|
|
|
|
<result property="isBorrowed" column="is_borrowed"/>
|
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
|
<result property="isDelete" column="is_delete"/>
|
|
|
|
|
|
<result property="gysJhId" column="gys_jh_id"/>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 新增:来自 mtd 的两列 -->
|
|
|
|
|
|
<result property="weightKg" column="weight_kg"/>
|
|
|
|
|
|
<result property="volumeM3" column="volume_m3"/>
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
2025-11-21 10:53:04 +08:00
|
|
|
|
<!-- 统一的字段清单(带 ri. 别名) -->
|
|
|
|
|
|
<sql id="rkInfoColumns">
|
|
|
|
|
|
ri.id, ri.rk_type, ri.wl_type, ri.cangku, ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.status, ri.remark,
|
|
|
|
|
|
ri.bill_no, ri.is_delivery, ri.xj, ri.xm_no, ri.xm_ms, ri.xm_no_ck, ri.xm_ms_ck, ri.wl_no, ri.wl_ms,
|
|
|
|
|
|
ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh, ri.jh_qty, ri.ht_qty, ri.dw, ri.real_qty,
|
|
|
|
|
|
ri.pcode, ri.pcode_id, ri.tray_code, ri.entity_id, ri.ck_lihuo_y, ri.team_code, ri.ck_type, ri.ck_remark,
|
|
|
|
|
|
ri.ly_time, ri.bill_no_ck, ri.borrow_time, ri.return_time, ri.has_moved, ri.is_borrowed,
|
|
|
|
|
|
ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete, ri.gys_jh_id
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 统一的 FROM + JOIN 片段 -->
|
|
|
|
|
|
<sql id="rkInfoFromJoinMtd">
|
|
|
|
|
|
FROM rk_info ri
|
|
|
|
|
|
LEFT JOIN delivery_mtd m
|
|
|
|
|
|
ON m.wl_no = ri.wl_no
|
|
|
|
|
|
AND (m.is_delete = '0' OR m.is_delete = 0 OR m.is_delete IS NULL)
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</sql>
|
|
|
|
|
|
|
2025-11-21 10:53:04 +08:00
|
|
|
|
<!-- 列表查询(分页场景) -->
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<select id="selectRkInfoList" parameterType="RkInfo" resultMap="RkInfoResult">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
SELECT
|
|
|
|
|
|
<include refid="rkInfoColumns"/>,
|
|
|
|
|
|
m.weight_kg,
|
|
|
|
|
|
m.volume_m3
|
|
|
|
|
|
<include refid="rkInfoFromJoinMtd"/>
|
|
|
|
|
|
<where>
|
|
|
|
|
|
(ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL)
|
|
|
|
|
|
<if test="rkType != null and rkType != ''"> and ri.rk_type = #{rkType}</if>
|
|
|
|
|
|
<if test="wlType != null and wlType != ''"> and ri.wl_type = #{wlType}</if>
|
|
|
|
|
|
<if test="cangku != null and cangku != ''"> and ri.cangku = #{cangku}</if>
|
|
|
|
|
|
<if test="rkTime != null "> and ri.rk_time = #{rkTime}</if>
|
|
|
|
|
|
<if test="lihuoY != null and lihuoY != ''"> and ri.lihuo_y = #{lihuoY}</if>
|
|
|
|
|
|
<if test="isChuku != null and isChuku != ''"> and ri.is_chuku = #{isChuku}</if>
|
|
|
|
|
|
<if test="status != null and status != ''"> and ri.status = #{status}</if>
|
|
|
|
|
|
<if test="billNo != null and billNo != ''"> and ri.bill_no = #{billNo}</if>
|
|
|
|
|
|
<if test="isDelivery != null and isDelivery != ''"> and ri.is_delivery = #{isDelivery}</if>
|
|
|
|
|
|
<if test="xj != null and xj != ''"> and ri.xj = #{xj}</if>
|
|
|
|
|
|
<if test="xmNo != null and xmNo != ''"> and ri.xm_no = #{xmNo}</if>
|
|
|
|
|
|
<if test="xmMs != null and xmMs != ''"> and ri.xm_ms = #{xmMs}</if>
|
|
|
|
|
|
<if test="xmNoCk != null and xmNoCk != ''"> and ri.xm_no_ck = #{xmNoCk}</if>
|
|
|
|
|
|
<if test="xmMsCk != null and xmMsCk != ''"> and ri.xm_ms_ck = #{xmMsCk}</if>
|
|
|
|
|
|
<if test="wlNo != null and wlNo != ''"> and ri.wl_no = #{wlNo}</if>
|
|
|
|
|
|
<if test="wlMs != null and wlMs != ''"> and ri.wl_ms = #{wlMs}</if>
|
|
|
|
|
|
<if test="gysNo != null and gysNo != ''"> and ri.gys_no = #{gysNo}</if>
|
|
|
|
|
|
<if test="gysMc != null and gysMc != ''"> and ri.gys_mc = #{gysMc}</if>
|
|
|
|
|
|
<if test="jhAmt != null "> and ri.jh_amt = #{jhAmt}</if>
|
|
|
|
|
|
<if test="htDj != null "> and ri.ht_dj = #{htDj}</if>
|
|
|
|
|
|
<if test="sapNo != null and sapNo != ''"> and ri.sap_no = #{sapNo}</if>
|
|
|
|
|
|
<if test="xh != null and xh != ''"> and ri.xh = #{xh}</if>
|
|
|
|
|
|
<if test="jhQty != null "> and ri.jh_qty = #{jhQty}</if>
|
|
|
|
|
|
<if test="htQty != null "> and ri.ht_qty = #{htQty}</if>
|
|
|
|
|
|
<if test="dw != null and dw != ''"> and ri.dw = #{dw}</if>
|
|
|
|
|
|
<if test="realQty != null "> and ri.real_qty = #{realQty}</if>
|
|
|
|
|
|
<if test="pcode != null and pcode != ''"> and ri.pcode = #{pcode}</if>
|
|
|
|
|
|
<if test="pcodeId != null and pcodeId != ''"> and ri.pcode_id = #{pcodeId}</if>
|
|
|
|
|
|
<if test="trayCode != null and trayCode != ''"> and ri.tray_code = #{trayCode}</if>
|
|
|
|
|
|
<if test="entityId != null and entityId != ''"> and ri.entity_id = #{entityId}</if>
|
|
|
|
|
|
<if test="ckLihuoY != null and ckLihuoY != ''"> and ri.ck_lihuo_y = #{ckLihuoY}</if>
|
|
|
|
|
|
<if test="teamCode != null and teamCode != ''"> and ri.team_code = #{teamCode}</if>
|
|
|
|
|
|
<if test="ckType != null and ckType != ''"> and ri.ck_type = #{ckType}</if>
|
|
|
|
|
|
<if test="ckRemark != null and ckRemark != ''"> and ri.ck_remark = #{ckRemark}</if>
|
|
|
|
|
|
<if test="lyTime != null "> and ri.ly_time = #{lyTime}</if>
|
|
|
|
|
|
<if test="billNoCk != null and billNoCk != ''"> and ri.bill_no_ck = #{billNoCk}</if>
|
|
|
|
|
|
<if test="borrowTime != null "> and ri.borrow_time = #{borrowTime}</if>
|
|
|
|
|
|
<if test="returnTime != null "> and ri.return_time = #{returnTime}</if>
|
|
|
|
|
|
<if test="hasMoved != null and hasMoved != ''"> and ri.has_moved = #{hasMoved}</if>
|
|
|
|
|
|
<if test="isBorrowed != null and isBorrowed != ''"> and ri.is_borrowed = #{isBorrowed}</if>
|
|
|
|
|
|
<if test="isDelete != null and isDelete != ''"> and ri.is_delete = #{isDelete}</if>
|
|
|
|
|
|
<if test="gysJhId != null "> and ri.gys_jh_id = #{gysJhId}</if>
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</where>
|
|
|
|
|
|
</select>
|
2025-11-21 10:53:04 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 按 ID 查询 -->
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
SELECT
|
|
|
|
|
|
<include refid="rkInfoColumns"/>,
|
|
|
|
|
|
m.weight_kg,
|
|
|
|
|
|
m.volume_m3
|
|
|
|
|
|
<include refid="rkInfoFromJoinMtd"/>
|
|
|
|
|
|
WHERE ri.id = #{id}
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-11-21 10:53:04 +08:00
|
|
|
|
<!-- 按单据分组(bill_no)列表:复用同一个 SELECT 作为子查询,再做聚合 -->
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<select id="selectGroupedByBill" resultMap="RkInfoResult">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
a.id,
|
|
|
|
|
|
a.bill_no,
|
|
|
|
|
|
a.bill_no_ck,
|
|
|
|
|
|
a.rk_type,
|
|
|
|
|
|
si.type_name AS rk_type_name,
|
|
|
|
|
|
a.wl_type,
|
|
|
|
|
|
a.cangku,
|
|
|
|
|
|
a.rk_time,
|
|
|
|
|
|
a.lihuo_y,
|
|
|
|
|
|
a.is_chuku,
|
|
|
|
|
|
a.xj,
|
|
|
|
|
|
a.xm_no,
|
|
|
|
|
|
a.xm_ms,
|
|
|
|
|
|
a.xm_no_ck,
|
|
|
|
|
|
a.xm_ms_ck,
|
|
|
|
|
|
a.gys_mc,
|
|
|
|
|
|
a.wl_no,
|
|
|
|
|
|
a.wl_ms,
|
|
|
|
|
|
a.gys_no,
|
|
|
|
|
|
a.sap_no,
|
|
|
|
|
|
a.ck_type,
|
|
|
|
|
|
so.type_name AS ck_type_name,
|
|
|
|
|
|
a.ly_time,
|
|
|
|
|
|
a.ck_lihuo_y,
|
|
|
|
|
|
u.user_name AS ck_lihuo_y_name
|
|
|
|
|
|
FROM (
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
MIN(t.id) AS id,
|
|
|
|
|
|
t.bill_no AS bill_no,
|
|
|
|
|
|
MIN(t.bill_no_ck) AS bill_no_ck,
|
|
|
|
|
|
MIN(t.rk_type) AS rk_type,
|
|
|
|
|
|
MIN(t.wl_type) AS wl_type,
|
|
|
|
|
|
MIN(t.cangku) AS cangku,
|
|
|
|
|
|
MIN(t.rk_time) AS rk_time,
|
|
|
|
|
|
MIN(t.lihuo_y) AS lihuo_y,
|
|
|
|
|
|
MAX(t.is_chuku) AS is_chuku,
|
|
|
|
|
|
MIN(t.xj) AS xj,
|
|
|
|
|
|
MIN(t.xm_no) AS xm_no,
|
|
|
|
|
|
MIN(t.xm_ms) AS xm_ms,
|
|
|
|
|
|
MIN(t.xm_no_ck) AS xm_no_ck,
|
|
|
|
|
|
MIN(t.xm_ms_ck) AS xm_ms_ck,
|
|
|
|
|
|
MIN(t.gys_mc) AS gys_mc,
|
|
|
|
|
|
MIN(t.wl_no) AS wl_no,
|
|
|
|
|
|
MIN(t.wl_ms) AS wl_ms,
|
|
|
|
|
|
MIN(t.gys_no) AS gys_no,
|
|
|
|
|
|
MIN(t.sap_no) AS sap_no,
|
|
|
|
|
|
MIN(t.ck_type) AS ck_type,
|
|
|
|
|
|
MAX(t.ly_time) AS ly_time,
|
|
|
|
|
|
MIN(t.ck_lihuo_y) AS ck_lihuo_y
|
|
|
|
|
|
FROM (
|
2025-11-21 10:53:04 +08:00
|
|
|
|
SELECT
|
|
|
|
|
|
<include refid="rkInfoColumns"/>,
|
|
|
|
|
|
m.weight_kg,
|
|
|
|
|
|
m.volume_m3
|
|
|
|
|
|
<include refid="rkInfoFromJoinMtd"/>
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<where>
|
2025-11-21 10:53:04 +08:00
|
|
|
|
(ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL)
|
|
|
|
|
|
<!-- 这里参数名按你的 Service 传入保持:假设是 q -->
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<if test="q.isChuku != null and q.isChuku != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.is_chuku = #{q.isChuku}
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.rkType != null and q.rkType != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.rk_type LIKE concat('%', #{q.rkType}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.wlType != null and q.wlType != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.wl_type LIKE concat('%', #{q.wlType}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.cangku != null and q.cangku != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.cangku LIKE concat('%', #{q.cangku}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.lihuoY != null and q.lihuoY != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.lihuo_y LIKE concat('%', #{q.lihuoY}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.xj != null and q.xj != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.xj LIKE concat('%', #{q.xj}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.billNo != null and q.billNo != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.bill_no LIKE concat('%', #{q.billNo}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.billNoCk != null and q.billNoCk != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.bill_no_ck LIKE concat('%', #{q.billNoCk}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.xmNo != null and q.xmNo != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.xm_no LIKE concat('%', #{q.xmNo}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.xmMs != null and q.xmMs != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.xm_ms LIKE concat('%', #{q.xmMs}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.wlNo != null and q.wlNo != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.wl_no LIKE concat('%', #{q.wlNo}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.wlMs != null and q.wlMs != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.wl_ms LIKE concat('%', #{q.wlMs}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.gysNo != null and q.gysNo != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.gys_no LIKE concat('%', #{q.gysNo}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.gysMc != null and q.gysMc != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.gys_mc LIKE concat('%', #{q.gysMc}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
2025-11-21 10:53:04 +08:00
|
|
|
|
<if test="q.jhAmt != null"> and ri.jh_amt = #{q.jhAmt} </if>
|
|
|
|
|
|
<if test="q.htDj != null"> and ri.ht_dj = #{q.htDj} </if>
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<if test="q.sapNo != null and q.sapNo != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.sap_no LIKE concat('%', #{q.sapNo}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.xh != null and q.xh != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.xh LIKE concat('%', #{q.xh}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
2025-11-21 10:53:04 +08:00
|
|
|
|
<if test="q.jhQty != null"> and ri.jh_qty = #{q.jhQty} </if>
|
|
|
|
|
|
<if test="q.htQty != null"> and ri.ht_qty = #{q.htQty} </if>
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<if test="q.dw != null and q.dw != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.dw LIKE concat('%', #{q.dw}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
2025-11-21 10:53:04 +08:00
|
|
|
|
<if test="q.realQty != null"> and ri.real_qty = #{q.realQty} </if>
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<if test="q.pcode != null and q.pcode != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.pcode LIKE concat('%', #{q.pcode}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
2025-11-21 10:53:04 +08:00
|
|
|
|
<if test="q.lyTime != null"> and ri.ly_time = #{q.lyTime} </if>
|
|
|
|
|
|
<if test="q.returnTime != null"> and ri.return_time = #{q.returnTime} </if>
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<if test="q.trayCode != null and q.trayCode != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.tray_code LIKE concat('%', #{q.trayCode}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.entityId != null and q.entityId != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.entity_id LIKE concat('%', #{q.entityId}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.ckType != null and q.ckType != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.ck_type LIKE concat('%', #{q.ckType}, '%')
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
<when test="q.isDelete != null and q.isDelete != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.is_delete = #{q.isDelete}
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</when>
|
|
|
|
|
|
<otherwise>
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and (ri.is_delete = '0' OR ri.is_delete = 0 OR ri.is_delete IS NULL)
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</otherwise>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
<if test="q.isDelivery != null and q.isDelivery != ''">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
and ri.is_delivery = #{q.isDelivery}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="q.isChuku != null and q.isChuku == '1'">
|
|
|
|
|
|
and ri.bill_no_ck IS NOT NULL
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
2025-11-21 10:53:04 +08:00
|
|
|
|
) t
|
2025-10-16 10:30:21 +08:00
|
|
|
|
GROUP BY t.bill_no
|
|
|
|
|
|
) a
|
|
|
|
|
|
LEFT JOIN stock_in_type si ON a.rk_type = si.type_code
|
|
|
|
|
|
LEFT JOIN stock_out_type so ON a.ck_type = so.type_code
|
|
|
|
|
|
LEFT JOIN sys_user u ON a.ck_lihuo_y = u.user_id
|
|
|
|
|
|
ORDER BY a.rk_time DESC
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-11-21 10:53:04 +08:00
|
|
|
|
<!-- 插入 -->
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<insert id="insertRkInfo" parameterType="RkInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
|
insert into rk_info
|
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
|
<if test="rkType != null">rk_type,</if>
|
|
|
|
|
|
<if test="wlType != null">wl_type,</if>
|
|
|
|
|
|
<if test="cangku != null">cangku,</if>
|
|
|
|
|
|
<if test="rkTime != null">rk_time,</if>
|
|
|
|
|
|
<if test="lihuoY != null">lihuo_y,</if>
|
|
|
|
|
|
<if test="isChuku != null">is_chuku,</if>
|
|
|
|
|
|
<if test="status != null">status,</if>
|
|
|
|
|
|
<if test="remark != null">remark,</if>
|
|
|
|
|
|
<if test="billNo != null">bill_no,</if>
|
|
|
|
|
|
<if test="isDelivery != null">is_delivery,</if>
|
|
|
|
|
|
<if test="xj != null">xj,</if>
|
|
|
|
|
|
<if test="xmNo != null">xm_no,</if>
|
|
|
|
|
|
<if test="xmMs != null">xm_ms,</if>
|
|
|
|
|
|
<if test="xmNoCk != null">xm_no_ck,</if>
|
|
|
|
|
|
<if test="xmMsCk != null">xm_ms_ck,</if>
|
|
|
|
|
|
<if test="wlNo != null">wl_no,</if>
|
|
|
|
|
|
<if test="wlMs != null">wl_ms,</if>
|
|
|
|
|
|
<if test="gysNo != null">gys_no,</if>
|
|
|
|
|
|
<if test="gysMc != null">gys_mc,</if>
|
|
|
|
|
|
<if test="jhAmt != null">jh_amt,</if>
|
|
|
|
|
|
<if test="htDj != null">ht_dj,</if>
|
|
|
|
|
|
<if test="sapNo != null">sap_no,</if>
|
|
|
|
|
|
<if test="xh != null">xh,</if>
|
|
|
|
|
|
<if test="jhQty != null">jh_qty,</if>
|
|
|
|
|
|
<if test="htQty != null">ht_qty,</if>
|
|
|
|
|
|
<if test="dw != null">dw,</if>
|
|
|
|
|
|
<if test="realQty != null">real_qty,</if>
|
|
|
|
|
|
<if test="pcode != null">pcode,</if>
|
|
|
|
|
|
<if test="pcodeId != null">pcode_id,</if>
|
|
|
|
|
|
<if test="trayCode != null">tray_code,</if>
|
|
|
|
|
|
<if test="entityId != null">entity_id,</if>
|
|
|
|
|
|
<if test="ckLihuoY != null">ck_lihuo_y,</if>
|
|
|
|
|
|
<if test="teamCode != null">team_code,</if>
|
|
|
|
|
|
<if test="ckType != null">ck_type,</if>
|
|
|
|
|
|
<if test="ckRemark != null">ck_remark,</if>
|
|
|
|
|
|
<if test="lyTime != null">ly_time,</if>
|
|
|
|
|
|
<if test="billNoCk != null">bill_no_ck,</if>
|
|
|
|
|
|
<if test="borrowTime != null">borrow_time,</if>
|
|
|
|
|
|
<if test="returnTime != null">return_time,</if>
|
|
|
|
|
|
<if test="hasMoved != null">has_moved,</if>
|
|
|
|
|
|
<if test="isBorrowed != null">is_borrowed,</if>
|
|
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
|
<if test="isDelete != null">is_delete,</if>
|
|
|
|
|
|
<if test="gysJhId != null">gys_jh_id,</if>
|
2025-11-21 10:53:04 +08:00
|
|
|
|
</trim>
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
|
<if test="rkType != null">#{rkType},</if>
|
|
|
|
|
|
<if test="wlType != null">#{wlType},</if>
|
|
|
|
|
|
<if test="cangku != null">#{cangku},</if>
|
|
|
|
|
|
<if test="rkTime != null">#{rkTime},</if>
|
|
|
|
|
|
<if test="lihuoY != null">#{lihuoY},</if>
|
|
|
|
|
|
<if test="isChuku != null">#{isChuku},</if>
|
|
|
|
|
|
<if test="status != null">#{status},</if>
|
|
|
|
|
|
<if test="remark != null">#{remark},</if>
|
|
|
|
|
|
<if test="billNo != null">#{billNo},</if>
|
|
|
|
|
|
<if test="isDelivery != null">#{isDelivery},</if>
|
|
|
|
|
|
<if test="xj != null">#{xj},</if>
|
|
|
|
|
|
<if test="xmNo != null">#{xmNo},</if>
|
|
|
|
|
|
<if test="xmMs != null">#{xmMs},</if>
|
|
|
|
|
|
<if test="xmNoCk != null">#{xmNoCk},</if>
|
|
|
|
|
|
<if test="xmMsCk != null">#{xmMsCk},</if>
|
|
|
|
|
|
<if test="wlNo != null">#{wlNo},</if>
|
|
|
|
|
|
<if test="wlMs != null">#{wlMs},</if>
|
|
|
|
|
|
<if test="gysNo != null">#{gysNo},</if>
|
|
|
|
|
|
<if test="gysMc != null">#{gysMc},</if>
|
|
|
|
|
|
<if test="jhAmt != null">#{jhAmt},</if>
|
|
|
|
|
|
<if test="htDj != null">#{htDj},</if>
|
|
|
|
|
|
<if test="sapNo != null">#{sapNo},</if>
|
|
|
|
|
|
<if test="xh != null">#{xh},</if>
|
|
|
|
|
|
<if test="jhQty != null">#{jhQty},</if>
|
|
|
|
|
|
<if test="htQty != null">#{htQty},</if>
|
|
|
|
|
|
<if test="dw != null">#{dw},</if>
|
|
|
|
|
|
<if test="realQty != null">#{realQty},</if>
|
|
|
|
|
|
<if test="pcode != null">#{pcode},</if>
|
|
|
|
|
|
<if test="pcodeId != null">#{pcodeId},</if>
|
|
|
|
|
|
<if test="trayCode != null">#{trayCode},</if>
|
|
|
|
|
|
<if test="entityId != null">#{entityId},</if>
|
|
|
|
|
|
<if test="ckLihuoY != null">#{ckLihuoY},</if>
|
|
|
|
|
|
<if test="teamCode != null">#{teamCode},</if>
|
|
|
|
|
|
<if test="ckType != null">#{ckType},</if>
|
|
|
|
|
|
<if test="ckRemark != null">#{ckRemark},</if>
|
|
|
|
|
|
<if test="lyTime != null">#{lyTime},</if>
|
|
|
|
|
|
<if test="billNoCk != null">#{billNoCk},</if>
|
|
|
|
|
|
<if test="borrowTime != null">#{borrowTime},</if>
|
|
|
|
|
|
<if test="returnTime != null">#{returnTime},</if>
|
|
|
|
|
|
<if test="hasMoved != null">#{hasMoved},</if>
|
|
|
|
|
|
<if test="isBorrowed != null">#{isBorrowed},</if>
|
|
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
|
<if test="isDelete != null">#{isDelete},</if>
|
|
|
|
|
|
<if test="gysJhId != null">#{gysJhId},</if>
|
2025-11-21 10:53:04 +08:00
|
|
|
|
</trim>
|
2025-10-16 10:30:21 +08:00
|
|
|
|
</insert>
|
|
|
|
|
|
|
2025-11-21 10:53:04 +08:00
|
|
|
|
<!-- 更新:照旧,不涉及 mtd -->
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<update id="updateRkInfo" parameterType="RkInfo">
|
|
|
|
|
|
update rk_info
|
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
|
<if test="rkType != null">rk_type = #{rkType},</if>
|
|
|
|
|
|
<if test="wlType != null">wl_type = #{wlType},</if>
|
|
|
|
|
|
<if test="cangku != null">cangku = #{cangku},</if>
|
|
|
|
|
|
<if test="rkTime != null">rk_time = #{rkTime},</if>
|
|
|
|
|
|
<if test="lihuoY != null">lihuo_y = #{lihuoY},</if>
|
|
|
|
|
|
<if test="isChuku != null">is_chuku = #{isChuku},</if>
|
|
|
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
|
|
|
<if test="billNo != null">bill_no = #{billNo},</if>
|
|
|
|
|
|
<if test="isDelivery != null">is_delivery = #{isDelivery},</if>
|
|
|
|
|
|
<if test="xj != null">xj = #{xj},</if>
|
|
|
|
|
|
<if test="xmNo != null">xm_no = #{xmNo},</if>
|
|
|
|
|
|
<if test="xmMs != null">xm_ms = #{xmMs},</if>
|
|
|
|
|
|
<if test="xmNoCk != null">xm_no_ck = #{xmNoCk},</if>
|
|
|
|
|
|
<if test="xmMsCk != null">xm_ms_ck = #{xmMsCk},</if>
|
|
|
|
|
|
<if test="wlNo != null">wl_no = #{wlNo},</if>
|
|
|
|
|
|
<if test="wlMs != null">wl_ms = #{wlMs},</if>
|
|
|
|
|
|
<if test="gysNo != null">gys_no = #{gysNo},</if>
|
|
|
|
|
|
<if test="gysMc != null">gys_mc = #{gysMc},</if>
|
|
|
|
|
|
<if test="jhAmt != null">jh_amt = #{jhAmt},</if>
|
|
|
|
|
|
<if test="htDj != null">ht_dj = #{htDj},</if>
|
|
|
|
|
|
<if test="sapNo != null">sap_no = #{sapNo},</if>
|
|
|
|
|
|
<if test="xh != null">xh = #{xh},</if>
|
|
|
|
|
|
<if test="jhQty != null">jh_qty = #{jhQty},</if>
|
|
|
|
|
|
<if test="htQty != null">ht_qty = #{htQty},</if>
|
|
|
|
|
|
<if test="dw != null">dw = #{dw},</if>
|
|
|
|
|
|
<if test="realQty != null">real_qty = #{realQty},</if>
|
|
|
|
|
|
<if test="pcode != null">pcode = #{pcode},</if>
|
|
|
|
|
|
<if test="pcodeId != null">pcode_id = #{pcodeId},</if>
|
|
|
|
|
|
<if test="trayCode != null">tray_code = #{trayCode},</if>
|
|
|
|
|
|
<if test="entityId != null">entity_id = #{entityId},</if>
|
|
|
|
|
|
<if test="ckLihuoY != null">ck_lihuo_y = #{ckLihuoY},</if>
|
|
|
|
|
|
<if test="teamCode != null">team_code = #{teamCode},</if>
|
|
|
|
|
|
<if test="ckType != null">ck_type = #{ckType},</if>
|
|
|
|
|
|
<if test="ckRemark != null">ck_remark = #{ckRemark},</if>
|
|
|
|
|
|
<if test="lyTime != null">ly_time = #{lyTime},</if>
|
|
|
|
|
|
<if test="billNoCk != null">bill_no_ck = #{billNoCk},</if>
|
|
|
|
|
|
<if test="borrowTime != null">borrow_time = #{borrowTime},</if>
|
2025-11-21 10:53:04 +08:00
|
|
|
|
<if test="returnTime != null">return_time = #{ReturnTime},</if>
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<if test="hasMoved != null">has_moved = #{hasMoved},</if>
|
|
|
|
|
|
<if test="isBorrowed != null">is_borrowed = #{isBorrowed},</if>
|
|
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
|
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
|
|
|
|
|
<if test="gysJhId != null">gys_jh_id = #{gysJhId},</if>
|
|
|
|
|
|
</trim>
|
|
|
|
|
|
where id = #{id}
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
<delete id="deleteRkInfoById" parameterType="Long">
|
|
|
|
|
|
delete from rk_info where id = #{id}
|
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
|
|
<delete id="deleteRkInfoByIds" parameterType="String">
|
2025-11-21 10:53:04 +08:00
|
|
|
|
delete from rk_info
|
|
|
|
|
|
where id in
|
2025-10-16 10:30:21 +08:00
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
|
#{id}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</delete>
|
2025-11-21 10:53:04 +08:00
|
|
|
|
</mapper>
|