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

    <resultMap type="SzxcPlaceManage" id="SzxcPlaceManageResult">
        <result property="id"    column="id"    />
        <result property="csName"    column="cs_name"    />
        <result property="hyType"    column="hy_type"    />
        <result property="csType"    column="cs_type"    />
        <result property="csAddress"    column="cs_address"    />
        <result property="employeeNum"    column="employee_num"    />
        <result property="szyt"    column="szyt"    />
        <result property="fwType"    column="fw_type"    />
        <result property="frName"    column="fr_name"    />
        <result property="clDate"    column="cl_date"    />
        <result property="yyqx"    column="yyqx"    />
        <result property="tyshxyCode"    column="tyshxy_code"    />
        <result property="yyzzPicture"    column="yyzz_picture"    />
        <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="selectSzxcPlaceManageVo">
        select id, cs_name, hy_type, cs_type, cs_address, employee_num, szyt, fw_type, fr_name, cl_date, yyqx, tyshxy_code, yyzz_picture, remark, create_by, create_time, update_by, update_time, dept_id, dept_name, user_id from szxc_place_manage
    </sql>

    <select id="selectSzxcPlaceManageList" parameterType="SzxcPlaceManage" resultMap="SzxcPlaceManageResult">
        <include refid="selectSzxcPlaceManageVo"/> as p
        <where>
            <if test="csName != null  and csName != ''"> and cs_name like concat('%', #{csName}, '%')</if>
            <if test="hyType != null  and hyType != ''"> and hy_type = #{hyType}</if>
            <if test="csType != null  and csType != ''"> and cs_type = #{csType}</if>
            <if test="csAddress != null  and csAddress != ''"> and cs_address = #{csAddress}</if>
            <if test="employeeNum != null "> and employee_num = #{employeeNum}</if>
            <if test="szyt != null  and szyt != ''"> and szyt = #{szyt}</if>
            <if test="fwType != null  and fwType != ''"> and fw_type = #{fwType}</if>
            <if test="frName != null  and frName != ''"> and fr_name like concat('%', #{frName}, '%')</if>
            <if test="clDate != null "> and cl_date = #{clDate}</if>
            <if test="yyqx != null  and yyqx != ''"> and yyqx = #{yyqx}</if>
            <if test="tyshxyCode != null  and tyshxyCode != ''"> and tyshxy_code = #{tyshxyCode}</if>
            <if test="yyzzPicture != null  and yyzzPicture != ''"> and yyzz_picture = #{yyzzPicture}</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="selectSzxcPlaceManageById" parameterType="Long" resultMap="SzxcPlaceManageResult">
        <include refid="selectSzxcPlaceManageVo"/>
        where id = #{id}
    </select>

    <insert id="insertSzxcPlaceManage" parameterType="SzxcPlaceManage" useGeneratedKeys="true" keyProperty="id">
        insert into szxc_place_manage
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="csName != null">cs_name,</if>
            <if test="hyType != null">hy_type,</if>
            <if test="csType != null">cs_type,</if>
            <if test="csAddress != null">cs_address,</if>
            <if test="employeeNum != null">employee_num,</if>
            <if test="szyt != null">szyt,</if>
            <if test="fwType != null">fw_type,</if>
            <if test="frName != null">fr_name,</if>
            <if test="clDate != null">cl_date,</if>
            <if test="yyqx != null">yyqx,</if>
            <if test="tyshxyCode != null">tyshxy_code,</if>
            <if test="yyzzPicture != null">yyzz_picture,</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="csName != null">#{csName},</if>
            <if test="hyType != null">#{hyType},</if>
            <if test="csType != null">#{csType},</if>
            <if test="csAddress != null">#{csAddress},</if>
            <if test="employeeNum != null">#{employeeNum},</if>
            <if test="szyt != null">#{szyt},</if>
            <if test="fwType != null">#{fwType},</if>
            <if test="frName != null">#{frName},</if>
            <if test="clDate != null">#{clDate},</if>
            <if test="yyqx != null">#{yyqx},</if>
            <if test="tyshxyCode != null">#{tyshxyCode},</if>
            <if test="yyzzPicture != null">#{yyzzPicture},</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="updateSzxcPlaceManage" parameterType="SzxcPlaceManage">
        update szxc_place_manage
        <trim prefix="SET" suffixOverrides=",">
            <if test="csName != null">cs_name = #{csName},</if>
            <if test="hyType != null">hy_type = #{hyType},</if>
            <if test="csType != null">cs_type = #{csType},</if>
            <if test="csAddress != null">cs_address = #{csAddress},</if>
            <if test="employeeNum != null">employee_num = #{employeeNum},</if>
            <if test="szyt != null">szyt = #{szyt},</if>
            <if test="fwType != null">fw_type = #{fwType},</if>
            <if test="frName != null">fr_name = #{frName},</if>
            <if test="clDate != null">cl_date = #{clDate},</if>
            <if test="yyqx != null">yyqx = #{yyqx},</if>
            <if test="tyshxyCode != null">tyshxy_code = #{tyshxyCode},</if>
            <if test="yyzzPicture != null">yyzz_picture = #{yyzzPicture},</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="deleteSzxcPlaceManageById" parameterType="Long">
        delete from szxc_place_manage where id = #{id}
    </delete>

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