<?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.sooka.system.mapper.TUParamspublicMapper">

    <resultMap type="TUParamspublic" id="TUParamspublicResult">
        <result property="id"    column="id"    />
        <result property="status"    column="status"    />
        <result property="remark"    column="remark"    />
        <result property="delFlag"    column="del_flag"    />
        <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="fieldEn"    column="field_en"    />
        <result property="fieldName"    column="field_name"    />
        <result property="fieldType"    column="field_type"    />
        <result property="maxLength"    column="max_length"    />
        <result property="isRequired"    column="is_required"    />
        <result property="pamsexplain"    column="pamsexplain"    />
        <result property="seq"    column="seq"    />
    </resultMap>

    <sql id="selectTUParamspublicVo">
        select id, status, remark, del_flag, create_by, create_time, update_by, update_time, field_en, field_name, field_type, max_length, is_required, pamsexplain, seq from t_u_paramspublic
    </sql>

    <select id="selectTUParamspublicList" parameterType="TUParamspublic" resultMap="TUParamspublicResult">
        <include refid="selectTUParamspublicVo"/>
        <where>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="fieldEn != null  and fieldEn != ''"> and field_en = #{fieldEn}</if>
            <if test="fieldName != null  and fieldName != ''"> and field_name like concat('%', #{fieldName}, '%')</if>
            <if test="fieldType != null  and fieldType != ''"> and field_type = #{fieldType}</if>
            <if test="maxLength != null "> and max_length = #{maxLength}</if>
            <if test="isRequired != null  and isRequired != ''"> and is_required = #{isRequired}</if>
            <if test="pamsexplain != null  and pamsexplain != ''"> and pamsexplain = #{pamsexplain}</if>
            <if test="seq != null "> and seq = #{seq}</if>
        </where>
        order by seq asc
    </select>

    <select id="selectTUParamspublicById" parameterType="String" resultMap="TUParamspublicResult">
        <include refid="selectTUParamspublicVo"/>
        where id = #{id}
    </select>

    <insert id="insertTUParamspublic" parameterType="TUParamspublic">
        insert into t_u_paramspublic
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="status != null">status,</if>
            <if test="remark != null">remark,</if>
            <if test="delFlag != null">del_flag,</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="fieldEn != null">field_en,</if>
            <if test="fieldName != null">field_name,</if>
            <if test="fieldType != null">field_type,</if>
            <if test="maxLength != null">max_length,</if>
            <if test="isRequired != null">is_required,</if>
            <if test="pamsexplain != null">pamsexplain,</if>
            <if test="seq != null">seq,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="status != null">#{status},</if>
            <if test="remark != null">#{remark},</if>
            <if test="delFlag != null">#{delFlag},</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="fieldEn != null">#{fieldEn},</if>
            <if test="fieldName != null">#{fieldName},</if>
            <if test="fieldType != null">#{fieldType},</if>
            <if test="maxLength != null">#{maxLength},</if>
            <if test="isRequired != null">#{isRequired},</if>
            <if test="pamsexplain != null">#{pamsexplain},</if>
            <if test="seq != null">#{seq},</if>
         </trim>
    </insert>

    <update id="updateTUParamspublic" parameterType="TUParamspublic">
        update t_u_paramspublic
        <trim prefix="SET" suffixOverrides=",">
            <if test="status != null">status = #{status},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</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="fieldEn != null">field_en = #{fieldEn},</if>
            <if test="fieldName != null">field_name = #{fieldName},</if>
            <if test="fieldType != null">field_type = #{fieldType},</if>
            <if test="maxLength != null">max_length = #{maxLength},</if>
            <if test="isRequired != null">is_required = #{isRequired},</if>
            <if test="pamsexplain != null">pamsexplain = #{pamsexplain},</if>
            <if test="seq != null">seq = #{seq},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTUParamspublicById" parameterType="String">
        delete from t_u_paramspublic where id = #{id}
    </delete>

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

</mapper>
