项目重构,目前已完成入库操作,追加入库等
This commit is contained in:
@@ -7,7 +7,8 @@ spring:
|
||||
# 主库数据源
|
||||
master:
|
||||
# url: jdbc:mysql://47.100.212.83:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://192.168.1.28:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://192.168.1.28:3306/wisdomnew?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://192.168.1.28:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://192.168.1.192:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://localhost:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
|
||||
@@ -1,161 +1,223 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zg.project.wisdom.mapper.RkBillMapper">
|
||||
|
||||
<!-- 新增单据主表 -->
|
||||
<insert id="insertRkBill" parameterType="com.zg.project.wisdom.domain.RkBill">
|
||||
INSERT INTO rk_bill (
|
||||
rk_type, wl_type, cangku, rk_time, lihuo_y,
|
||||
ck_type, ck_time, ck_lihuo_y, ck_remark, team_code,
|
||||
bill_no, is_chuku, is_delete,
|
||||
created_by, created_at,
|
||||
updated_by, updated_at
|
||||
) VALUES (
|
||||
#{rkType}, #{wlType}, #{cangku}, #{rkTime}, #{lihuoY},
|
||||
#{ckType}, #{ckTime}, #{ckLihuoY}, #{ckRemark}, #{teamCode},
|
||||
#{billNo}, #{isChuku}, #{isDelete},
|
||||
#{createBy}, #{createTime},
|
||||
#{updateBy}, #{updateTime}
|
||||
)
|
||||
</insert>
|
||||
<!-- ==================== ResultMap ==================== -->
|
||||
<resultMap type="RkBill" id="RkBillResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="wlType" column="wl_type"/>
|
||||
<result property="wlTypeName" column="wl_type_name"/>
|
||||
|
||||
<!-- 查询列表(可用于分页或展示) -->
|
||||
<select id="selectRkBillList"
|
||||
parameterType="com.zg.project.wisdom.domain.RkBill"
|
||||
resultType="com.zg.project.wisdom.domain.RkBill">
|
||||
SELECT
|
||||
rb.id,
|
||||
rb.rk_type AS rkType,
|
||||
st.type_name AS rkTypeName,
|
||||
rb.wl_type AS wlType,
|
||||
mt.type_name AS wlTypeName,
|
||||
rb.cangku AS cangku,
|
||||
wh.warehouse_name AS cangkuName,
|
||||
rb.lihuo_y AS lihuoY,
|
||||
rb.rk_time AS rkTime,
|
||||
rb.bill_no AS billNo,
|
||||
rb.is_chuku AS isChuku,
|
||||
<result property="cangku" column="cangku"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
<result property="parentWarehouseName" column="parent_warehouse_name"/>
|
||||
|
||||
-- ✅ 出库相关字段(新增)
|
||||
rb.ck_type AS ckType,
|
||||
sot.ck_type_name AS ckTypeName,
|
||||
rb.ck_time AS ckTime,
|
||||
rb.ck_lihuo_y AS ckLihuoY,
|
||||
rb.ck_remark AS ckRemark,
|
||||
rb.team_code AS teamCode,
|
||||
ct.team_name AS teamName,
|
||||
<result property="billNo" column="bill_no"/>
|
||||
|
||||
rb.is_delete AS isDelete,
|
||||
rb.created_by AS createBy,
|
||||
rb.created_at AS createTime,
|
||||
rb.updated_by AS updateBy,
|
||||
rb.updated_at AS updateTime
|
||||
<result property="operationType" column="operation_type"/>
|
||||
<result property="operationTypeName" column="operation_type_name"/>
|
||||
|
||||
FROM rk_bill rb
|
||||
LEFT JOIN stock_in_type st ON rb.rk_type = st.type_code
|
||||
LEFT JOIN material_type mt ON rb.wl_type = mt.type_code
|
||||
LEFT JOIN warehouse_info wh ON rb.cangku = wh.warehouse_code
|
||||
LEFT JOIN stock_out_type sot ON rb.ck_type = sot.ck_type_code
|
||||
LEFT JOIN construction_team ct ON rb.team_code = ct.team_code
|
||||
WHERE rb.is_delete = '0'
|
||||
<if test="billNo != null and billNo != ''">
|
||||
AND rb.bill_no LIKE CONCAT('%', #{billNo}, '%')
|
||||
</if>
|
||||
ORDER BY rb.rk_time DESC
|
||||
</select>
|
||||
<result property="bizType" column="biz_type"/>
|
||||
<result property="operationTime" column="operation_time"/>
|
||||
<result property="execStatus" column="exec_status"/>
|
||||
|
||||
<result property="operator" column="operator"/>
|
||||
<result property="operatorName" column="operator_name"/>
|
||||
|
||||
<!-- 根据单据号查询单条 -->
|
||||
<select id="selectRkBillByBillNo" resultType="com.zg.project.wisdom.domain.RkBill">
|
||||
<result property="teamCode" column="team_code"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="isDelivery" column="is_delivery"/>
|
||||
<result property="isDelete" column="is_delete"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- ==================== Base Select ==================== -->
|
||||
<sql id="selectRkBillVo">
|
||||
SELECT
|
||||
rb.id,
|
||||
rb.rk_type, st.type_name AS rkTypeName,
|
||||
rb.wl_type, mt.type_name AS wlTypeName,
|
||||
rb.cangku, wh.warehouse_name AS cangkuName,
|
||||
rb.rk_time, rb.lihuo_y,
|
||||
rb.wl_type,
|
||||
rb.cangku,
|
||||
rb.bill_no,
|
||||
rb.operation_type,
|
||||
rb.biz_type,
|
||||
rb.operation_time,
|
||||
rb.exec_status,
|
||||
rb.operator,
|
||||
rb.team_code,
|
||||
rb.remark,
|
||||
rb.is_delivery,
|
||||
rb.is_delete,
|
||||
|
||||
rb.ck_type, sot.ck_type_name AS ckTypeName,
|
||||
rb.ck_time, rb.ck_lihuo_y,
|
||||
rb.ck_remark, rb.team_code, ct.team_name AS teamName,
|
||||
-- 物资类型
|
||||
mt.type_name AS wl_type_name,
|
||||
|
||||
rb.bill_no, rb.is_chuku, rb.is_delete,
|
||||
rb.created_by AS createBy, rb.created_at AS createTime,
|
||||
rb.updated_by AS updateBy, rb.updated_at AS updateTime,
|
||||
rb.remark
|
||||
-- 出 / 入库类型名称
|
||||
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
|
||||
|
||||
-- 操作人
|
||||
su.nick_name AS operator_name,
|
||||
|
||||
-- 小仓
|
||||
wh.warehouse_name AS warehouse_name,
|
||||
|
||||
-- 大仓(冗余字段)
|
||||
wh.parent_warehouse_name AS parent_warehouse_name
|
||||
|
||||
FROM rk_bill rb
|
||||
LEFT JOIN stock_in_type st ON rb.rk_type = st.type_code
|
||||
LEFT JOIN material_type mt ON rb.wl_type = mt.type_code
|
||||
LEFT JOIN warehouse_info wh ON rb.cangku = wh.warehouse_code
|
||||
LEFT JOIN stock_out_type sot ON rb.ck_type = sot.ck_type_code
|
||||
LEFT JOIN construction_team ct ON rb.team_code = ct.team_code
|
||||
|
||||
WHERE rb.bill_no = #{billNo} AND rb.is_delete = '0'
|
||||
-- 仓库(小仓)
|
||||
LEFT JOIN warehouse_info wh
|
||||
ON rb.cangku = wh.warehouse_code
|
||||
AND wh.status = 1
|
||||
|
||||
-- 物资类型
|
||||
LEFT JOIN material_type mt
|
||||
ON rb.wl_type = mt.type_code
|
||||
AND mt.status = 1
|
||||
|
||||
-- 入库类型
|
||||
LEFT JOIN stock_in_type sit
|
||||
ON rb.operation_type = sit.type_code
|
||||
AND sit.status = 1
|
||||
|
||||
-- 出库类型
|
||||
LEFT JOIN stock_out_type sot
|
||||
ON rb.operation_type = sot.type_code
|
||||
AND (sot.is_delete = '0' OR sot.is_delete IS NULL)
|
||||
|
||||
-- 操作人
|
||||
LEFT JOIN sys_user su
|
||||
ON rb.operator = su.user_id
|
||||
</sql>
|
||||
|
||||
<!-- ==================== List ==================== -->
|
||||
<select id="selectRkBillList" parameterType="RkBill" resultMap="RkBillResult">
|
||||
<include refid="selectRkBillVo"/>
|
||||
<where>
|
||||
<if test="wlType != null">AND rb.wl_type = #{wlType}</if>
|
||||
<if test="cangku != null and cangku != ''">AND rb.cangku = #{cangku}</if>
|
||||
<if test="billNo != null and billNo != ''">AND rb.bill_no = #{billNo}</if>
|
||||
<if test="operationType != null">AND rb.operation_type = #{operationType}</if>
|
||||
<if test="bizType != null">AND rb.biz_type = #{bizType}</if>
|
||||
<if test="operationTime != null">AND rb.operation_time = #{operationTime}</if>
|
||||
<!-- 时间区间(新增) -->
|
||||
<if test="startDate != null">
|
||||
AND rb.operation_time >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND rb.operation_time <= #{endDate}
|
||||
</if>
|
||||
<if test="execStatus != null">AND rb.exec_status = #{execStatus}</if>
|
||||
<if test="operator != null">AND rb.operator = #{operator}</if>
|
||||
<if test="teamCode != null and teamCode != ''">AND rb.team_code = #{teamCode}</if>
|
||||
<if test="isDelivery != null">AND rb.is_delivery = #{isDelivery}</if>
|
||||
<if test="isDelete != null">AND rb.is_delete = #{isDelete}</if>
|
||||
</where>
|
||||
ORDER BY rb.exec_status ASC, rb.operation_time DESC
|
||||
</select>
|
||||
|
||||
<!-- ==================== Detail ==================== -->
|
||||
<select id="selectRkBillById" parameterType="Long" resultMap="RkBillResult">
|
||||
<include refid="selectRkBillVo"/>
|
||||
WHERE rb.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByBillNo"
|
||||
parameterType="String"
|
||||
resultMap="RkBillResult">
|
||||
SELECT
|
||||
id,
|
||||
wl_type,
|
||||
cangku,
|
||||
bill_no,
|
||||
operation_type,
|
||||
biz_type,
|
||||
operation_time,
|
||||
exec_status,
|
||||
operator,
|
||||
team_code,
|
||||
is_delivery,
|
||||
remark,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
is_delete
|
||||
FROM rk_bill
|
||||
WHERE bill_no = #{billNo}
|
||||
AND (is_delete = '0' OR is_delete IS NULL)
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 查询详情 -->
|
||||
<select id="selectRkBillById" resultType="com.zg.project.wisdom.domain.RkBill">
|
||||
SELECT
|
||||
rb.id,
|
||||
rb.rk_type, st.type_name AS rkTypeName,
|
||||
rb.wl_type, mt.type_name AS wlTypeName,
|
||||
rb.cangku, wh.warehouse_name AS cangkuName,
|
||||
rb.rk_time, rb.lihuo_y,
|
||||
|
||||
rb.ck_type, sot.ck_type_name AS ckTypeName,
|
||||
rb.ck_time, rb.ck_lihuo_y,
|
||||
rb.ck_remark, rb.team_code, ct.team_name AS teamName,
|
||||
<!-- ==================== Insert ==================== -->
|
||||
<insert id="insertRkBill"
|
||||
parameterType="com.zg.project.wisdom.domain.RkBill"
|
||||
useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
INSERT INTO rk_bill (
|
||||
bill_no,
|
||||
biz_type,
|
||||
wl_type,
|
||||
cangku,
|
||||
operation_type,
|
||||
operation_time,
|
||||
operator,
|
||||
exec_status,
|
||||
is_delivery,
|
||||
remark,
|
||||
create_by,
|
||||
create_time,
|
||||
is_delete
|
||||
) VALUES (
|
||||
#{billNo},
|
||||
#{bizType},
|
||||
#{wlType},
|
||||
#{cangku},
|
||||
#{operationType},
|
||||
#{operationTime},
|
||||
#{operator},
|
||||
#{execStatus},
|
||||
#{isDelivery},
|
||||
#{remark},
|
||||
#{createBy},
|
||||
#{createTime},
|
||||
#{isDelete}
|
||||
)
|
||||
</insert>
|
||||
|
||||
rb.bill_no, rb.is_chuku, rb.is_delete,
|
||||
rb.created_by AS createBy, rb.created_at AS createTime,
|
||||
rb.updated_by AS updateBy, rb.updated_at AS updateTime,
|
||||
rb.remark
|
||||
|
||||
FROM rk_bill rb
|
||||
LEFT JOIN stock_in_type st ON rb.rk_type = st.type_code
|
||||
LEFT JOIN material_type mt ON rb.wl_type = mt.type_code
|
||||
LEFT JOIN warehouse_info wh ON rb.cangku = wh.warehouse_code
|
||||
LEFT JOIN stock_out_type sot ON rb.ck_type = sot.ck_type_code
|
||||
LEFT JOIN construction_team ct ON rb.team_code = ct.team_code
|
||||
WHERE rb.id = #{id} AND rb.is_delete = '0'
|
||||
</select>
|
||||
|
||||
<!-- 修改 -->
|
||||
<update id="updateRkBill" parameterType="com.zg.project.wisdom.domain.RkBill">
|
||||
<!-- ==================== Update ==================== -->
|
||||
<update id="updateRkBill" parameterType="RkBill">
|
||||
UPDATE rk_bill
|
||||
<set>
|
||||
<if test="rkType != null">rk_type = #{rkType},</if>
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<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="ckType != null">ck_type = #{ckType},</if>
|
||||
<if test="ckTime != null">ck_time = #{ckTime},</if>
|
||||
<if test="ckLihuoY != null">ck_lihuo_y = #{ckLihuoY},</if>
|
||||
<if test="ckRemark != null">ck_remark = #{ckRemark},</if>
|
||||
<if test="billNo != null and billNo != ''">bill_no = #{billNo},</if>
|
||||
<if test="operationType != null">operation_type = #{operationType},</if>
|
||||
<if test="bizType != null">biz_type = #{bizType},</if>
|
||||
<if test="operationTime != null">operation_time = #{operationTime},</if>
|
||||
<if test="execStatus != null">exec_status = #{execStatus},</if>
|
||||
<if test="operator != null">operator = #{operator},</if>
|
||||
<if test="teamCode != null">team_code = #{teamCode},</if>
|
||||
|
||||
<if test="billNo != null">bill_no = #{billNo},</if>
|
||||
<if test="isChuku != null">is_chuku = #{isChuku},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null">updated_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">updated_at = #{updateTime},</if>
|
||||
</set>
|
||||
<if test="isDelivery != null">is_delivery = #{isDelivery},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
</trim>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 批量逻辑删除 -->
|
||||
<update id="logicDeleteRkBillByIds">
|
||||
UPDATE rk_bill
|
||||
SET is_delete = '1'
|
||||
<!-- ==================== Delete ==================== -->
|
||||
<delete id="deleteRkBillById" parameterType="Long">
|
||||
DELETE FROM rk_bill WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRkBillByIds">
|
||||
DELETE FROM rk_bill
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
443
src/main/resources/mybatis/wisdom/RkRecordMapper.xml
Normal file
443
src/main/resources/mybatis/wisdom/RkRecordMapper.xml
Normal file
@@ -0,0 +1,443 @@
|
||||
<?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.zg.project.wisdom.mapper.RkRecordMapper">
|
||||
|
||||
<!-- ===================== resultMap ===================== -->
|
||||
<resultMap type="RkRecord" id="RkRecordResult">
|
||||
<result property="id" column="id"/>
|
||||
|
||||
<!-- ✅ 新增:关联 rk_info 主键 -->
|
||||
<result property="rkInfoId" column="rk_info_id"/>
|
||||
|
||||
<result property="operationType" column="operation_type"/>
|
||||
<result property="operationTypeName" column="operation_type_name"/>
|
||||
|
||||
<result property="bizType" column="biz_type"/>
|
||||
|
||||
<result property="wlType" column="wl_type"/>
|
||||
<result property="wlTypeName" column="wl_type_name"/>
|
||||
|
||||
<result property="cangku" column="cangku"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
<result property="parentWarehouseCode" column="parent_warehouse_code"/>
|
||||
<result property="parentWarehouseName" column="parent_warehouse_name"/>
|
||||
|
||||
<result property="operationTime" column="operation_time"/>
|
||||
<result property="operator" column="operator"/>
|
||||
<result property="operatorName" column="operator_name"/>
|
||||
|
||||
<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="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"/>
|
||||
|
||||
<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"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- ===================== 查询字段(连表补齐) ===================== -->
|
||||
<sql id="selectRkRecordVo">
|
||||
SELECT
|
||||
rr.*,
|
||||
|
||||
/* 理货员姓名 */
|
||||
su.nick_name AS operator_name,
|
||||
|
||||
/* 物资类型名称 */
|
||||
mt.type_name AS wl_type_name,
|
||||
|
||||
/* 出入库类型名称:入库 / 出库 二选一 */
|
||||
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
|
||||
|
||||
/* 仓库信息:小仓/大仓 */
|
||||
wh.warehouse_name,
|
||||
wh.parent_warehouse_code,
|
||||
wh.parent_warehouse_name
|
||||
FROM rk_record rr
|
||||
LEFT JOIN sys_user su
|
||||
ON rr.operator = su.user_id
|
||||
LEFT JOIN material_type mt
|
||||
ON rr.wl_type = mt.type_code
|
||||
LEFT JOIN stock_in_type sit
|
||||
ON rr.operation_type = sit.type_code
|
||||
LEFT JOIN stock_out_type sot
|
||||
ON rr.operation_type = sot.type_code
|
||||
LEFT JOIN warehouse_info wh
|
||||
ON rr.cangku = wh.warehouse_code
|
||||
</sql>
|
||||
|
||||
<!-- ===================== 查询列表 ===================== -->
|
||||
<select id="selectRkRecordList" parameterType="RkRecord" resultMap="RkRecordResult">
|
||||
<include refid="selectRkRecordVo"/>
|
||||
<where>
|
||||
<if test="operationType != null and operationType != ''">
|
||||
AND rr.operation_type = #{operationType}
|
||||
</if>
|
||||
<if test="bizType != null and bizType != ''">
|
||||
AND rr.biz_type = #{bizType}
|
||||
</if>
|
||||
<if test="pcode != null and pcode != ''">
|
||||
AND rr.pcode = #{pcode}
|
||||
</if>
|
||||
<if test="wlType != null and wlType != ''">
|
||||
AND rr.wl_type = #{wlType}
|
||||
</if>
|
||||
<if test="cangku != null and cangku != ''">
|
||||
AND rr.cangku = #{cangku}
|
||||
</if>
|
||||
<if test="operator != null and operator != ''">
|
||||
AND rr.operator = #{operator}
|
||||
</if>
|
||||
<if test="isChuku != null and isChuku != ''">
|
||||
AND rr.is_chuku = #{isChuku}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND rr.status = #{status}
|
||||
</if>
|
||||
<if test="execStatus != null and execStatus != ''">
|
||||
AND rr.exec_status = #{execStatus}
|
||||
</if>
|
||||
<if test="billNo != null and billNo != ''">
|
||||
AND rr.bill_no = #{billNo}
|
||||
</if>
|
||||
<if test="isDelivery != null and isDelivery != ''">
|
||||
AND rr.is_delivery = #{isDelivery}
|
||||
</if>
|
||||
<!-- 项目号 -->
|
||||
<if test="xmNo != null and xmNo != ''">
|
||||
AND rr.xm_no LIKE concat('%', #{xmNo}, '%')
|
||||
</if>
|
||||
<if test="xmMs != null and xmMs != ''">
|
||||
AND rr.xm_ms LIKE concat('%', #{xmMs}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 订单编号 -->
|
||||
<if test="sapNo != null and sapNo != ''">
|
||||
AND rr.sap_no LIKE concat('%', #{sapNo}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 供应商名称 -->
|
||||
<if test="gysMc != null and gysMc != ''">
|
||||
AND rr.gys_mc LIKE concat('%', #{gysMc}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 所属小仓(warehouseCode 实际就是 cangku) -->
|
||||
<if test="cangku != null and cangku != ''">
|
||||
AND rr.cangku = #{cangku}
|
||||
</if>
|
||||
<if test="wlNo != null and wlNo != ''">
|
||||
AND rr.wl_no LIKE concat('%', #{wlNo}, '%')
|
||||
</if>
|
||||
<!-- 物料描述 -->
|
||||
<if test="wlMs != null and wlMs != ''">
|
||||
AND rr.wl_ms LIKE concat('%', #{wlMs}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 默认不查删除 -->
|
||||
<if test="isDelete == null">
|
||||
AND (rr.is_delete = '0' OR rr.is_delete = 0 OR rr.is_delete IS NULL)
|
||||
</if>
|
||||
<!-- 如果前端明确传 isDelete,则按传入的精确过滤 -->
|
||||
<if test="isDelete != null and isDelete != ''">
|
||||
AND rr.is_delete = #{isDelete}
|
||||
</if>
|
||||
<!-- 出入库时间范围 -->
|
||||
<if test="startDate != null">
|
||||
AND rr.operation_time >= #{startDate}
|
||||
</if>
|
||||
|
||||
<if test="endDate != null">
|
||||
AND rr.operation_time <= #{endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY rr.operation_time DESC
|
||||
</select>
|
||||
|
||||
<!-- ===================== 按 ID 查询 ===================== -->
|
||||
<select id="selectRkRecordById" parameterType="Long" resultMap="RkRecordResult">
|
||||
<include refid="selectRkRecordVo"/>
|
||||
WHERE rr.id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- ===================== 按单号查询(时间正序) ===================== -->
|
||||
<select id="selectRkRecordListByBillNo" parameterType="String" resultMap="RkRecordResult">
|
||||
<include refid="selectRkRecordVo"/>
|
||||
WHERE rr.bill_no = #{billNo}
|
||||
AND (rr.is_delete = '0' OR rr.is_delete = 0 OR rr.is_delete IS NULL)
|
||||
ORDER BY rr.operation_time ASC
|
||||
</select>
|
||||
|
||||
<!-- ===================== 新增 ===================== -->
|
||||
<insert id="insertRkRecord"
|
||||
parameterType="RkRecord"
|
||||
useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
INSERT INTO rk_record (
|
||||
|
||||
<!-- ✅ 新增:关联 rk_info 主键 -->
|
||||
rk_info_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,
|
||||
|
||||
gys_jh_id,
|
||||
rdid,
|
||||
rdid_ck,
|
||||
sid,
|
||||
|
||||
is_delivery,
|
||||
fycde_1,
|
||||
fycde_2,
|
||||
is_update,
|
||||
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
is_delete
|
||||
)
|
||||
VALUES (
|
||||
|
||||
<!-- ✅ 新增:关联 rk_info 主键 -->
|
||||
#{rkInfoId},
|
||||
|
||||
#{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},
|
||||
#{updateBy},
|
||||
#{updateTime},
|
||||
#{isDelete}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- ===================== 更新 ===================== -->
|
||||
<update id="updateRkRecord" parameterType="RkRecord">
|
||||
UPDATE rk_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
||||
<!-- ✅ 新增:支持更新 rk_info_id(不影响你原逻辑,不传就不更新) -->
|
||||
<if test="rkInfoId != null">rk_info_id = #{rkInfoId},</if>
|
||||
|
||||
<if test="operationType != null">operation_type = #{operationType},</if>
|
||||
<if test="bizType != null">biz_type = #{bizType},</if>
|
||||
<if test="wlType != null">wl_type = #{wlType},</if>
|
||||
<if test="cangku != null">cangku = #{cangku},</if>
|
||||
<if test="operationTime != null">operation_time = #{operationTime},</if>
|
||||
<if test="operator != null">operator = #{operator},</if>
|
||||
|
||||
<if test="isChuku != null">is_chuku = #{isChuku},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="execStatus != null">exec_status = #{execStatus},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="billNo != null">bill_no = #{billNo},</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="teamCode != null">team_code = #{teamCode},</if>
|
||||
|
||||
<if test="borrowTime != null">borrow_time = #{borrowTime},</if>
|
||||
<if test="returnTime != null">return_time = #{returnTime},</if>
|
||||
<if test="hasMoved != null">has_moved = #{hasMoved},</if>
|
||||
<if test="isBorrowed != null">is_borrowed = #{isBorrowed},</if>
|
||||
|
||||
<if test="gysJhId != null">gys_jh_id = #{gysJhId},</if>
|
||||
<if test="rdid != null">rdid = #{rdid},</if>
|
||||
<if test="rdidCk != null">rdid_ck = #{rdidCk},</if>
|
||||
<if test="sid != null">sid = #{sid},</if>
|
||||
|
||||
<if test="isDelivery != null">is_delivery = #{isDelivery},</if>
|
||||
<if test="fycde1 != null">fycde_1 = #{fycde1},</if>
|
||||
<if test="fycde2 != null">fycde_2 = #{fycde2},</if>
|
||||
<if test="isUpdate != null">is_update = #{isUpdate},</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>
|
||||
</trim>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- ===================== 删除 ===================== -->
|
||||
<delete id="deleteRkRecordById" parameterType="Long">
|
||||
DELETE FROM rk_record WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRkRecordByIds" parameterType="String">
|
||||
DELETE FROM rk_record WHERE id IN
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user