仓库信息字段更新1212
This commit is contained in:
@@ -4,53 +4,96 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zg.project.information.mapper.PcdeDetailMapper">
|
||||
|
||||
<!-- ==================== 通用结果映射 ==================== -->
|
||||
<resultMap type="PcdeDetail" id="PcdeDetailResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="pcode" column="pcode"/>
|
||||
<result property="scene" column="scene"/>
|
||||
<result property="sceneName" column="scene_name"/>
|
||||
<result property="warehouse" column="warehouse"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
<result property="encodedId" column="encoded_id"/>
|
||||
<result property="tag" column="tag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="isDelete" column="is_delete"/>
|
||||
<result property="createdBy" column="created_by"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
<result property="updatedBy" column="updated_by"/>
|
||||
<result property="updatedAt" column="updated_at"/>
|
||||
<result property="id" column="id"/>
|
||||
<result property="pcode" column="pcode"/>
|
||||
<result property="scene" column="scene"/>
|
||||
<result property="sceneName" column="scene_name"/>
|
||||
|
||||
<result property="parentWarehouseCode" column="parent_warehouse_code"/>
|
||||
<result property="parentWarehouseName" column="parent_warehouse_name"/>
|
||||
<result property="warehouseCode" column="warehouse_code"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
|
||||
<result property="encodedId" column="encoded_id"/>
|
||||
<result property="tag" column="tag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="isDelete" column="is_delete"/>
|
||||
<result property="createdBy" column="created_by"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
<result property="updatedBy" column="updated_by"/>
|
||||
<result property="updatedAt" column="updated_at"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 公共 SELECT 片段:带场景名称 -->
|
||||
<sql id="selectPcdeDetailVo">
|
||||
select d.id, d.pcode, d.scene, m.scene_name, d.warehouse, w.warehouse_name,
|
||||
d.encoded_id, d.tag, d.remark, d.is_delete,
|
||||
d.created_by, d.created_at, d.updated_by, d.updated_at
|
||||
from pcde_detail d
|
||||
left join scene_mapping m on d.scene = m.scene_code
|
||||
left join warehouse_info w on d.warehouse = w.warehouse_code
|
||||
SELECT
|
||||
d.id,
|
||||
d.pcode,
|
||||
d.scene,
|
||||
m.scene_name,
|
||||
d.parent_warehouse_code,
|
||||
d.parent_warehouse_name,
|
||||
d.warehouse_code,
|
||||
d.warehouse_name,
|
||||
d.encoded_id,
|
||||
d.tag,
|
||||
d.remark,
|
||||
d.is_delete,
|
||||
d.created_by,
|
||||
d.created_at,
|
||||
d.updated_by,
|
||||
d.updated_at
|
||||
FROM pcde_detail d
|
||||
LEFT JOIN scene_mapping m ON d.scene = m.scene_code
|
||||
</sql>
|
||||
|
||||
<select id="selectPcdeDetailList" parameterType="PcdeDetail" resultMap="PcdeDetailResult">
|
||||
<!-- 列表查询 -->
|
||||
<select id="selectPcdeDetailList"
|
||||
parameterType="PcdeDetail"
|
||||
resultMap="PcdeDetailResult">
|
||||
<include refid="selectPcdeDetailVo"/>
|
||||
<where>
|
||||
<if test="pcode != null and pcode != ''">and d.pcode = #{pcode}</if>
|
||||
<if test="scene != null and scene != ''">and d.scene = #{scene}</if>
|
||||
<if test="pcode != null and pcode != ''">
|
||||
AND d.pcode = #{pcode}
|
||||
</if>
|
||||
<if test="scene != null and scene != ''">
|
||||
AND d.scene = #{scene}
|
||||
</if>
|
||||
|
||||
<!-- 按大仓 / 小仓过滤(可选) -->
|
||||
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
|
||||
AND d.parent_warehouse_code = #{parentWarehouseCode}
|
||||
</if>
|
||||
<if test="parentWarehouseName != null and parentWarehouseName != ''">
|
||||
AND d.parent_warehouse_name LIKE concat('%', #{parentWarehouseName}, '%')
|
||||
</if>
|
||||
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
AND d.warehouse_code = #{warehouseCode}
|
||||
</if>
|
||||
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
and w.warehouse_name like concat('%', #{warehouseName}, '%')
|
||||
AND d.warehouse_name LIKE concat('%', #{warehouseName}, '%')
|
||||
</if>
|
||||
|
||||
<if test="warehouse != null and warehouse != ''">
|
||||
and d.warehouse = #{warehouse}
|
||||
<if test="encodedId != null and encodedId != ''">
|
||||
AND d.encoded_id = #{encodedId}
|
||||
</if>
|
||||
<if test="tag != null and tag != ''">
|
||||
AND d.tag = #{tag}
|
||||
</if>
|
||||
<if test="isDelete != null">
|
||||
AND d.is_delete = #{isDelete}
|
||||
</if>
|
||||
|
||||
<if test="encodedId != null and encodedId != ''">and d.encoded_id = #{encodedId}</if>
|
||||
<if test="tag != null and tag != ''">and d.tag = #{tag}</if>
|
||||
<if test="isDelete != null">and d.is_delete = #{isDelete}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPcdeDetailListIds" parameterType="PcdeDetail" resultMap="PcdeDetailResult">
|
||||
<!-- 根据 ID 列表查询 -->
|
||||
<select id="selectPcdeDetailListIds"
|
||||
parameterType="PcdeDetail"
|
||||
resultMap="PcdeDetailResult">
|
||||
<include refid="selectPcdeDetailVo"/>
|
||||
<where>
|
||||
<choose>
|
||||
@@ -60,39 +103,108 @@
|
||||
#{val}
|
||||
</foreach>
|
||||
</when>
|
||||
|
||||
</choose>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPcdeDetailById" parameterType="Long" resultMap="PcdeDetailResult">
|
||||
<!-- 根据主键查询 -->
|
||||
<select id="selectPcdeDetailById"
|
||||
parameterType="Long"
|
||||
resultMap="PcdeDetailResult">
|
||||
<include refid="selectPcdeDetailVo"/>
|
||||
where d.id = #{id}
|
||||
WHERE d.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByPcode" resultType="com.zg.project.information.domain.PcdeDetail"
|
||||
<!-- 根据库位编码查询(不联表,直接取表字段) -->
|
||||
<select id="selectByPcode"
|
||||
resultType="com.zg.project.information.domain.PcdeDetail"
|
||||
parameterType="java.lang.String">
|
||||
select id, pcode, scene, warehouse, encoded_id, tag, is_delete,
|
||||
created_by, created_at, updated_by, updated_at, remark
|
||||
from pcde_detail
|
||||
where pcode = #{pcode}
|
||||
SELECT
|
||||
id,
|
||||
pcode,
|
||||
scene,
|
||||
parent_warehouse_code AS parentWarehouseCode,
|
||||
parent_warehouse_name AS parentWarehouseName,
|
||||
warehouse_code AS warehouseCode,
|
||||
warehouse_name AS warehouseName,
|
||||
encoded_id AS encodedId,
|
||||
tag,
|
||||
is_delete AS isDelete,
|
||||
created_by AS createdBy,
|
||||
created_at AS createdAt,
|
||||
updated_by AS UpdatedBy,
|
||||
updated_at AS updatedAt,
|
||||
remark
|
||||
FROM pcde_detail
|
||||
WHERE pcode = #{pcode}
|
||||
AND is_delete = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectEncodedIdByPcode" resultType="java.lang.String" parameterType="java.lang.String">
|
||||
select encoded_id
|
||||
from pcde_detail
|
||||
where pcode = #{pcode}
|
||||
<!-- 根据库位编码查编码后ID -->
|
||||
<select id="selectEncodedIdByPcode"
|
||||
resultType="java.lang.String"
|
||||
parameterType="java.lang.String">
|
||||
SELECT encoded_id
|
||||
FROM pcde_detail
|
||||
WHERE pcode = #{pcode}
|
||||
AND is_delete = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertPcdeDetail" parameterType="PcdeDetail" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pcde_detail
|
||||
<select id="selectByWarehouseCode" parameterType="String" resultMap="PcdeDetailResult">
|
||||
SELECT
|
||||
id,
|
||||
pcode,
|
||||
scene,
|
||||
parent_warehouse_code,
|
||||
parent_warehouse_name,
|
||||
warehouse_code,
|
||||
warehouse_name,
|
||||
encoded_id,
|
||||
tag,
|
||||
remark,
|
||||
is_delete,
|
||||
created_by,
|
||||
created_at,
|
||||
updated_by,
|
||||
updated_at
|
||||
FROM pcde_detail
|
||||
WHERE warehouse_code = #{warehouseCode}
|
||||
AND is_delete = '0'
|
||||
ORDER BY id ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据库位编码查所属小仓编码(小仓 warehouse_code) -->
|
||||
<select id="selectWarehouseCodeByPcode" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
SELECT warehouse_code
|
||||
FROM pcde_detail
|
||||
WHERE pcode = #{pcode}
|
||||
AND is_delete = '0'
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 单条插入 -->
|
||||
<insert id="insertPcdeDetail"
|
||||
parameterType="PcdeDetail"
|
||||
useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
INSERT INTO pcde_detail
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="pcode != null and pcode != ''">pcode,</if>
|
||||
<if test="scene != null and scene != ''">scene,</if>
|
||||
<if test="warehouse != null and warehouse != ''">warehouse,</if>
|
||||
|
||||
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
|
||||
parent_warehouse_code,
|
||||
</if>
|
||||
<if test="parentWarehouseName != null and parentWarehouseName != ''">
|
||||
parent_warehouse_name,
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
warehouse_code,
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
warehouse_name,
|
||||
</if>
|
||||
|
||||
<if test="encodedId != null">encoded_id,</if>
|
||||
<if test="tag != null">tag,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
@@ -102,10 +214,23 @@
|
||||
<if test="updatedBy != null">updated_by,</if>
|
||||
<if test="updatedAt != null">updated_at,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="pcode != null and pcode != ''">#{pcode},</if>
|
||||
<if test="scene != null and scene != ''">#{scene},</if>
|
||||
<if test="warehouse != null and warehouse != ''">#{warehouse},</if>
|
||||
|
||||
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
|
||||
#{parentWarehouseCode},
|
||||
</if>
|
||||
<if test="parentWarehouseName != null and parentWarehouseName != ''">
|
||||
#{parentWarehouseName},
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
#{warehouseCode},
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
#{warehouseName},
|
||||
</if>
|
||||
|
||||
<if test="encodedId != null">#{encodedId},</if>
|
||||
<if test="tag != null">#{tag},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
@@ -117,36 +242,85 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 更新 -->
|
||||
<update id="updatePcdeDetail" parameterType="PcdeDetail">
|
||||
update pcde_detail
|
||||
UPDATE pcde_detail
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="pcode != null and pcode != ''">pcode = #{pcode},</if>
|
||||
<if test="scene != null and scene != ''">scene = #{scene},</if>
|
||||
<if test="warehouse != null and warehouse != ''">warehouse = #{warehouse},</if>
|
||||
<if test="encodedId != null">encoded_id = #{encodedId},</if>
|
||||
<if test="tag != null">tag = #{tag},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="createdBy != null">created_by = #{createdBy},</if>
|
||||
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
|
||||
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||
<if test="pcode != null and pcode != ''">
|
||||
pcode = #{pcode},
|
||||
</if>
|
||||
<if test="scene != null and scene != ''">
|
||||
scene = #{scene},
|
||||
</if>
|
||||
|
||||
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
|
||||
parent_warehouse_code = #{parentWarehouseCode},
|
||||
</if>
|
||||
<if test="parentWarehouseName != null and parentWarehouseName != ''">
|
||||
parent_warehouse_name = #{parentWarehouseName},
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
warehouse_code = #{warehouseCode},
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
warehouse_name = #{warehouseName},
|
||||
</if>
|
||||
|
||||
<if test="encodedId != null">
|
||||
encoded_id = #{encodedId},
|
||||
</if>
|
||||
<if test="tag != null">
|
||||
tag = #{tag},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
<if test="isDelete != null">
|
||||
is_delete = #{isDelete},
|
||||
</if>
|
||||
<if test="createdBy != null">
|
||||
created_by = #{createdBy},
|
||||
</if>
|
||||
<if test="createdAt != null">
|
||||
created_at = #{createdAt},
|
||||
</if>
|
||||
<if test="updatedBy != null">
|
||||
updated_by = #{updatedBy},
|
||||
</if>
|
||||
<if test="updatedAt != null">
|
||||
updated_at = #{updatedAt},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 批量插入(存在则忽略),用于导入 -->
|
||||
<insert id="batchInsertIgnore">
|
||||
INSERT IGNORE INTO pcde_detail
|
||||
(pcode, scene, scene_name, warehouse, warehouse_name,
|
||||
encoded_id, tag, remark, is_delete,
|
||||
created_by, created_at, updated_by, updated_at)
|
||||
(pcode,
|
||||
scene,
|
||||
scene_name,
|
||||
parent_warehouse_code,
|
||||
parent_warehouse_name,
|
||||
warehouse_code,
|
||||
warehouse_name,
|
||||
encoded_id,
|
||||
tag,
|
||||
remark,
|
||||
is_delete,
|
||||
created_by,
|
||||
created_at,
|
||||
updated_by,
|
||||
updated_at)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.pcode},
|
||||
#{item.scene},
|
||||
#{item.sceneName},
|
||||
#{item.warehouse},
|
||||
#{item.parentWarehouseCode},
|
||||
#{item.parentWarehouseName},
|
||||
#{item.warehouseCode},
|
||||
#{item.warehouseName},
|
||||
#{item.encodedId},
|
||||
#{item.tag},
|
||||
@@ -160,12 +334,16 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 单条删除 -->
|
||||
<delete id="deletePcdeDetailById" parameterType="Long">
|
||||
delete from pcde_detail where id = #{id}
|
||||
DELETE FROM pcde_detail
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量删除 -->
|
||||
<delete id="deletePcdeDetailByIds" parameterType="String">
|
||||
delete from pcde_detail where id in
|
||||
DELETE FROM pcde_detail
|
||||
WHERE id IN
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
Reference in New Issue
Block a user