Files
zhwl/zhwl-wcsc/target/classes/mapper/wcsc/ZdyWcscDispatchMapper.xml
2025-07-01 17:54:58 +08:00

161 lines
5.6 KiB
XML

<?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">
<mapper namespace="com.zhwl.wcsc.mapper.ZdyWcscDispatchMapper">
<resultMap type="ZdyWcscDispatch" id="ZdyWcscDispatchResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="typeIds" column="type_ids"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="deletetime" column="deletetime"/>
<result property="templateName" column="templateName"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="deptId" column="dept_id"/>
</resultMap>
<sql id="selectZdyWcscDispatchVo">
SELECT wd.id,
wd.NAME,
wd.type,
wd.type_ids,
wd.create_time,
wd.update_time,
wd.deletetime,
(SELECT GROUP_CONCAT(exp.NAME)
FROM zdy_wcsc_dispatch_express exp
WHERE FIND_IN_SET(exp.id, wd.type_ids)) AS templateName,
wd.create_by,
wd.update_by,
wd.dept_id
FROM zdy_wcsc_dispatch wd
</sql>
<select id="selectZdyWcscDispatchList" parameterType="ZdyWcscDispatch" resultMap="ZdyWcscDispatchResult">
<include refid="selectZdyWcscDispatchVo"/>
LEFT JOIN sys_dept d ON d.dept_id = wd.dept_id
<where>
ISNULL(wd.deletetime)
<if test="name != null and name != ''">
and wd.name like concat('%', #{name}, '%')
</if>
<if test="type != null and type != ''">
and wd.type = #{type}
</if>
<if test="typeIds != null and typeIds != ''">
and wd.type_ids = #{typeIds}
</if>
${params.dataScope}
</where>
</select>
<select id="selectZdyWcscDispatchById" parameterType="Long"
resultMap="ZdyWcscDispatchResult">
<include refid="selectZdyWcscDispatchVo"/>
where wd.id = #{id}
</select>
<insert id="insertZdyWcscDispatch" parameterType="ZdyWcscDispatch" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_wcsc_dispatch
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,
</if>
<if test="type != null and type != ''">type,
</if>
<if test="typeIds != null">type_ids,
</if>
create_time,
<if test="deletetime != null">deletetime,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="deptId != null">dept_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},
</if>
<if test="type != null and type != ''">#{type},
</if>
<if test="typeIds != null">#{typeIds},
</if>
sysdate(),
<if test="deletetime != null">#{deletetime},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="deptId != null">#{deptId},
</if>
</trim>
</insert>
<update id="updateZdyWcscDispatch" parameterType="ZdyWcscDispatch">
update zdy_wcsc_dispatch
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name =
#{name},
</if>
<if test="type != null and type != ''">type =
#{type},
</if>
<if test="typeIds != null">type_ids =
#{typeIds},
</if>
update_time = sysdate(),
<if test="deletetime != null">deletetime =#{deletetime},</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="deptId != null">dept_id =
#{deptId},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyWcscDispatchById" parameterType="Long">
update zdy_wcsc_dispatch
set deletetime = sysdate()
where id = #{id}
</delete>
<delete id="deleteZdyWcscDispatchByIds" parameterType="String">
update zdy_wcsc_dispatch
set deletetime = sysdate() where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="deleteByDeptIds">
update zdy_wcsc_dispatch
set deletetime = sysdate() where dept_id in
<foreach item="deptId" collection="list" open="(" separator="," close=")">
#{deptId}
</foreach>
</update>
<select id="selectZdyWcscGoodsListByDispatchExpressIds" parameterType="Long" resultMap="ZdyWcscDispatchResult">
<include refid="selectZdyWcscDispatchVo"/>
<where>
ISNULL(wd.deletetime)
and
<foreach item="id" collection="array" open="(" separator="or" close=")">
find_in_set(#{id}, type_ids)
</foreach>
</where>
</select>
</mapper>