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

    <resultMap type="SzxcLdInfo" id="SzxcLdInfoResult">
        <result property="id"    column="id"    />
        <result property="xqId"    column="xq_id"    />
        <result property="xqName"    column="xq_name"    />
        <result property="ldName"    column="ld_name"    />
        <result property="ldType"    column="ld_type"    />
        <result property="ldSort"    column="ld_sort"    />
        <result property="ldjg"    column="ldjg"    />
        <result property="qnfs"    column="qnfs"    />
        <result property="lcNum"    column="lc_num"    />
        <result property="unitNum"    column="unit_num"    />
        <result property="huNum"    column="hu_num"    />
        <result property="ldDescribe"    column="ld_describe"    />
        <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="selectSzxcLdInfoVo">
        select id, xq_id, xq_name, ld_name, ld_type, ld_sort, ldjg, qnfs, lc_num, unit_num, hu_num, ld_describe, create_by, create_time, update_by, update_time, dept_id, dept_name, user_id from szxc_ld_info
    </sql>

    <select id="selectSzxcLdInfoList" parameterType="SzxcLdInfo" resultMap="SzxcLdInfoResult">
        <include refid="selectSzxcLdInfoVo"/>
        <where>
            <if test="xqId != null "> and xq_id = #{xqId}</if>
            <if test="xqName != null  and xqName != ''"> and xq_name like concat('%', #{xqName}, '%')</if>
            <if test="ldName != null  and ldName != ''"> and ld_name like concat('%', #{ldName}, '%')</if>
            <if test="ldType != null  and ldType != ''"> and ld_type = #{ldType}</if>
            <if test="ldSort != null  and ldSort != ''"> and ld_sort = #{ldSort}</if>
            <if test="ldjg != null  and ldjg != ''"> and ldjg = #{ldjg}</if>
            <if test="qnfs != null  and qnfs != ''"> and qnfs = #{qnfs}</if>
            <if test="lcNum != null "> and lc_num = #{lcNum}</if>
            <if test="unitNum != null "> and unit_num = #{unitNum}</if>
            <if test="huNum != null "> and hu_num = #{huNum}</if>
            <if test="ldDescribe != null  and ldDescribe != ''"> and ld_describe = #{ldDescribe}</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="selectSzxcLdInfoById" parameterType="Long" resultMap="SzxcLdInfoResult">
        <include refid="selectSzxcLdInfoVo"/>
        where id = #{id}
    </select>

    <insert id="insertSzxcLdInfo" parameterType="SzxcLdInfo" useGeneratedKeys="true" keyProperty="id">
        insert into szxc_ld_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="xqId != null">xq_id,</if>
            <if test="xqName != null">xq_name,</if>
            <if test="ldName != null">ld_name,</if>
            <if test="ldType != null">ld_type,</if>
            <if test="ldSort != null">ld_sort,</if>
            <if test="ldjg != null">ldjg,</if>
            <if test="qnfs != null">qnfs,</if>
            <if test="lcNum != null">lc_num,</if>
            <if test="unitNum != null">unit_num,</if>
            <if test="huNum != null">hu_num,</if>
            <if test="ldDescribe != null">ld_describe,</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="xqId != null">#{xqId},</if>
            <if test="xqName != null">#{xqName},</if>
            <if test="ldName != null">#{ldName},</if>
            <if test="ldType != null">#{ldType},</if>
            <if test="ldSort != null">#{ldSort},</if>
            <if test="ldjg != null">#{ldjg},</if>
            <if test="qnfs != null">#{qnfs},</if>
            <if test="lcNum != null">#{lcNum},</if>
            <if test="unitNum != null">#{unitNum},</if>
            <if test="huNum != null">#{huNum},</if>
            <if test="ldDescribe != null">#{ldDescribe},</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="updateSzxcLdInfo" parameterType="SzxcLdInfo">
        update szxc_ld_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="xqId != null">xq_id = #{xqId},</if>
            <if test="xqName != null">xq_name = #{xqName},</if>
            <if test="ldName != null">ld_name = #{ldName},</if>
            <if test="ldType != null">ld_type = #{ldType},</if>
            <if test="ldSort != null">ld_sort = #{ldSort},</if>
            <if test="ldjg != null">ldjg = #{ldjg},</if>
            <if test="qnfs != null">qnfs = #{qnfs},</if>
            <if test="lcNum != null">lc_num = #{lcNum},</if>
            <if test="unitNum != null">unit_num = #{unitNum},</if>
            <if test="huNum != null">hu_num = #{huNum},</if>
            <if test="ldDescribe != null">ld_describe = #{ldDescribe},</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="deleteSzxcLdInfoById" parameterType="Long">
        delete from szxc_ld_info where id = #{id}
    </delete>

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