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

    <resultMap type="SzxcXcRecard" id="SzxcXcRecardResult">
        <result property="id"    column="id"    />
        <result property="xcName"    column="xc_name"    />
        <result property="submitDate"    column="submit_date"    />
        <result property="xcDate"    column="xc_date"    />
        <result property="type"    column="type"    />
        <result property="jmId"    column="jm_id"    />
        <result property="xcObj"    column="xc_obj"    />
        <result property="title"    column="title"    />
        <result property="picture"    column="picture"    />
        <result property="content"    column="content"    />
        <result property="flowPeople"    column="flow_people"    />
        <result property="reform"    column="reform"    />
        <result property="zgProgress"    column="zg_progress"    />
        <result property="xcStatus"    column="xc_status"    />
        <result property="auditDept"    column="audit_dept"    />
        <result property="auditDeptid"    column="audit_deptid"    />
        <result property="auditName"    column="audit_name"    />
        <result property="auditResult"    column="audit_result"    />
        <result property="auditReason"    column="audit_reason"    />
        <result property="shRemark"    column="sh_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="selectSzxcXcRecardVo">
        select id, xc_name, submit_date, xc_date, type, jm_id, xc_obj, title, picture, content, flow_people, reform, zg_progress, xc_status, audit_dept, audit_deptid, audit_name, audit_result, audit_reason, sh_remark, create_by, create_time, update_by, update_time, dept_id, dept_name, user_id from szxc_xc_recard
    </sql>

    <select id="selectSzxcXcRecardList" parameterType="SzxcXcRecard" resultMap="SzxcXcRecardResult">
        <include refid="selectSzxcXcRecardVo"/>  as x
        <where>
            <if test="xcName != null  and xcName != ''"> and xc_name like concat('%', #{xcName}, '%')</if>
            <if test="submitDate != null "> and submit_date = #{submitDate}</if>
            <if test="xcDate != null "> and xc_date = #{xcDate}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="jmId != null "> and jm_id = #{jmId}</if>
            <if test="xcObj != null  and xcObj != ''"> and xc_obj = #{xcObj}</if>
            <if test="title != null  and title != ''"> and title = #{title}</if>
            <if test="picture != null  and picture != ''"> and picture = #{picture}</if>
            <if test="content != null  and content != ''"> and content = #{content}</if>
            <if test="flowPeople != null  and flowPeople != ''"> and flow_people = #{flowPeople}</if>
            <if test="reform != null  and reform != ''"> and reform = #{reform}</if>
            <if test="zgProgress != null  and zgProgress != ''"> and zg_progress = #{zgProgress}</if>
            <if test="xcStatus != null  and xcStatus != ''"> and xc_status = #{xcStatus}</if>
            <if test="auditDept != null  and auditDept != ''"> and audit_dept = #{auditDept}</if>
            <if test="auditDeptid != null "> and audit_deptid = #{auditDeptid}</if>
            <if test="auditName != null  and auditName != ''"> and audit_name like concat('%', #{auditName}, '%')</if>
            <if test="auditResult != null  and auditResult != ''"> and audit_result = #{auditResult}</if>
            <if test="auditReason != null  and auditReason != ''"> and audit_reason = #{auditReason}</if>
            <if test="shRemark != null  and shRemark != ''"> and sh_remark = #{shRemark}</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>
            <!--数据范围过滤-->
            <if test="params.dataScope != null and params.dataScope != ''">
                ${params.dataScope}
            </if>
        </where>
    </select>

    <select id="selectSzxcXcRecardById" parameterType="Long" resultMap="SzxcXcRecardResult">
        <include refid="selectSzxcXcRecardVo"/>
        where id = #{id}
    </select>

    <insert id="insertSzxcXcRecard" parameterType="SzxcXcRecard" useGeneratedKeys="true" keyProperty="id">
        insert into szxc_xc_recard
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="xcName != null and xcName != ''">xc_name,</if>
            <if test="submitDate != null">submit_date,</if>
            <if test="xcDate != null">xc_date,</if>
            <if test="type != null">type,</if>
            <if test="jmId != null">jm_id,</if>
            <if test="xcObj != null">xc_obj,</if>
            <if test="title != null and title != ''">title,</if>
            <if test="picture != null">picture,</if>
            <if test="content != null">content,</if>
            <if test="flowPeople != null">flow_people,</if>
            <if test="reform != null">reform,</if>
            <if test="zgProgress != null">zg_progress,</if>
            <if test="xcStatus != null">xc_status,</if>
            <if test="auditDept != null">audit_dept,</if>
            <if test="auditDeptid != null">audit_deptid,</if>
            <if test="auditName != null">audit_name,</if>
            <if test="auditResult != null">audit_result,</if>
            <if test="auditReason != null">audit_reason,</if>
            <if test="shRemark != null">sh_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="xcName != null and xcName != ''">#{xcName},</if>
            <if test="submitDate != null">#{submitDate},</if>
            <if test="xcDate != null">#{xcDate},</if>
            <if test="type != null">#{type},</if>
            <if test="jmId != null">#{jmId},</if>
            <if test="xcObj != null">#{xcObj},</if>
            <if test="title != null and title != ''">#{title},</if>
            <if test="picture != null">#{picture},</if>
            <if test="content != null">#{content},</if>
            <if test="flowPeople != null">#{flowPeople},</if>
            <if test="reform != null">#{reform},</if>
            <if test="zgProgress != null">#{zgProgress},</if>
            <if test="xcStatus != null">#{xcStatus},</if>
            <if test="auditDept != null">#{auditDept},</if>
            <if test="auditDeptid != null">#{auditDeptid},</if>
            <if test="auditName != null">#{auditName},</if>
            <if test="auditResult != null">#{auditResult},</if>
            <if test="auditReason != null">#{auditReason},</if>
            <if test="shRemark != null">#{shRemark},</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="updateSzxcXcRecard" parameterType="SzxcXcRecard">
        update szxc_xc_recard
        <trim prefix="SET" suffixOverrides=",">
            <if test="xcName != null and xcName != ''">xc_name = #{xcName},</if>
            <if test="submitDate != null">submit_date = #{submitDate},</if>
            <if test="xcDate != null">xc_date = #{xcDate},</if>
            <if test="type != null">type = #{type},</if>
            <if test="jmId != null">jm_id = #{jmId},</if>
            <if test="xcObj != null">xc_obj = #{xcObj},</if>
            <if test="title != null and title != ''">title = #{title},</if>
            <if test="picture != null">picture = #{picture},</if>
            <if test="content != null">content = #{content},</if>
            <if test="flowPeople != null">flow_people = #{flowPeople},</if>
            <if test="reform != null">reform = #{reform},</if>
            <if test="zgProgress != null">zg_progress = #{zgProgress},</if>
            <if test="xcStatus != null">xc_status = #{xcStatus},</if>
            <if test="auditDept != null">audit_dept = #{auditDept},</if>
            <if test="auditDeptid != null">audit_deptid = #{auditDeptid},</if>
            <if test="auditName != null">audit_name = #{auditName},</if>
            <if test="auditResult != null">audit_result = #{auditResult},</if>
            <if test="auditReason != null">audit_reason = #{auditReason},</if>
            <if test="shRemark != null">sh_remark = #{shRemark},</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="deleteSzxcXcRecardById" parameterType="Long">
        delete from szxc_xc_recard where id = #{id}
    </delete>

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