<?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.TsyxclxxMapper">
    
    <resultMap type="Tsyxclxx" id="TsyxclxxResult">
        <result property="id"    column="id"    />
        <result property="tsyx"    column="tsyx"    />
        <result property="bcms"    column="bcms"    />
        <result property="sbfs"    column="sbfs"    />
        <result property="wt"    column="wt"    />
        <result property="yfcs"    column="yfcs"    />
        <result property="yjcs"    column="yjcs"    />
    </resultMap>

    <sql id="selectTsyxclxxVo">
        select id, tsyx, bcms, sbfs, wt, yfcs, yjcs from tsyxclxx
    </sql>

    <select id="selectTsyxclxxList" parameterType="Tsyxclxx" resultMap="TsyxclxxResult">
        <include refid="selectTsyxclxxVo"/>
        <where>  
            <if test="tsyx != null  and tsyx != ''"> and tsyx = #{tsyx}</if>
            <if test="bcms != null  and bcms != ''"> and bcms = #{bcms}</if>
            <if test="sbfs != null  and sbfs != ''"> and sbfs = #{sbfs}</if>
            <if test="wt != null  and wt != ''"> and wt = #{wt}</if>
            <if test="yfcs != null  and yfcs != ''"> and yfcs = #{yfcs}</if>
            <if test="yjcs != null  and yjcs != ''"> and yjcs = #{yjcs}</if>
            <if test="tsyxs!=null">
                and
                <foreach item="tsyx" collection="tsyxs"
                         open="(" separator=" or " close=")">
                    tsyx LIKE CONCAT(#{tsyx}, '%' )
                </foreach>
            </if>
        </where>
    </select>
    
    <select id="selectTsyxclxxById" parameterType="Long" resultMap="TsyxclxxResult">
        <include refid="selectTsyxclxxVo"/>
        where id = #{id}
    </select>

    <insert id="insertTsyxclxx" parameterType="Tsyxclxx" useGeneratedKeys="true" keyProperty="id">
        insert into tsyxclxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="tsyx != null">tsyx,</if>
            <if test="bcms != null">bcms,</if>
            <if test="sbfs != null">sbfs,</if>
            <if test="wt != null">wt,</if>
            <if test="yfcs != null">yfcs,</if>
            <if test="yjcs != null">yjcs,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="tsyx != null">#{tsyx},</if>
            <if test="bcms != null">#{bcms},</if>
            <if test="sbfs != null">#{sbfs},</if>
            <if test="wt != null">#{wt},</if>
            <if test="yfcs != null">#{yfcs},</if>
            <if test="yjcs != null">#{yjcs},</if>
         </trim>
    </insert>

    <update id="updateTsyxclxx" parameterType="Tsyxclxx">
        update tsyxclxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="tsyx != null">tsyx = #{tsyx},</if>
            <if test="bcms != null">bcms = #{bcms},</if>
            <if test="sbfs != null">sbfs = #{sbfs},</if>
            <if test="wt != null">wt = #{wt},</if>
            <if test="yfcs != null">yfcs = #{yfcs},</if>
            <if test="yjcs != null">yjcs = #{yjcs},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTsyxclxxById" parameterType="Long">
        delete from tsyxclxx where id = #{id}
    </delete>

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