2025-06-09 15:16:00 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
2026-01-21 11:44:51 +08:00
|
|
|
<!DOCTYPE mapper
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
2025-06-09 15:16:00 +08:00
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.zg.project.wisdom.mapper.RkBillMapper">
|
|
|
|
|
|
2026-01-21 11:44:51 +08:00
|
|
|
<!-- ==================== ResultMap ==================== -->
|
|
|
|
|
<resultMap type="RkBill" id="RkBillResult">
|
2026-01-21 19:21:07 +08:00
|
|
|
<result property="id" column="id"/>
|
2026-01-22 19:59:49 +08:00
|
|
|
|
2026-01-21 19:21:07 +08:00
|
|
|
<result property="wlType" column="wl_type"/>
|
|
|
|
|
<result property="wlTypeName" column="wl_type_name"/>
|
2025-06-09 15:16:00 +08:00
|
|
|
|
2026-01-21 19:21:07 +08:00
|
|
|
<result property="cangku" column="cangku"/>
|
|
|
|
|
<result property="warehouseName" column="warehouse_name"/>
|
|
|
|
|
<result property="parentWarehouseName" column="parent_warehouse_name"/>
|
2025-06-10 09:37:37 +08:00
|
|
|
|
2026-01-21 19:21:07 +08:00
|
|
|
<result property="billNo" column="bill_no"/>
|
2025-06-09 15:16:00 +08:00
|
|
|
|
2026-01-21 19:21:07 +08:00
|
|
|
<result property="operationType" column="operation_type"/>
|
|
|
|
|
<result property="operationTypeName" column="operation_type_name"/>
|
2025-06-10 09:37:37 +08:00
|
|
|
|
2026-01-21 19:21:07 +08:00
|
|
|
<result property="bizType" column="biz_type"/>
|
|
|
|
|
<result property="operationTime" column="operation_time"/>
|
|
|
|
|
<result property="execStatus" column="exec_status"/>
|
2025-06-10 09:37:37 +08:00
|
|
|
|
2026-01-21 19:21:07 +08:00
|
|
|
<result property="operator" column="operator"/>
|
|
|
|
|
<result property="operatorName" column="operator_name"/>
|
2025-06-10 09:37:37 +08:00
|
|
|
|
2026-01-21 19:21:07 +08:00
|
|
|
<result property="teamCode" column="team_code"/>
|
2026-01-22 19:59:49 +08:00
|
|
|
<result property="teamName" column="team_name"/>
|
|
|
|
|
|
|
|
|
|
<result property="borrowTime" column="borrow_time"/>
|
|
|
|
|
<result property="returnTime" column="return_time"/>
|
|
|
|
|
|
|
|
|
|
<result property="xmNoCk" column="xm_no_ck"/>
|
|
|
|
|
<result property="xmMsCk" column="xm_ms_ck"/>
|
|
|
|
|
|
2026-01-21 19:21:07 +08:00
|
|
|
<result property="remark" column="remark"/>
|
|
|
|
|
<result property="isDelivery" column="is_delivery"/>
|
|
|
|
|
<result property="isDelete" column="is_delete"/>
|
2026-01-22 19:59:49 +08:00
|
|
|
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
2026-03-25 14:08:00 +08:00
|
|
|
<result property="isUploadPhoto" column="is_upload_photo"/>
|
|
|
|
|
<result property="demandDeptName" column="demand_dept_name"/>
|
2026-01-21 11:44:51 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<!-- ==================== Base Select ==================== -->
|
|
|
|
|
<sql id="selectRkBillVo">
|
|
|
|
|
SELECT
|
|
|
|
|
rb.id,
|
|
|
|
|
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,
|
2026-01-22 19:59:49 +08:00
|
|
|
|
|
|
|
|
rb.borrow_time,
|
|
|
|
|
rb.return_time,
|
|
|
|
|
rb.xm_no_ck,
|
|
|
|
|
rb.xm_ms_ck,
|
|
|
|
|
|
2026-01-21 11:44:51 +08:00
|
|
|
rb.remark,
|
|
|
|
|
rb.is_delivery,
|
|
|
|
|
rb.is_delete,
|
2026-01-22 19:59:49 +08:00
|
|
|
rb.create_by,
|
|
|
|
|
rb.create_time,
|
|
|
|
|
rb.update_by,
|
|
|
|
|
rb.update_time,
|
2026-03-25 14:08:00 +08:00
|
|
|
rb.is_upload_photo,
|
2026-03-26 11:38:41 +08:00
|
|
|
rb.demand_dept_name,
|
2026-01-21 11:44:51 +08:00
|
|
|
mt.type_name AS wl_type_name,
|
|
|
|
|
COALESCE(sit.type_name, sot.type_name) AS operation_type_name,
|
|
|
|
|
su.nick_name AS operator_name,
|
|
|
|
|
wh.warehouse_name AS warehouse_name,
|
2026-01-22 19:59:49 +08:00
|
|
|
wh.parent_warehouse_name AS parent_warehouse_name,
|
|
|
|
|
ct.team_name AS team_name
|
2025-06-10 09:37:37 +08:00
|
|
|
|
|
|
|
|
FROM rk_bill rb
|
2026-01-21 11:44:51 +08:00
|
|
|
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
|
2026-01-22 19:59:49 +08:00
|
|
|
LEFT JOIN construction_team ct
|
|
|
|
|
ON rb.team_code = ct.team_code
|
|
|
|
|
AND ct.is_delete = '0'
|
2026-01-21 11:44:51 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<!-- ==================== List ==================== -->
|
|
|
|
|
<select id="selectRkBillList" parameterType="RkBill" resultMap="RkBillResult">
|
|
|
|
|
<include refid="selectRkBillVo"/>
|
|
|
|
|
<where>
|
2026-01-21 19:21:07 +08:00
|
|
|
<if test="wlType != null and wlType != ''">
|
|
|
|
|
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>
|
|
|
|
|
|
2026-02-03 11:25:35 +08:00
|
|
|
<if test="operationType != null and operationType.trim() != ''">
|
2026-01-21 19:21:07 +08:00
|
|
|
AND rb.operation_type = #{operationType}
|
|
|
|
|
</if>
|
|
|
|
|
|
2026-02-05 16:25:28 +08:00
|
|
|
<if test="bizTypeList != null and bizTypeList.size() > 0">
|
2026-01-21 19:21:07 +08:00
|
|
|
AND rb.biz_type IN
|
2026-01-22 19:59:49 +08:00
|
|
|
<foreach collection="bizTypeList" item="bt" open="(" separator="," close=")">
|
2026-01-21 19:21:07 +08:00
|
|
|
#{bt}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
|
2026-01-22 19:59:49 +08:00
|
|
|
<if test="borrowTime != null">
|
|
|
|
|
AND rb.borrow_time = #{borrowTime}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="returnTime != null">
|
|
|
|
|
AND rb.return_time = #{returnTime}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="xmNoCk != null and xmNoCk != ''">
|
|
|
|
|
AND rb.xm_no_ck = #{xmNoCk}
|
2026-01-21 19:21:07 +08:00
|
|
|
</if>
|
|
|
|
|
|
2026-01-21 11:44:51 +08:00
|
|
|
<if test="startDate != null">
|
|
|
|
|
AND rb.operation_time >= #{startDate}
|
|
|
|
|
</if>
|
2026-01-21 19:21:07 +08:00
|
|
|
|
2026-01-21 11:44:51 +08:00
|
|
|
<if test="endDate != null">
|
|
|
|
|
AND rb.operation_time <= #{endDate}
|
|
|
|
|
</if>
|
2026-01-21 19:21:07 +08:00
|
|
|
|
|
|
|
|
<if test="execStatus != null and execStatus != ''">
|
|
|
|
|
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 isDelivery != ''">
|
|
|
|
|
AND rb.is_delivery = #{isDelivery}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="isDelete != null and isDelete != ''">
|
|
|
|
|
AND rb.is_delete = #{isDelete}
|
|
|
|
|
</if>
|
|
|
|
|
|
2026-01-21 11:44:51 +08:00
|
|
|
</where>
|
|
|
|
|
ORDER BY rb.exec_status ASC, rb.operation_time DESC
|
2025-06-09 15:16:00 +08:00
|
|
|
</select>
|
|
|
|
|
|
2026-01-21 11:44:51 +08:00
|
|
|
<!-- ==================== Detail ==================== -->
|
|
|
|
|
<select id="selectRkBillById" parameterType="Long" resultMap="RkBillResult">
|
|
|
|
|
<include refid="selectRkBillVo"/>
|
|
|
|
|
WHERE rb.id = #{id}
|
|
|
|
|
</select>
|
2025-06-10 09:37:37 +08:00
|
|
|
|
2026-01-22 19:59:49 +08:00
|
|
|
<select id="selectByBillNo" parameterType="String" resultMap="RkBillResult">
|
2026-01-21 11:44:51 +08:00
|
|
|
SELECT
|
|
|
|
|
id,
|
|
|
|
|
wl_type,
|
|
|
|
|
cangku,
|
|
|
|
|
bill_no,
|
|
|
|
|
operation_type,
|
|
|
|
|
biz_type,
|
|
|
|
|
operation_time,
|
|
|
|
|
exec_status,
|
|
|
|
|
operator,
|
|
|
|
|
team_code,
|
2026-01-22 19:59:49 +08:00
|
|
|
borrow_time,
|
|
|
|
|
return_time,
|
|
|
|
|
xm_no_ck,
|
|
|
|
|
xm_ms_ck,
|
2026-01-21 11:44:51 +08:00
|
|
|
is_delivery,
|
|
|
|
|
remark,
|
|
|
|
|
create_by,
|
|
|
|
|
create_time,
|
|
|
|
|
update_by,
|
|
|
|
|
update_time,
|
2026-03-25 14:08:00 +08:00
|
|
|
is_delete,
|
|
|
|
|
is_upload_photo,
|
|
|
|
|
demand_dept_name
|
2026-01-21 11:44:51 +08:00
|
|
|
FROM rk_bill
|
|
|
|
|
WHERE bill_no = #{billNo}
|
|
|
|
|
AND (is_delete = '0' OR is_delete IS NULL)
|
|
|
|
|
LIMIT 1
|
|
|
|
|
</select>
|
2025-06-10 09:37:37 +08:00
|
|
|
|
2026-01-21 11:44:51 +08:00
|
|
|
<!-- ==================== 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,
|
2026-01-22 19:59:49 +08:00
|
|
|
team_code,
|
|
|
|
|
borrow_time,
|
|
|
|
|
return_time,
|
|
|
|
|
xm_no_ck,
|
|
|
|
|
xm_ms_ck,
|
2026-01-21 11:44:51 +08:00
|
|
|
exec_status,
|
|
|
|
|
is_delivery,
|
|
|
|
|
remark,
|
|
|
|
|
create_by,
|
|
|
|
|
create_time,
|
2026-03-25 14:08:00 +08:00
|
|
|
is_delete,
|
|
|
|
|
is_upload_photo,
|
|
|
|
|
demand_dept_name
|
2026-01-21 11:44:51 +08:00
|
|
|
) VALUES (
|
|
|
|
|
#{billNo},
|
|
|
|
|
#{bizType},
|
|
|
|
|
#{wlType},
|
|
|
|
|
#{cangku},
|
|
|
|
|
#{operationType},
|
|
|
|
|
#{operationTime},
|
|
|
|
|
#{operator},
|
2026-01-22 19:59:49 +08:00
|
|
|
#{teamCode},
|
|
|
|
|
#{borrowTime},
|
|
|
|
|
#{returnTime},
|
|
|
|
|
#{xmNoCk},
|
|
|
|
|
#{xmMsCk},
|
2026-01-21 11:44:51 +08:00
|
|
|
#{execStatus},
|
|
|
|
|
#{isDelivery},
|
|
|
|
|
#{remark},
|
|
|
|
|
#{createBy},
|
|
|
|
|
#{createTime},
|
2026-03-25 14:08:00 +08:00
|
|
|
#{isDelete},
|
|
|
|
|
#{isUploadPhoto},
|
|
|
|
|
#{demandDeptName}
|
2026-01-21 11:44:51 +08:00
|
|
|
)
|
|
|
|
|
</insert>
|
2025-06-09 15:16:00 +08:00
|
|
|
|
2026-01-21 11:44:51 +08:00
|
|
|
<!-- ==================== Update ==================== -->
|
|
|
|
|
<update id="updateRkBill" parameterType="RkBill">
|
2025-06-09 15:16:00 +08:00
|
|
|
UPDATE rk_bill
|
2026-01-21 11:44:51 +08:00
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
2026-01-21 19:21:07 +08:00
|
|
|
<if test="wlType != null and wlType != ''">wl_type = #{wlType},</if>
|
|
|
|
|
<if test="cangku != null and cangku != ''">cangku = #{cangku},</if>
|
2026-01-21 11:44:51 +08:00
|
|
|
<if test="billNo != null and billNo != ''">bill_no = #{billNo},</if>
|
2026-01-21 19:21:07 +08:00
|
|
|
<if test="operationType != null and operationType != ''">operation_type = #{operationType},</if>
|
|
|
|
|
<if test="bizType != null and bizType != ''">biz_type = #{bizType},</if>
|
2026-01-21 11:44:51 +08:00
|
|
|
<if test="operationTime != null">operation_time = #{operationTime},</if>
|
2026-01-22 19:59:49 +08:00
|
|
|
<if test="borrowTime != null">borrow_time = #{borrowTime},</if>
|
|
|
|
|
<if test="returnTime != null">return_time = #{returnTime},</if>
|
|
|
|
|
<if test="xmNoCk != null and xmNoCk != ''">xm_no_ck = #{xmNoCk},</if>
|
|
|
|
|
<if test="xmMsCk != null and xmMsCk != ''">xm_ms_ck = #{xmMsCk},</if>
|
2026-01-21 19:21:07 +08:00
|
|
|
<if test="execStatus != null and execStatus != ''">exec_status = #{execStatus},</if>
|
2026-01-21 11:44:51 +08:00
|
|
|
<if test="operator != null">operator = #{operator},</if>
|
2026-01-21 19:21:07 +08:00
|
|
|
<if test="teamCode != null and teamCode != ''">team_code = #{teamCode},</if>
|
2025-06-10 09:37:37 +08:00
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
2026-01-21 19:21:07 +08:00
|
|
|
<if test="isDelivery != null and isDelivery != ''">is_delivery = #{isDelivery},</if>
|
|
|
|
|
<if test="isDelete != null and isDelete != ''">is_delete = #{isDelete},</if>
|
2026-03-25 14:08:00 +08:00
|
|
|
<if test="isUploadPhoto != null ">is_upload_photo = #{isUploadPhoto},</if>
|
|
|
|
|
<if test="demandDeptName != null and demandDeptName != ''">demand_dept_name = #{demandDeptName},</if>
|
2026-01-21 11:44:51 +08:00
|
|
|
</trim>
|
2025-06-09 15:16:00 +08:00
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
2026-01-22 19:59:49 +08:00
|
|
|
<!-- ==================== ExecStatus ==================== -->
|
2026-01-21 19:21:07 +08:00
|
|
|
<update id="updateExecStatusByBillNo">
|
|
|
|
|
UPDATE rk_bill
|
|
|
|
|
SET exec_status = #{execStatus}
|
|
|
|
|
WHERE bill_no = #{billNo}
|
|
|
|
|
</update>
|
|
|
|
|
|
2026-01-22 19:59:49 +08:00
|
|
|
<update id="updateExecStatus">
|
|
|
|
|
UPDATE rk_bill
|
|
|
|
|
SET exec_status = #{execStatus}
|
|
|
|
|
WHERE bill_no = #{billNo}
|
|
|
|
|
</update>
|
|
|
|
|
|
2026-01-21 11:44:51 +08:00
|
|
|
<!-- ==================== Delete ==================== -->
|
|
|
|
|
<delete id="deleteRkBillById" parameterType="Long">
|
|
|
|
|
DELETE FROM rk_bill WHERE id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteRkBillByIds">
|
|
|
|
|
DELETE FROM rk_bill
|
2025-06-09 15:16:00 +08:00
|
|
|
WHERE id IN
|
2026-01-21 11:44:51 +08:00
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
2025-06-09 15:16:00 +08:00
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
2026-01-21 11:44:51 +08:00
|
|
|
</delete>
|
2025-06-09 15:16:00 +08:00
|
|
|
|
2026-02-04 16:32:37 +08:00
|
|
|
<update id="updateDeliveryStatusByBillNo">
|
|
|
|
|
UPDATE rk_bill
|
|
|
|
|
SET is_delivery = #{isDelivery},
|
|
|
|
|
update_time = NOW()
|
|
|
|
|
WHERE bill_no = #{billNo}
|
|
|
|
|
AND is_delete = '0'
|
|
|
|
|
</update>
|
2025-06-09 15:16:00 +08:00
|
|
|
</mapper>
|