<?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.project.zjsgfa.mapper.JcxxHseMapper">
    
    <resultMap type="JcxxHse" id="JcxxHseResult">
        <result property="id"    column="id"    />
        <result property="hse"    column="hse"    />
        <result property="createdBy"    column="created_by"    />
        <result property="createdTime"    column="created_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="qk"    column="qk"    />
        <result property="mc"    column="mc"    />
    </resultMap>

    <sql id="selectJcxxHseVo">
        select id, qk,mc, hse, created_by, created_time, update_by, update_time from jcxx_hse
    </sql>

    <select id="selectJcxxHseList" parameterType="JcxxHse" resultMap="JcxxHseResult">
        <include refid="selectJcxxHseVo"/>
        <where>  
            <if test="qk != null  and qk != ''"> and qk = #{qk}</if>
            <if test="mc != null  and mc != ''"> and mc like  concat('%', #{mc}, '%')</if>
            <if test="hse != null  and hse != ''"> and hse = #{hse}</if>
            <if test="createdBy != null  and createdBy != ''"> and created_by = #{createdBy}</if>
            <if test="createdTime != null "> and created_time = #{createdTime}</if>
        </where>
    </select>
    
    <select id="selectJcxxHseById" parameterType="Long" resultMap="JcxxHseResult">
        <include refid="selectJcxxHseVo"/>
        where id = #{id}
    </select>

    <insert id="insertJcxxHse" parameterType="JcxxHse" useGeneratedKeys="true" keyProperty="id">
        insert into jcxx_hse
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="hse != null">hse,</if>
            <if test="createdBy != null">created_by,</if>
            <if test="createdTime != null">created_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="qk != null">qk,</if>
            <if test="mc != null">mc,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="hse != null">#{hse},</if>
            <if test="createdBy != null">#{createdBy},</if>
            <if test="createdTime != null">#{createdTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="qk != null">#{qk},</if>
            <if test="mc != null">#{mc},</if>
         </trim>
    </insert>

    <update id="updateJcxxHse" parameterType="JcxxHse">
        update jcxx_hse
        <trim prefix="SET" suffixOverrides=",">
            <if test="hse != null">hse = #{hse},</if>
            <if test="createdBy != null">created_by = #{createdBy},</if>
            <if test="createdTime != null">created_time = #{createdTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="qk != null">qk = #{qk},</if>
            <if test="mc != null">mc = #{mc},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteJcxxHseById" parameterType="Long">
        delete from jcxx_hse where id = #{id}
    </delete>

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