<?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.SzxcZcssMapper">

    <resultMap type="SzxcZcss" id="SzxcZcssResult">
        <result property="id"    column="id"    />
        <result property="zcName"    column="zc_name"    />
        <result property="zcType"    column="zc_type"    />
        <result property="installDate"    column="install_date"    />
        <result property="fzr"    column="fzr"    />
        <result property="phone"    column="phone"    />
        <result property="address"    column="address"    />
        <result property="picture"    column="picture"    />
        <result property="xj"    column="xj"    />
        <result property="xjCycle"    column="xj_cycle"    />
        <result property="lastTime"    column="last_time"    />
        <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="selectSzxcZcssVo">
        select id, zc_name, zc_type, install_date, fzr, phone, address, picture, xj, xj_cycle, last_time, xj_start, xj_end, remark, create_by, create_time, update_by, update_time, dept_id, dept_name, user_id from szxc_zcss
    </sql>

    <select id="selectSzxcZcssList" parameterType="SzxcZcss" resultMap="SzxcZcssResult">
        <include refid="selectSzxcZcssVo"/>
        <where>
            <if test="zcName != null  and zcName != ''"> and zc_name like concat('%', #{zcName}, '%')</if>
            <if test="zcType != null  and zcType != ''"> and zc_type = #{zcType}</if>
            <if test="installDate != null "> and install_date = #{installDate}</if>
            <if test="fzr != null  and fzr != ''"> and fzr = #{fzr}</if>
            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="picture != null  and picture != ''"> and picture = #{picture}</if>
            <if test="xj != null  and xj != ''"> and xj = #{xj}</if>
            <if test="xjCycle != null "> and xj_cycle = #{xjCycle}</if>
            <if test="lastTime != null "> and last_time = #{lastTime}</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="selectSzxcZcssById" parameterType="Long" resultMap="SzxcZcssResult">
        <include refid="selectSzxcZcssVo"/>
        where id = #{id}
    </select>

    <insert id="insertSzxcZcss" parameterType="SzxcZcss" useGeneratedKeys="true" keyProperty="id">
        insert into szxc_zcss
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="zcName != null">zc_name,</if>
            <if test="zcType != null">zc_type,</if>
            <if test="installDate != null">install_date,</if>
            <if test="fzr != null">fzr,</if>
            <if test="phone != null">phone,</if>
            <if test="address != null">address,</if>
            <if test="picture != null">picture,</if>
            <if test="xj != null">xj,</if>
            <if test="xjCycle != null">xj_cycle,</if>
            <if test="lastTime != null">last_time,</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="zcName != null">#{zcName},</if>
            <if test="zcType != null">#{zcType},</if>
            <if test="installDate != null">#{installDate},</if>
            <if test="fzr != null">#{fzr},</if>
            <if test="phone != null">#{phone},</if>
            <if test="address != null">#{address},</if>
            <if test="picture != null">#{picture},</if>
            <if test="xj != null">#{xj},</if>
            <if test="xjCycle != null">#{xjCycle},</if>
            <if test="lastTime != null">#{lastTime},</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="updateSzxcZcss" parameterType="SzxcZcss">
        update szxc_zcss
        <trim prefix="SET" suffixOverrides=",">
            <if test="zcName != null">zc_name = #{zcName},</if>
            <if test="zcType != null">zc_type = #{zcType},</if>
            <if test="installDate != null">install_date = #{installDate},</if>
            <if test="fzr != null">fzr = #{fzr},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="address != null">address = #{address},</if>
            <if test="picture != null">picture = #{picture},</if>
            <if test="xj != null">xj = #{xj},</if>
            <if test="xjCycle != null">xj_cycle = #{xjCycle},</if>
            <if test="lastTime != null">last_time = #{lastTime},</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="deleteSzxcZcssById" parameterType="Long">
        delete from szxc_zcss where id = #{id}
    </delete>

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