zhwl/zhwl-business/zhwl-statistics/target/classes/mapper/statistics/ZdyCheckSearchMapper.xml
2025-07-01 17:54:58 +08:00

124 lines
5.2 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.statistics.mapper.ZdyCheckSearchMapper">
<resultMap type="ZdyCheckSearch" id="ZdyCheckSearchResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="deptId" column="dept_id"/>
</resultMap>
<resultMap id="ZdyCheckSearchZdyCheckSearchInfoResult" type="ZdyCheckSearch" extends="ZdyCheckSearchResult">
<collection property="zdyCheckSearchInfoList" notNullColumn="sub_id" javaType="java.util.List"
resultMap="ZdyCheckSearchInfoResult"/>
</resultMap>
<resultMap type="ZdyCheckSearchInfo" id="ZdyCheckSearchInfoResult">
<result property="id" column="sub_id"/>
<result property="checkSearchId" column="sub_check_search_id"/>
<result property="checkSearchDict" column="sub_check_search_dict"/>
</resultMap>
<sql id="selectZdyCheckSearchVo">
select cs.id, cs.name, cs.create_time, cs.create_by, cs.update_time, cs.update_by, cs.dept_id
from zdy_check_search cs
</sql>
<select id="selectZdyCheckSearchList" parameterType="ZdyCheckSearch" resultMap="ZdyCheckSearchResult">
<include refid="selectZdyCheckSearchVo"/>
LEFT JOIN sys_dept d ON d.dept_id = cs.dept_id
<where>
<if test="name != null and name != ''">and cs.name = #{name}</if>
${params.dataScope}
</where>
</select>
<select id="selectZdyCheckSearchById" parameterType="Long" resultMap="ZdyCheckSearchZdyCheckSearchInfoResult">
select a.id,
a.name,
a.create_time,
a.create_by,
a.update_time,
a.update_by,
a.dept_id,
b.id as sub_id,
b.check_search_id as sub_check_search_id,
b.check_search_dict as sub_check_search_dict
from zdy_check_search a
left join zdy_check_search_info b on b.check_search_id = a.id
where a.id = #{id}
</select>
<insert id="insertZdyCheckSearch" parameterType="ZdyCheckSearch" useGeneratedKeys="true" keyProperty="id">
insert into zdy_check_search
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</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="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="deptId != null">#{deptId},</if>
</trim>
</insert>
<update id="updateZdyCheckSearch" parameterType="ZdyCheckSearch">
update zdy_check_search
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyCheckSearchById" parameterType="Long">
delete
from zdy_check_search
where id = #{id}
</delete>
<delete id="deleteZdyCheckSearchByIds" parameterType="String">
delete from zdy_check_search where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteZdyCheckSearchInfoByCheckSearchIds" parameterType="String">
delete from zdy_check_search_info where check_search_id in
<foreach item="checkSearchId" collection="array" open="(" separator="," close=")">
#{checkSearchId}
</foreach>
</delete>
<delete id="deleteZdyCheckSearchInfoByCheckSearchId" parameterType="Long">
delete
from zdy_check_search_info
where check_search_id = #{checkSearchId}
</delete>
<insert id="batchZdyCheckSearchInfo">
insert into zdy_check_search_info( id, check_search_id, check_search_dict) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.checkSearchId}, #{item.checkSearchDict})
</foreach>
</insert>
</mapper>