<?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.engine.salary.mapper.siarchives.UfHrSbjsgzbMapper">
    <resultMap id="BaseResultMap" type="com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO">

        <result column="gjjjs" property="gjjjs" />
        <result column="glsx" property="glsx" />
        <result column="glxx" property="glxx" />
        <result column="gongshangjs" property="gongshangjs" />
        <result column="gw" property="gw" />
        <result column="gwfl" property="gwfl" />
        <result column="gzbs" property="gzbs" />
        <result column="id" property="id" />
        <result column="shengyujs" property="shengyujs" />
        <result column="shiyejs" property="shiyejs" />
        <result column="yanglaojs" property="yanglaojs" />
        <result column="yiliaojs" property="yiliaojs" />
    </resultMap>

    <!-- 表字段 -->
    <sql id="baseColumns">
          t.gjjjs
        , t.glsx
        , t.glxx
        , t.gongshangjs
        , t.gw
        , t.gwfl
        , t.gzbs
        , t.id
        , t.shengyujs
        , t.shiyejs
        , t.yanglaojs
        , t.yiliaojs
    </sql>

    <!-- 查询全部 -->
    <select id="listAll" resultMap="BaseResultMap">
        SELECT
        <include refid="baseColumns" />
        FROM uf_hr_sbjsgzb t
    </select>

    <!-- 根据主键获取单条记录 -->
    <select id="getById" resultMap="BaseResultMap" parameterType="Integer">
        SELECT
        <include refid="baseColumns" />
        FROM uf_hr_sbjsgzb t
        WHERE id = #{id}
    </select>

    <!-- 条件查询 -->
    <select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO">
        SELECT
        <include refid="baseColumns" />
        FROM uf_hr_sbjsgzb t
        WHERE 1 = 1

        <if test="gjjjs != null">
            AND gjjjs = #{gjjjs}
        </if>
        <if test="glsx != null">
            AND glsx = #{glsx}
        </if>
        <if test="glxx != null">
            AND glxx = #{glxx}
        </if>
        <if test="gongshangjs != null">
            AND gongshangjs = #{gongshangjs}
        </if>
        <if test="gw != null">
            AND gw = #{gw}
        </if>
        <if test="gwfl != null">
            AND gwfl = #{gwfl}
        </if>
        <if test="gzbs != null">
            AND gzbs = #{gzbs}
        </if>
        <if test="shengyujs != null">
            AND shengyujs = #{shengyujs}
        </if>
        <if test="shiyejs != null">
            AND shiyejs = #{shiyejs}
        </if>
        <if test="yanglaojs != null">
            AND yanglaojs = #{yanglaojs}
        </if>
        <if test="yiliaojs != null">
            AND yiliaojs = #{yiliaojs}
        </if>
        <if test="ids != null and ids.size()>0">
            AND id IN
            <foreach collection="ids" open="(" item="id" separator="," close=")">
                #{id}
            </foreach>
        </if>
        ORDER BY id DESC
    </select>


    <!-- 插入不为NULL的字段 -->
    <insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO">
        INSERT INTO uf_hr_sbjsgzb
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="gjjjs != null">
                gjjjs,
            </if>
            <if test="glsx != null">
                glsx,
            </if>
            <if test="glxx != null">
                glxx,
            </if>
            <if test="gongshangjs != null">
                gongshangjs,
            </if>
            <if test="gw != null">
                gw,
            </if>
            <if test="gwfl != null">
                gwfl,
            </if>
            <if test="gzbs != null">
                gzbs,
            </if>
            <if test="shengyujs != null">
                shengyujs,
            </if>
            <if test="shiyejs != null">
                shiyejs,
            </if>
            <if test="yanglaojs != null">
                yanglaojs,
            </if>
            <if test="yiliaojs != null">
                yiliaojs,
            </if>
        </trim>
        <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
            <if test="gjjjs != null" >
                #{gjjjs},
            </if>
            <if test="glsx != null" >
                #{glsx},
            </if>
            <if test="glxx != null" >
                #{glxx},
            </if>
            <if test="gongshangjs != null" >
                #{gongshangjs},
            </if>
            <if test="gw != null" >
                #{gw},
            </if>
            <if test="gwfl != null" >
                #{gwfl},
            </if>
            <if test="gzbs != null" >
                #{gzbs},
            </if>
            <if test="shengyujs != null" >
                #{shengyujs},
            </if>
            <if test="shiyejs != null" >
                #{shiyejs},
            </if>
            <if test="yanglaojs != null" >
                #{yanglaojs},
            </if>
            <if test="yiliaojs != null" >
                #{yiliaojs},
            </if>
        </trim>
    </insert>

    <!-- 更新,更新全部字段 -->
    <update id="update" parameterType="com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO">
        UPDATE uf_hr_sbjsgzb
        <set>
            gjjjs=#{gjjjs},
            glsx=#{glsx},
            glxx=#{glxx},
            gongshangjs=#{gongshangjs},
            gw=#{gw},
            gwfl=#{gwfl},
            gzbs=#{gzbs},
            shengyujs=#{shengyujs},
            shiyejs=#{shiyejs},
            yanglaojs=#{yanglaojs},
            yiliaojs=#{yiliaojs},
        </set>
        WHERE id = #{id}
    </update>


    <!-- 更新不为NULL的字段 -->
    <update id="updateIgnoreNull" parameterType="com.engine.salary.entity.siarchives.po.UfHrSbjsgzbPO">
        UPDATE uf_hr_sbjsgzb
        <set>
            <if test="gjjjs != null" >
                gjjjs=#{gjjjs},
            </if>
            <if test="glsx != null" >
                glsx=#{glsx},
            </if>
            <if test="glxx != null" >
                glxx=#{glxx},
            </if>
            <if test="gongshangjs != null" >
                gongshangjs=#{gongshangjs},
            </if>
            <if test="gw != null" >
                gw=#{gw},
            </if>
            <if test="gwfl != null" >
                gwfl=#{gwfl},
            </if>
            <if test="gzbs != null" >
                gzbs=#{gzbs},
            </if>
            <if test="shengyujs != null" >
                shengyujs=#{shengyujs},
            </if>
            <if test="shiyejs != null" >
                shiyejs=#{shiyejs},
            </if>
            <if test="yanglaojs != null" >
                yanglaojs=#{yanglaojs},
            </if>
            <if test="yiliaojs != null" >
                yiliaojs=#{yiliaojs},
            </if>
        </set>
        WHERE id = #{id}
    </update>


</mapper>