<?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.ruoyi.szxc.mapper.SzxcZcssxjMapper">
    
    <resultMap type="SzxcZcssxj" id="SzxcZcssxjResult">
        <result property="id"    column="id"    />
        <result property="zcssId"    column="zcss_id"    />
        <result property="zcName"    column="zc_name"    />
        <result property="xjName"    column="xj_name"    />
        <result property="phone"    column="phone"    />
        <result property="xjDate"    column="xj_date"    />
        <result property="title"    column="title"    />
        <result property="xjResult"    column="xj_result"    />
        <result property="xjExplain"    column="xj_explain"    />
        <result property="picture"    column="picture"    />
        <result property="xjStatus"    column="xj_status"    />
        <result property="xjStart"    column="xj_start"    />
        <result property="xjEnd"    column="xj_end"    />
        <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="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="userId"    column="user_id"    />
    </resultMap>

    <sql id="selectSzxcZcssxjVo">
        select id, zcss_id, zc_name, xj_name, phone, xj_date, title, xj_result, xj_explain, picture, xj_status, xj_start, xj_end, remark, create_by, create_time, update_by, update_time, dept_id, dept_name, user_id from szxc_zcssxj
    </sql>

    <select id="selectSzxcZcssxjList" parameterType="SzxcZcssxj" resultMap="SzxcZcssxjResult">
        <include refid="selectSzxcZcssxjVo"/>
        <where>  
            <if test="zcssId != null "> and zcss_id = #{zcssId}</if>
            <if test="zcName != null  and zcName != ''"> and zc_name like concat('%', #{zcName}, '%')</if>
            <if test="xjName != null  and xjName != ''"> and xj_name like concat('%', #{xjName}, '%')</if>
            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
            <if test="xjDate != null "> and xj_date = #{xjDate}</if>
            <if test="title != null  and title != ''"> and title = #{title}</if>
            <if test="xjResult != null  and xjResult != ''"> and xj_result = #{xjResult}</if>
            <if test="xjExplain != null  and xjExplain != ''"> and xj_explain = #{xjExplain}</if>
            <if test="picture != null  and picture != ''"> and picture = #{picture}</if>
            <if test="xjStatus != null  and xjStatus != ''"> and xj_status = #{xjStatus}</if>
            <if test="xjStart != null "> and xj_start = #{xjStart}</if>
            <if test="xjEnd != null "> and xj_end = #{xjEnd}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
            <if test="userId != null "> and user_id = #{userId}</if>
        </where>
    </select>
    
    <select id="selectSzxcZcssxjById" parameterType="Long" resultMap="SzxcZcssxjResult">
        <include refid="selectSzxcZcssxjVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSzxcZcssxj" parameterType="SzxcZcssxj" useGeneratedKeys="true" keyProperty="id">
        insert into szxc_zcssxj
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="zcssId != null">zcss_id,</if>
            <if test="zcName != null">zc_name,</if>
            <if test="xjName != null">xj_name,</if>
            <if test="phone != null">phone,</if>
            <if test="xjDate != null">xj_date,</if>
            <if test="title != null">title,</if>
            <if test="xjResult != null">xj_result,</if>
            <if test="xjExplain != null">xj_explain,</if>
            <if test="picture != null">picture,</if>
            <if test="xjStatus != null">xj_status,</if>
            <if test="xjStart != null">xj_start,</if>
            <if test="xjEnd != null">xj_end,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="deptName != null">dept_name,</if>
            <if test="userId != null">user_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="zcssId != null">#{zcssId},</if>
            <if test="zcName != null">#{zcName},</if>
            <if test="xjName != null">#{xjName},</if>
            <if test="phone != null">#{phone},</if>
            <if test="xjDate != null">#{xjDate},</if>
            <if test="title != null">#{title},</if>
            <if test="xjResult != null">#{xjResult},</if>
            <if test="xjExplain != null">#{xjExplain},</if>
            <if test="picture != null">#{picture},</if>
            <if test="xjStatus != null">#{xjStatus},</if>
            <if test="xjStart != null">#{xjStart},</if>
            <if test="xjEnd != null">#{xjEnd},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="deptName != null">#{deptName},</if>
            <if test="userId != null">#{userId},</if>
         </trim>
    </insert>

    <update id="updateSzxcZcssxj" parameterType="SzxcZcssxj">
        update szxc_zcssxj
        <trim prefix="SET" suffixOverrides=",">
            <if test="zcssId != null">zcss_id = #{zcssId},</if>
            <if test="zcName != null">zc_name = #{zcName},</if>
            <if test="xjName != null">xj_name = #{xjName},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="xjDate != null">xj_date = #{xjDate},</if>
            <if test="title != null">title = #{title},</if>
            <if test="xjResult != null">xj_result = #{xjResult},</if>
            <if test="xjExplain != null">xj_explain = #{xjExplain},</if>
            <if test="picture != null">picture = #{picture},</if>
            <if test="xjStatus != null">xj_status = #{xjStatus},</if>
            <if test="xjStart != null">xj_start = #{xjStart},</if>
            <if test="xjEnd != null">xj_end = #{xjEnd},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="deptName != null">dept_name = #{deptName},</if>
            <if test="userId != null">user_id = #{userId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSzxcZcssxjById" parameterType="Long">
        delete from szxc_zcssxj where id = #{id}
    </delete>

    <delete id="deleteSzxcZcssxjByIds" parameterType="String">
        delete from szxc_zcssxj where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>