Files
smart_management_dev/src/main/resources/mybatis/wisdom/RkInfoMapper.xml

225 lines
8.9 KiB
XML
Raw Normal View History

2025-05-30 16:13:27 +08:00
<?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">
2025-05-30 16:13:27 +08:00
<mapper namespace="com.zg.project.wisdom.mapper.RkInfoMapper">
2025-07-10 08:40:36 +08:00
<!-- ========================= resultMap ========================= -->
2025-05-30 16:13:27 +08:00
<resultMap type="RkInfo" id="RkInfoResult">
<result property="id" column="id"/>
<result property="operationType" column="operation_type"/>
<result property="bizType" column="biz_type"/>
<result property="wlType" column="wl_type"/>
<result property="cangku" column="cangku"/>
<result property="operationTime" column="operation_time"/>
<result property="operator" column="operator"/>
<result property="isChuku" column="is_chuku"/>
<result property="status" column="status"/>
<result property="execStatus" column="exec_status"/>
<result property="remark" column="remark"/>
<result property="billNo" column="bill_no"/>
<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="teamCode" column="team_code"/>
<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"/>
<result property="rdid" column="rdid"/>
<result property="rdidCk" column="rdid_ck"/>
<result property="sid" column="sid"/>
<result property="isDelivery" column="is_delivery"/>
<result property="fycde1" column="fycde_1"/>
<result property="fycde2" column="fycde_2"/>
<result property="isUpdate" column="is_update"/>
2025-05-30 16:13:27 +08:00
</resultMap>
<!-- ========================= 公共查询字段 ========================= -->
2025-05-30 16:13:27 +08:00
<sql id="selectRkInfoVo">
select
id,
operation_type,
biz_type,
wl_type,
cangku,
operation_time,
operator,
is_chuku,
status,
exec_status,
remark,
bill_no,
xj,
xm_no,
xm_ms,
xm_no_ck,
xm_ms_ck,
wl_no,
wl_ms,
gys_no,
gys_mc,
jh_amt,
ht_dj,
sap_no,
xh,
jh_qty,
ht_qty,
dw,
real_qty,
pcode,
pcode_id,
tray_code,
entity_id,
team_code,
borrow_time,
return_time,
has_moved,
is_borrowed,
create_by,
create_time,
update_by,
update_time,
is_delete,
gys_jh_id,
rdid,
rdid_ck,
sid,
is_delivery,
fycde_1,
fycde_2,
is_update,
/* 新增库龄计算 */
DATEDIFF(CURRENT_DATE, operation_time) AS stock_age -- 库龄(天)
from rk_info
2025-05-30 16:13:27 +08:00
</sql>
<!-- ========================= 删除 ========================= -->
<delete id="deleteRkInfoById" parameterType="Long">
delete from rk_info where id = #{id}
</delete>
2025-05-30 16:13:27 +08:00
<delete id="deleteRkInfoByIds" parameterType="java.util.List">
delete from rk_info
where id in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
2025-05-30 16:13:27 +08:00
</foreach>
2025-07-21 11:17:44 +08:00
</delete>
2025-06-17 08:39:05 +08:00
<!-- 查询列表:根据库龄进行过滤 -->
2025-05-30 16:13:27 +08:00
<select id="selectRkInfoList" parameterType="RkInfo" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
<where>
<if test="operationType != null and operationType != ''">
and operation_type = #{operationType}
2025-06-05 09:05:08 +08:00
</if>
<if test="bizType != null and bizType != ''">
and biz_type = #{bizType}
2025-07-25 17:04:11 +08:00
</if>
<if test="wlType != null and wlType != ''">
and wl_type = #{wlType}
2025-07-25 17:04:11 +08:00
</if>
<if test="cangku != null and cangku != ''">
and cangku = #{cangku}
</if>
<if test="execStatus != null and execStatus != ''">
and exec_status = #{execStatus}
2025-07-25 17:04:11 +08:00
</if>
<if test="billNo != null and billNo != ''">
and bill_no = #{billNo}
2025-07-25 17:04:11 +08:00
</if>
<if test="isDelete != null and isDelete != ''">
and is_delete = #{isDelete}
2025-07-25 17:04:11 +08:00
</if>
2025-05-30 16:13:27 +08:00
</where>
</select>
2025-06-04 11:34:07 +08:00
<!-- ========================= 按 ID 查询 ========================= -->
2025-05-30 16:13:27 +08:00
<select id="selectRkInfoById" parameterType="Long" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/>
where id = #{id}
2025-07-10 08:40:36 +08:00
</select>
2025-12-12 14:52:48 +08:00
<!-- 插入 rk_info -->
<insert id="insertRkInfo" parameterType="RkInfo" useGeneratedKeys="true" keyProperty="id">
insert into rk_info (
operation_type, biz_type, wl_type, cangku, operation_time, operator,
is_chuku, status, exec_status, remark, bill_no,
xj, xm_no, xm_ms, xm_no_ck, xm_ms_ck,
wl_no, wl_ms,
gys_no, gys_mc,
jh_amt, ht_dj, sap_no, xh,
jh_qty, ht_qty, dw, real_qty,
pcode, pcode_id, tray_code, entity_id,
team_code, borrow_time, return_time,
has_moved, is_borrowed,
gys_jh_id,
rdid, rdid_ck, sid,
is_delivery,
fycde_1, fycde_2,
is_update,
create_by, create_time, is_delete
2025-07-21 11:17:44 +08:00
)
values (
#{operationType}, #{bizType}, #{wlType}, #{cangku}, #{operationTime}, #{operator},
#{isChuku}, #{status}, #{execStatus}, #{remark}, #{billNo},
#{xj}, #{xmNo}, #{xmMs}, #{xmNoCk}, #{xmMsCk},
#{wlNo}, #{wlMs},
#{gysNo}, #{gysMc},
#{jhAmt}, #{htDj}, #{sapNo}, #{xh},
#{jhQty}, #{htQty}, #{dw}, #{realQty},
#{pcode}, #{pcodeId}, #{trayCode}, #{entityId},
#{teamCode}, #{borrowTime}, #{returnTime},
#{hasMoved}, #{isBorrowed},
#{gysJhId},
#{rdid}, #{rdidCk}, #{sid},
#{isDelivery},
#{fycde1}, #{fycde2},
#{isUpdate},
#{createBy}, #{createTime}, #{isDelete}
)
</insert>
<!-- 更新 rk_info -->
2025-05-30 16:13:27 +08:00
<update id="updateRkInfo" parameterType="RkInfo">
update rk_info
2026-01-06 14:19:58 +08:00
<trim prefix="SET" suffixOverrides=",">
<if test="operationType != null">operation_type = #{operationType},</if>
<if test="bizType != null">biz_type = #{bizType},</if>
2026-01-06 14:19:58 +08:00
<if test="wlType != null">wl_type = #{wlType},</if>
<if test="cangku != null">cangku = #{cangku},</if>
<if test="status != null">status = #{status},</if>
<if test="execStatus != null">exec_status = #{execStatus},</if>
2026-01-06 14:19:58 +08:00
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
2025-05-30 16:13:27 +08:00
where id = #{id}
</update>
</mapper>