库存模块功能开发
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>
|
||||
|
||||
Reference in New Issue
Block a user