<?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.JcxxTsgjMapper">
    
    <resultMap type="JcxxTsgj" id="JcxxTsgjResult">
        <result property="id"    column="id"    />
        <result property="gjmc"    column="gjmc"    />
        <result property="ggxh"    column="ggxh"    />
        <result property="syzn"    column="syzn"    />
    </resultMap>

    <sql id="selectJcxxTsgjVo">
        select id, gjmc, ggxh, syzn from jcxx_tsgj
    </sql>

    <select id="selectJcxxTsgjList" parameterType="JcxxTsgj" resultMap="JcxxTsgjResult">
        <include refid="selectJcxxTsgjVo"/>
        <where>  
            <if test="gjmc != null  and gjmc != ''"> and gjmc = #{gjmc}</if>
            <if test="ggxh != null  and ggxh != ''"> and ggxh = #{ggxh}</if>
            <if test="syzn != null  and syzn != ''"> and syzn = #{syzn}</if>
        </where>
    </select>
    
    <select id="selectJcxxTsgjById" parameterType="Long" resultMap="JcxxTsgjResult">
        <include refid="selectJcxxTsgjVo"/>
        where id = #{id}
    </select>

    <insert id="insertJcxxTsgj" parameterType="JcxxTsgj" useGeneratedKeys="true" keyProperty="id">
        insert into jcxx_tsgj
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="gjmc != null">gjmc,</if>
            <if test="ggxh != null">ggxh,</if>
            <if test="syzn != null">syzn,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="gjmc != null">#{gjmc},</if>
            <if test="ggxh != null">#{ggxh},</if>
            <if test="syzn != null">#{syzn},</if>
         </trim>
    </insert>

    <update id="updateJcxxTsgj" parameterType="JcxxTsgj">
        update jcxx_tsgj
        <trim prefix="SET" suffixOverrides=",">
            <if test="gjmc != null">gjmc = #{gjmc},</if>
            <if test="ggxh != null">ggxh = #{ggxh},</if>
            <if test="syzn != null">syzn = #{syzn},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteJcxxTsgjById" parameterType="Long">
        delete from jcxx_tsgj where id = #{id}
    </delete>

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