库存模块功能开发
This commit is contained in:
@@ -1,38 +1,66 @@
|
||||
<?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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zg.project.wisdom.mapper.GysJhMapper">
|
||||
|
||||
|
||||
<resultMap type="GysJh" id="GysJhResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="indexNo" column="index_no" />
|
||||
<result property="xj" column="xj" />
|
||||
<result property="xmNo" column="xm_no" />
|
||||
<result property="xmMs" column="xm_ms" />
|
||||
<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="status" column="status" />
|
||||
<result property="entityId" column="entity_id" />
|
||||
<result property="remark" column="remark" />
|
||||
<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="id" column="id"/>
|
||||
<result property="indexNo" column="index_no"/>
|
||||
<result property="xj" column="xj"/>
|
||||
<result property="xmNo" column="xm_no"/>
|
||||
<result property="xmMs" column="xm_ms"/>
|
||||
<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="realQty" column="real_qty"/>
|
||||
<result property="htQty" column="ht_qty"/>
|
||||
<result property="dw" column="dw"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="entityId" column="entity_id"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<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="selectGysJhVo">
|
||||
select id, index_no, xj, xm_no, xm_ms, wl_no, wl_ms, gys_no, gys_mc, jh_amt, ht_dj, sap_no, xh, jh_qty, ht_qty, dw, status,entity_id, remark, create_by, create_time, update_by, update_time, is_delete from gys_jh
|
||||
select
|
||||
id,
|
||||
index_no,
|
||||
xj,
|
||||
xm_no,
|
||||
xm_ms,
|
||||
wl_no,
|
||||
wl_ms,
|
||||
gys_no,
|
||||
gys_mc,
|
||||
jh_amt,
|
||||
ht_dj,
|
||||
sap_no,
|
||||
xh,
|
||||
jh_qty,
|
||||
real_qty,
|
||||
ht_qty,
|
||||
dw,
|
||||
status,
|
||||
entity_id,
|
||||
remark,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
is_delete
|
||||
from gys_jh
|
||||
</sql>
|
||||
|
||||
<select id="selectGysJhList" parameterType="GysJh" resultMap="GysJhResult">
|
||||
@@ -59,11 +87,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<!-- and (status is null or trim(status) != '1') -->
|
||||
<if test="isDelete != null and isDelete != ''">
|
||||
and is_delete = #{isDelete}
|
||||
</if>
|
||||
<!-- 按创建时间筛选:create_time 在 [beginTime, endTime] -->
|
||||
<if test="beginTime != null">
|
||||
and create_time <![CDATA[>=]]> #{beginTime}
|
||||
</if>
|
||||
@@ -72,48 +98,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectGysJhById" parameterType="Long" resultMap="GysJhResult">
|
||||
<include refid="selectGysJhVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getBySapNo" parameterType="java.lang.String" resultMap="GysJhResult">
|
||||
<select id="getBySapNo" parameterType="String" resultMap="GysJhResult">
|
||||
<include refid="selectGysJhVo"/>
|
||||
WHERE sap_no = #{sapNo}
|
||||
</select>
|
||||
|
||||
<!-- 【已注释】唯一性校验查询:基于SAP订单号、项目号、物料号判断是否已存在 -->
|
||||
<!-- <select id="existsByUniqueKeys" resultType="boolean">
|
||||
SELECT COUNT(1)
|
||||
FROM gys_jh
|
||||
WHERE sap_no = #{sapNo}
|
||||
AND xm_no = #{xmNo}
|
||||
AND wl_no = #{wlNo}
|
||||
AND is_delete != '1'
|
||||
</select> -->
|
||||
|
||||
<select id="selectByIds" resultMap="GysJhResult">
|
||||
SELECT * FROM gys_jh
|
||||
SELECT *
|
||||
FROM gys_jh
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectMissingMtdItems" resultType="com.zg.project.wisdom.domain.vo.PlanToMtdVO">
|
||||
SELECT
|
||||
g.wl_no AS wlNo,
|
||||
MAX(g.wl_ms) AS wlMs,
|
||||
MAX(g.dw) AS dw,
|
||||
MAX(g.ht_dj) AS htDj
|
||||
FROM gys_jh g
|
||||
LEFT JOIN mtd m ON m.mid = g.wl_no
|
||||
WHERE g.wl_no IS NOT NULL AND g.wl_no <> ''
|
||||
AND m.mid IS NULL
|
||||
GROUP BY g.wl_no
|
||||
</select>
|
||||
|
||||
<insert id="insertGysJh" parameterType="GysJh" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into gys_jh
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@@ -130,6 +134,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="sapNo != null">sap_no,</if>
|
||||
<if test="xh != null">xh,</if>
|
||||
<if test="jhQty != null">jh_qty,</if>
|
||||
<!-- 新增 -->
|
||||
<if test="realQty != null">real_qty,</if>
|
||||
<if test="htQty != null">ht_qty,</if>
|
||||
<if test="dw != null">dw,</if>
|
||||
<if test="status != null">status,</if>
|
||||
@@ -140,7 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="isDelete != null">is_delete,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="indexNo != null">#{indexNo},</if>
|
||||
<if test="xj != null">#{xj},</if>
|
||||
@@ -155,6 +161,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="sapNo != null">#{sapNo},</if>
|
||||
<if test="xh != null">#{xh},</if>
|
||||
<if test="jhQty != null">#{jhQty},</if>
|
||||
<!-- 新增 -->
|
||||
<if test="realQty != null">#{realQty},</if>
|
||||
<if test="htQty != null">#{htQty},</if>
|
||||
<if test="dw != null">#{dw},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
@@ -165,9 +173,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="increaseRealQtyById">
|
||||
UPDATE gys_jh
|
||||
SET real_qty = real_qty + #{realQty}
|
||||
WHERE id = #{gysJhId}
|
||||
</update>
|
||||
<update id="updateGysJh" parameterType="GysJh">
|
||||
update gys_jh
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
@@ -184,6 +197,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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="realQty != null">real_qty = #{realQty},</if>
|
||||
<if test="htQty != null">ht_qty = #{htQty},</if>
|
||||
<if test="dw != null">dw = #{dw},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
@@ -198,6 +213,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 下面原有方法全部保持不动 -->
|
||||
<update id="updateStatusById" parameterType="map">
|
||||
UPDATE gys_jh
|
||||
SET status = #{status}
|
||||
@@ -233,7 +249,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteGysJhByIds" parameterType="String">
|
||||
delete from gys_jh where id in
|
||||
delete from gys_jh where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
@@ -246,10 +262,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND is_delete = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectMissingMtdItems"
|
||||
resultType="com.zg.project.wisdom.domain.vo.PlanToMtdVO">
|
||||
<![CDATA[
|
||||
SELECT
|
||||
g.wl_no AS wlNo,
|
||||
MAX(g.wl_ms) AS wlMs,
|
||||
MAX(g.dw) AS dw,
|
||||
MAX(g.ht_dj) AS htDj
|
||||
FROM gys_jh g
|
||||
LEFT JOIN mtd m ON m.mid = g.wl_no
|
||||
WHERE g.wl_no IS NOT NULL
|
||||
AND g.wl_no <> ''
|
||||
AND m.mid IS NULL
|
||||
GROUP BY g.wl_no
|
||||
]]>
|
||||
</select>
|
||||
<!-- 查询当前已入库数量 -->
|
||||
<select id="selectRealQtyById" resultType="java.math.BigDecimal">
|
||||
SELECT real_qty
|
||||
FROM gys_jh
|
||||
WHERE id = #{jhId}
|
||||
</select>
|
||||
<update id="updateDwById">
|
||||
UPDATE gys_jh
|
||||
SET dw = #{dw}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
<update id="rollbackInQty">
|
||||
UPDATE gys_jh
|
||||
SET real_qty = real_qty - #{rollbackQty}
|
||||
WHERE id = #{jhId}
|
||||
</update>
|
||||
|
||||
<!-- 回退状态 -->
|
||||
<update id="updateStatus">
|
||||
UPDATE gys_jh
|
||||
SET status = #{status}
|
||||
WHERE id = #{jhId}
|
||||
</update>
|
||||
|
||||
<update id="updateRealQtyById">
|
||||
UPDATE gys_jh
|
||||
SET
|
||||
real_qty = #{realQty},
|
||||
update_time = NOW()
|
||||
WHERE id = #{gysJhId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -9,20 +9,31 @@
|
||||
<resultMap type="com.zg.project.wisdom.domain.MoveRecord" id="MoveRecordResult">
|
||||
<result property="id" column="id"/>
|
||||
|
||||
<!-- 关键字段:rk_info_id -->
|
||||
<!-- 关键字段 -->
|
||||
<result property="rkInfoId" column="rk_info_id"/>
|
||||
|
||||
<result property="newRkInfoId" column="new_rk_info_id"/>
|
||||
<result property="entityId" column="entity_id"/>
|
||||
|
||||
<!-- 数量 -->
|
||||
<result property="realQty" column="real_qty"/>
|
||||
|
||||
<!-- from -->
|
||||
<result property="fromCangku" column="from_cangku"/>
|
||||
<result property="fromPcode" column="from_pcode"/>
|
||||
<result property="fromTrayCode" column="from_tray_code"/>
|
||||
|
||||
<!-- to -->
|
||||
<result property="toCangku" column="to_cangku"/>
|
||||
<result property="toPcode" column="to_pcode"/>
|
||||
<result property="toTrayCode" column="to_tray_code"/>
|
||||
|
||||
<!-- 业务 -->
|
||||
<result property="moveReason" column="move_reason"/>
|
||||
<result property="movedBy" column="moved_by"/>
|
||||
<result property="movedByName" column="moved_by_name"/>
|
||||
<result property="movedAt" column="moved_at"/>
|
||||
|
||||
<!-- 通用字段 -->
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
@@ -43,7 +54,9 @@
|
||||
SELECT
|
||||
id,
|
||||
rk_info_id,
|
||||
new_rk_info_id,
|
||||
entity_id,
|
||||
real_qty,
|
||||
from_cangku,
|
||||
from_pcode,
|
||||
from_tray_code,
|
||||
@@ -68,7 +81,9 @@
|
||||
keyProperty="id">
|
||||
INSERT INTO move_record (
|
||||
rk_info_id,
|
||||
new_rk_info_id,
|
||||
entity_id,
|
||||
real_qty,
|
||||
from_cangku,
|
||||
from_pcode,
|
||||
from_tray_code,
|
||||
@@ -85,7 +100,9 @@
|
||||
is_delete
|
||||
) VALUES (
|
||||
#{rkInfoId},
|
||||
#{newRkInfoId},
|
||||
#{entityId},
|
||||
#{realQty},
|
||||
#{fromCangku},
|
||||
#{fromPcode},
|
||||
#{fromTrayCode},
|
||||
@@ -120,6 +137,7 @@
|
||||
LEFT JOIN warehouse_info wi1 ON mr.from_cangku = wi1.warehouse_code
|
||||
LEFT JOIN warehouse_info wi2 ON mr.to_cangku = wi2.warehouse_code
|
||||
<where>
|
||||
mr.is_delete = 0
|
||||
<if test="entityId != null and entityId != ''">
|
||||
AND mr.entity_id = #{entityId}
|
||||
</if>
|
||||
@@ -153,7 +171,9 @@
|
||||
UPDATE move_record
|
||||
<set>
|
||||
<if test="rkInfoId != null">rk_info_id = #{rkInfoId},</if>
|
||||
<if test="newRkInfoId != null">new_rk_info_id = #{newRkInfoId},</if>
|
||||
<if test="entityId != null">entity_id = #{entityId},</if>
|
||||
<if test="realQty != null">real_qty = #{realQty},</if>
|
||||
<if test="fromCangku != null">from_cangku = #{fromCangku},</if>
|
||||
<if test="fromPcode != null">from_pcode = #{fromPcode},</if>
|
||||
<if test="fromTrayCode != null">from_tray_code = #{fromTrayCode},</if>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<!-- ==================== ResultMap ==================== -->
|
||||
<resultMap type="RkBill" id="RkBillResult">
|
||||
<result property="id" column="id"/>
|
||||
|
||||
<result property="wlType" column="wl_type"/>
|
||||
<result property="wlTypeName" column="wl_type_name"/>
|
||||
|
||||
@@ -27,9 +28,22 @@
|
||||
<result property="operatorName" column="operator_name"/>
|
||||
|
||||
<result property="teamCode" column="team_code"/>
|
||||
<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"/>
|
||||
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="isDelivery" column="is_delivery"/>
|
||||
<result property="isDelete" column="is_delete"/>
|
||||
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- ==================== Base Select ==================== -->
|
||||
@@ -45,15 +59,26 @@
|
||||
rb.exec_status,
|
||||
rb.operator,
|
||||
rb.team_code,
|
||||
|
||||
rb.borrow_time,
|
||||
rb.return_time,
|
||||
rb.xm_no_ck,
|
||||
rb.xm_ms_ck,
|
||||
|
||||
rb.remark,
|
||||
rb.is_delivery,
|
||||
rb.is_delete,
|
||||
rb.create_by,
|
||||
rb.create_time,
|
||||
rb.update_by,
|
||||
rb.update_time,
|
||||
|
||||
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,
|
||||
wh.parent_warehouse_name AS parent_warehouse_name
|
||||
wh.parent_warehouse_name AS parent_warehouse_name,
|
||||
ct.team_name AS team_name
|
||||
|
||||
FROM rk_bill rb
|
||||
LEFT JOIN warehouse_info wh
|
||||
@@ -70,6 +95,9 @@
|
||||
AND (sot.is_delete = '0' OR sot.is_delete IS NULL)
|
||||
LEFT JOIN sys_user su
|
||||
ON rb.operator = su.user_id
|
||||
LEFT JOIN construction_team ct
|
||||
ON rb.team_code = ct.team_code
|
||||
AND ct.is_delete = '0'
|
||||
</sql>
|
||||
|
||||
<!-- ==================== List ==================== -->
|
||||
@@ -93,20 +121,23 @@
|
||||
AND rb.operation_type = #{operationType}
|
||||
</if>
|
||||
|
||||
<!-- 多 bizType -->
|
||||
<if test="bizTypeList != null and bizTypeList.size > 0">
|
||||
AND rb.biz_type IN
|
||||
<foreach collection="bizTypeList"
|
||||
item="bt"
|
||||
open="("
|
||||
separator=","
|
||||
close=")">
|
||||
<foreach collection="bizTypeList" item="bt" open="(" separator="," close=")">
|
||||
#{bt}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="operationTime != null">
|
||||
AND rb.operation_time = #{operationTime}
|
||||
<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}
|
||||
</if>
|
||||
|
||||
<if test="startDate != null">
|
||||
@@ -147,9 +178,7 @@
|
||||
WHERE rb.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByBillNo"
|
||||
parameterType="String"
|
||||
resultMap="RkBillResult">
|
||||
<select id="selectByBillNo" parameterType="String" resultMap="RkBillResult">
|
||||
SELECT
|
||||
id,
|
||||
wl_type,
|
||||
@@ -161,6 +190,10 @@
|
||||
exec_status,
|
||||
operator,
|
||||
team_code,
|
||||
borrow_time,
|
||||
return_time,
|
||||
xm_no_ck,
|
||||
xm_ms_ck,
|
||||
is_delivery,
|
||||
remark,
|
||||
create_by,
|
||||
@@ -187,6 +220,11 @@
|
||||
operation_type,
|
||||
operation_time,
|
||||
operator,
|
||||
team_code,
|
||||
borrow_time,
|
||||
return_time,
|
||||
xm_no_ck,
|
||||
xm_ms_ck,
|
||||
exec_status,
|
||||
is_delivery,
|
||||
remark,
|
||||
@@ -201,6 +239,11 @@
|
||||
#{operationType},
|
||||
#{operationTime},
|
||||
#{operator},
|
||||
#{teamCode},
|
||||
#{borrowTime},
|
||||
#{returnTime},
|
||||
#{xmNoCk},
|
||||
#{xmMsCk},
|
||||
#{execStatus},
|
||||
#{isDelivery},
|
||||
#{remark},
|
||||
@@ -220,6 +263,10 @@
|
||||
<if test="operationType != null and operationType != ''">operation_type = #{operationType},</if>
|
||||
<if test="bizType != null and bizType != ''">biz_type = #{bizType},</if>
|
||||
<if test="operationTime != null">operation_time = #{operationTime},</if>
|
||||
<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>
|
||||
<if test="execStatus != null and execStatus != ''">exec_status = #{execStatus},</if>
|
||||
<if test="operator != null">operator = #{operator},</if>
|
||||
<if test="teamCode != null and teamCode != ''">team_code = #{teamCode},</if>
|
||||
@@ -230,12 +277,19 @@
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- ==================== ExecStatus ==================== -->
|
||||
<update id="updateExecStatusByBillNo">
|
||||
UPDATE rk_bill
|
||||
SET exec_status = #{execStatus}
|
||||
WHERE bill_no = #{billNo}
|
||||
</update>
|
||||
|
||||
<update id="updateExecStatus">
|
||||
UPDATE rk_bill
|
||||
SET exec_status = #{execStatus}
|
||||
WHERE bill_no = #{billNo}
|
||||
</update>
|
||||
|
||||
<!-- ==================== Delete ==================== -->
|
||||
<delete id="deleteRkBillById" parameterType="Long">
|
||||
DELETE FROM rk_bill WHERE id = #{id}
|
||||
|
||||
@@ -103,6 +103,8 @@
|
||||
<include refid="selectRkInfoVo"/>
|
||||
<where>
|
||||
ri.exec_status = 1
|
||||
AND ri.is_chuku = 0
|
||||
AND ri.is_delete = 0
|
||||
<if test="operationType != null and operationType != ''">
|
||||
AND ri.operation_type LIKE CONCAT('%', #{operationType}, '%')
|
||||
</if>
|
||||
@@ -159,16 +161,44 @@
|
||||
WHERE ri.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="countByBillNo" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM rk_info
|
||||
WHERE bill_no = #{billNo}
|
||||
</select>
|
||||
|
||||
<select id="countNotPreByIds" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM rk_info
|
||||
WHERE id IN
|
||||
<foreach collection="rkInfoIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND exec_status != '0'
|
||||
</select>
|
||||
|
||||
<select id="selectRkInfoByIds"
|
||||
parameterType="java.util.List"
|
||||
resultMap="RkInfoResult">
|
||||
SELECT
|
||||
ri.*
|
||||
FROM rk_info ri
|
||||
WHERE ri.id IN
|
||||
<foreach collection="rkInfoIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- ========================= 删除 ========================= -->
|
||||
<delete id="deleteRkInfoById" parameterType="Long">
|
||||
DELETE FROM rk_info WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRkInfoByIds" parameterType="java.util.List">
|
||||
<delete id="deleteRkInfoByIds">
|
||||
DELETE FROM rk_info
|
||||
WHERE id IN
|
||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
@@ -277,4 +307,27 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateRealQtyById">
|
||||
update rk_info
|
||||
set real_qty = #{realQty},
|
||||
update_time = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateIsChukuById">
|
||||
update rk_info
|
||||
set is_chuku = #{isChuku},
|
||||
update_time = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateBorrowReturn">
|
||||
UPDATE rk_info
|
||||
SET is_borrowed = #{isBorrowed},
|
||||
return_time = #{returnTime},
|
||||
update_time = NOW()
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -119,9 +119,21 @@
|
||||
<select id="selectRkRecordList" parameterType="RkRecord" resultMap="RkRecordResult">
|
||||
<include refid="selectRkRecordVo"/>
|
||||
<where>
|
||||
AND rr.exec_status = '1'
|
||||
<if test="operationType != null and operationType != ''">
|
||||
AND rr.operation_type = #{operationType}
|
||||
</if>
|
||||
<!-- 多 bizType -->
|
||||
<if test="bizTypeList != null and bizTypeList.size > 0">
|
||||
AND rb.biz_type IN
|
||||
<foreach collection="bizTypeList"
|
||||
item="bt"
|
||||
open="("
|
||||
separator=","
|
||||
close=")">
|
||||
#{bt}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="bizType != null and bizType != ''">
|
||||
AND rr.biz_type = #{bizType}
|
||||
</if>
|
||||
@@ -198,7 +210,7 @@
|
||||
AND rr.operation_time <= #{endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY rr.operation_time DESC
|
||||
ORDER BY rr.exec_status = '0' DESC, rr.operation_time DESC
|
||||
</select>
|
||||
|
||||
<!-- ===================== 按 ID 查询 ===================== -->
|
||||
@@ -212,7 +224,7 @@
|
||||
<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
|
||||
ORDER BY rr.exec_status = '0' DESC, rr.operation_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectRkRecordByIds" resultMap="RkRecordResult">
|
||||
@@ -224,6 +236,38 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="countByBillNo" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM rk_record
|
||||
WHERE bill_no = #{billNo}
|
||||
</select>
|
||||
|
||||
<select id="countPreByBillNo" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM rk_record
|
||||
WHERE bill_no = #{billNo}
|
||||
AND biz_type = '0'
|
||||
AND exec_status = '0'
|
||||
AND is_delete = '0';
|
||||
</select>
|
||||
<select id="countPreOutByBillNo" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||
SELECT COUNT(1)
|
||||
FROM rk_record
|
||||
WHERE bill_no = #{billNo}
|
||||
AND biz_type = '1'
|
||||
AND exec_status = '0'
|
||||
AND is_delete = '0';
|
||||
</select>
|
||||
|
||||
<select id="selectRkRecordByRkInfoId" resultMap="RkRecordResult">
|
||||
SELECT *
|
||||
FROM rk_record
|
||||
WHERE rk_info_id = #{rkInfoId}
|
||||
AND (is_delete = '0' OR is_delete = 0 OR is_delete IS NULL)
|
||||
ORDER BY operation_time DESC, id DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- ===================== 新增 ===================== -->
|
||||
<insert id="insertRkRecord"
|
||||
parameterType="RkRecord"
|
||||
|
||||
Reference in New Issue
Block a user