Files
smart_management_dev/src/main/resources/mybatis/information/PcdeDetailMapper.xml

146 lines
6.8 KiB
XML
Raw Normal View History

2025-05-30 16:13:27 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
2025-07-10 08:40:36 +08:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2025-05-30 16:13:27 +08:00
<mapper namespace="com.zg.project.information.mapper.PcdeDetailMapper">
2025-07-10 08:40:36 +08:00
2025-07-24 14:19:42 +08:00
2025-05-30 16:13:27 +08:00
<resultMap type="PcdeDetail" id="PcdeDetailResult">
2025-07-24 14:19:42 +08:00
<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"/>
2025-05-30 16:13:27 +08:00
</resultMap>
<sql id="selectPcdeDetailVo">
2025-07-24 14:19:42 +08:00
select d.id, d.pcode, d.scene, m.scene_name, d.warehouse, w.warehouse_name,
2025-05-30 16:13:27 +08:00
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
2025-07-24 14:19:42 +08:00
left join warehouse_info w on d.warehouse = w.warehouse_code
2025-05-30 16:13:27 +08:00
</sql>
<select id="selectPcdeDetailList" parameterType="PcdeDetail" resultMap="PcdeDetailResult">
<include refid="selectPcdeDetailVo"/>
<where>
2025-07-10 08:40:36 +08:00
<if test="pcode != null and pcode != ''">and d.pcode = #{pcode}</if>
<if test="scene != null and scene != ''">and d.scene = #{scene}</if>
<if test="warehouse != null and warehouse != ''">and d.warehouse = #{warehouse}</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>
<if test="createdBy != null and createdBy != ''">and d.created_by = #{createdBy}</if>
<if test="createdAt != null">and d.created_at = #{createdAt}</if>
<if test="updatedBy != null and updatedBy != ''">and d.updated_by = #{updatedBy}</if>
<if test="updatedAt != null">and d.updated_at = #{updatedAt}</if>
2025-05-30 16:13:27 +08:00
</where>
</select>
2025-09-15 09:56:24 +08:00
<select id="selectPcdeDetailListIds" parameterType="PcdeDetail" resultMap="PcdeDetailResult">
<include refid="selectPcdeDetailVo"/>
<where>
<choose>
<when test="ids != null and ids.size > 0">
AND d.id IN
<foreach collection="ids" item="val" open="(" separator="," close=")">
#{val}
</foreach>
</when>
</choose>
</where>
</select>
2025-05-30 16:13:27 +08:00
<select id="selectPcdeDetailById" parameterType="Long" resultMap="PcdeDetailResult">
<include refid="selectPcdeDetailVo"/>
where d.id = #{id}
</select>
2025-07-10 08:40:36 +08:00
<select id="selectByPcode" resultType="com.zg.project.information.domain.PcdeDetail"
2025-05-30 16:13:27 +08:00
parameterType="java.lang.String">
2025-07-10 08:40:36 +08:00
select id, pcode, scene, warehouse, encoded_id, tag, is_delete,
2025-05-30 16:13:27 +08:00
created_by, created_at, updated_by, updated_at, remark
from pcde_detail
2025-07-10 08:40:36 +08:00
where pcode = #{pcode}
2025-07-24 14:19:42 +08:00
AND is_delete = '0'
2025-05-30 16:13:27 +08:00
</select>
2025-09-16 15:23:04 +08:00
<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>
2025-05-30 16:13:27 +08:00
<insert id="insertPcdeDetail" parameterType="PcdeDetail" useGeneratedKeys="true" keyProperty="id">
insert into pcde_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
2025-07-10 08:40:36 +08:00
<if test="pcode != null and pcode != ''">pcode,</if>
2025-05-30 16:13:27 +08:00
<if test="scene != null and scene != ''">scene,</if>
<if test="warehouse != null and warehouse != ''">warehouse,</if>
<if test="encodedId != null">encoded_id,</if>
<if test="tag != null">tag,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="isDelete != null">is_delete,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedAt != null">updated_at,</if>
2025-07-10 08:40:36 +08:00
</trim>
2025-05-30 16:13:27 +08:00
<trim prefix="values (" suffix=")" suffixOverrides=",">
2025-07-10 08:40:36 +08:00
<if test="pcode != null and pcode != ''">#{pcode},</if>
2025-05-30 16:13:27 +08:00
<if test="scene != null and scene != ''">#{scene},</if>
<if test="warehouse != null and warehouse != ''">#{warehouse},</if>
<if test="encodedId != null">#{encodedId},</if>
<if test="tag != null">#{tag},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedAt != null">#{updatedAt},</if>
2025-07-10 08:40:36 +08:00
</trim>
2025-05-30 16:13:27 +08:00
</insert>
<update id="updatePcdeDetail" parameterType="PcdeDetail">
update pcde_detail
<trim prefix="SET" suffixOverrides=",">
2025-07-10 08:40:36 +08:00
<if test="pcode != null and pcode != ''">pcode = #{pcode},</if>
2025-05-30 16:13:27 +08:00
<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>
</trim>
where id = #{id}
</update>
<delete id="deletePcdeDetailById" parameterType="Long">
delete from pcde_detail where id = #{id}
</delete>
<delete id="deletePcdeDetailByIds" parameterType="String">
2025-07-10 08:40:36 +08:00
delete from pcde_detail where id in
2025-05-30 16:13:27 +08:00
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
2025-09-16 15:23:04 +08:00
2025-07-10 08:40:36 +08:00
</mapper>