<?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.TGuijiHealthcommissionYyryxxMapper">
    
    <resultMap type="TGuijiHealthcommissionYyryxx" id="TGuijiHealthcommissionYyryxxResult">
        <result property="id"    column="id"    />
        <result property="createTime"    column="create_time"    />
        <result property="cdTime"    column="cd_time"    />
        <result property="cdBatch"    column="cd_batch"    />
        <result property="cdOperation"    column="cd_operation"    />
        <result property="cdSource"    column="cd_source"    />
        <result property="cardid"    column="cardid"    />
        <result property="persontype"    column="persontype"    />
        <result property="unitname"    column="unitname"    />
        <result property="username"    column="username"    />
        <result property="sex"    column="sex"    />
        <result property="age"    column="age"    />
        <result property="nature"    column="nature"    />
        <result property="education"    column="education"    />
        <result property="cellphone"    column="cellphone"    />
        <result property="worktype"    column="worktype"    />
        <result property="workage"    column="workage"    />
        <result property="unitnatrue"    column="unitnatrue"    />
        <result property="photourl"    column="photourl"    />
        <result property="licenseurl"    column="licenseurl"    />
        <result property="adddate"    column="adddate"    />
        <result property="apptime"    column="apptime"    />
    </resultMap>

    <sql id="selectTGuijiHealthcommissionYyryxxVo">
        select id, create_time, cd_time, cd_batch, cd_operation, cd_source, cardid, persontype, unitname, username, sex, age, nature, education, cellphone, worktype, workage, unitnatrue, photourl, licenseurl, adddate, apptime from t_guiji_healthcommission_yyryxx
    </sql>

    <select id="selectTGuijiHealthcommissionYyryxxList" parameterType="TGuijiHealthcommissionYyryxx" resultMap="TGuijiHealthcommissionYyryxxResult">
        <include refid="selectTGuijiHealthcommissionYyryxxVo"/>
        <where>  
            <if test="cardid != null  and cardid != ''"> and cardid = #{cardid}</if>
            <if test="username != null  and username != ''"> and username like concat('%', #{username}, '%')</if>
        </where>
        order by create_time desc
    </select>
    
    <select id="selectTGuijiHealthcommissionYyryxxById" parameterType="String" resultMap="TGuijiHealthcommissionYyryxxResult">
        <include refid="selectTGuijiHealthcommissionYyryxxVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTGuijiHealthcommissionYyryxx" parameterType="TGuijiHealthcommissionYyryxx">
        insert into t_guiji_healthcommission_yyryxx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="cdTime != null">cd_time,</if>
            <if test="cdBatch != null">cd_batch,</if>
            <if test="cdOperation != null">cd_operation,</if>
            <if test="cdSource != null">cd_source,</if>
            <if test="cardid != null">cardid,</if>
            <if test="persontype != null">persontype,</if>
            <if test="unitname != null">unitname,</if>
            <if test="username != null">username,</if>
            <if test="sex != null">sex,</if>
            <if test="age != null">age,</if>
            <if test="nature != null">nature,</if>
            <if test="education != null">education,</if>
            <if test="cellphone != null">cellphone,</if>
            <if test="worktype != null">worktype,</if>
            <if test="workage != null">workage,</if>
            <if test="unitnatrue != null">unitnatrue,</if>
            <if test="photourl != null">photourl,</if>
            <if test="licenseurl != null">licenseurl,</if>
            <if test="adddate != null">adddate,</if>
            <if test="apptime != null">apptime,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="cdTime != null">#{cdTime},</if>
            <if test="cdBatch != null">#{cdBatch},</if>
            <if test="cdOperation != null">#{cdOperation},</if>
            <if test="cdSource != null">#{cdSource},</if>
            <if test="cardid != null">#{cardid},</if>
            <if test="persontype != null">#{persontype},</if>
            <if test="unitname != null">#{unitname},</if>
            <if test="username != null">#{username},</if>
            <if test="sex != null">#{sex},</if>
            <if test="age != null">#{age},</if>
            <if test="nature != null">#{nature},</if>
            <if test="education != null">#{education},</if>
            <if test="cellphone != null">#{cellphone},</if>
            <if test="worktype != null">#{worktype},</if>
            <if test="workage != null">#{workage},</if>
            <if test="unitnatrue != null">#{unitnatrue},</if>
            <if test="photourl != null">#{photourl},</if>
            <if test="licenseurl != null">#{licenseurl},</if>
            <if test="adddate != null">#{adddate},</if>
            <if test="apptime != null">#{apptime},</if>
         </trim>
    </insert>

    <update id="updateTGuijiHealthcommissionYyryxx" parameterType="TGuijiHealthcommissionYyryxx">
        update t_guiji_healthcommission_yyryxx
        <trim prefix="SET" suffixOverrides=",">
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="cdTime != null">cd_time = #{cdTime},</if>
            <if test="cdBatch != null">cd_batch = #{cdBatch},</if>
            <if test="cdOperation != null">cd_operation = #{cdOperation},</if>
            <if test="cdSource != null">cd_source = #{cdSource},</if>
            <if test="cardid != null">cardid = #{cardid},</if>
            <if test="persontype != null">persontype = #{persontype},</if>
            <if test="unitname != null">unitname = #{unitname},</if>
            <if test="username != null">username = #{username},</if>
            <if test="sex != null">sex = #{sex},</if>
            <if test="age != null">age = #{age},</if>
            <if test="nature != null">nature = #{nature},</if>
            <if test="education != null">education = #{education},</if>
            <if test="cellphone != null">cellphone = #{cellphone},</if>
            <if test="worktype != null">worktype = #{worktype},</if>
            <if test="workage != null">workage = #{workage},</if>
            <if test="unitnatrue != null">unitnatrue = #{unitnatrue},</if>
            <if test="photourl != null">photourl = #{photourl},</if>
            <if test="licenseurl != null">licenseurl = #{licenseurl},</if>
            <if test="adddate != null">adddate = #{adddate},</if>
            <if test="apptime != null">apptime = #{apptime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTGuijiHealthcommissionYyryxxById" parameterType="String">
        delete from t_guiji_healthcommission_yyryxx where id = #{id}
    </delete>

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

</mapper>