<?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.project.zcustom.mapper.employee.PlatEmployeeHealthChartMapper">
    
    <resultMap type="PlatEmployeeHealthChart" id="PlatEmployeeHealthChartResult">
        <result property="id"    column="id"    />
        <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="appOrg"    column="app_org"    />
        <result property="type"    column="type"    />
        <result property="januaryNum"    column="january_num"    />
        <result property="februaryNum"    column="february_num"    />
        <result property="marchNum"    column="march_num"    />
        <result property="aprilNum"    column="april_num"    />
        <result property="mayNum"    column="may_num"    />
        <result property="juneNum"    column="june_num"    />
        <result property="julyNum"    column="july_num"    />
        <result property="augustNum"    column="august_num"    />
        <result property="septemberNum"    column="september_num"    />
        <result property="octoberNum"    column="october_num"    />
        <result property="novemberNum"    column="november_num"    />
        <result property="decemberNum"    column="december_num"    />
    </resultMap>

    <sql id="selectPlatEmployeeHealthChartVo">
        select id, del_flag, create_by, create_time, update_by, update_time, app_org, type, january_num, february_num, march_num, april_num, may_num, june_num, july_num, august_num, september_num, october_num, november_num, december_num from large_plat_employee_health_chart
    </sql>

    <select id="selectPlatEmployeeHealthChartList" parameterType="PlatEmployeeHealthChart" resultMap="PlatEmployeeHealthChartResult">
        <include refid="selectPlatEmployeeHealthChartVo"/>
        <where>  
            <if test="appOrg != null  and appOrg != ''"> and app_org = #{appOrg}</if>
            <if test="type != null "> and type = #{type}</if>
            <if test="januaryNum != null "> and january_num = #{januaryNum}</if>
            <if test="februaryNum != null "> and february_num = #{februaryNum}</if>
            <if test="marchNum != null "> and march_num = #{marchNum}</if>
            <if test="aprilNum != null "> and april_num = #{aprilNum}</if>
            <if test="mayNum != null "> and may_num = #{mayNum}</if>
            <if test="juneNum != null "> and june_num = #{juneNum}</if>
            <if test="julyNum != null "> and july_num = #{julyNum}</if>
            <if test="augustNum != null "> and august_num = #{augustNum}</if>
            <if test="septemberNum != null "> and september_num = #{septemberNum}</if>
            <if test="octoberNum != null "> and october_num = #{octoberNum}</if>
            <if test="novemberNum != null "> and november_num = #{novemberNum}</if>
            <if test="decemberNum != null "> and december_num = #{decemberNum}</if>
        </where>
    </select>
    
    <select id="selectPlatEmployeeHealthChartById" parameterType="Long" resultMap="PlatEmployeeHealthChartResult">
        <include refid="selectPlatEmployeeHealthChartVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlatEmployeeHealthChart" parameterType="PlatEmployeeHealthChart" useGeneratedKeys="true" keyProperty="id">
        insert into large_plat_employee_health_chart
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <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="appOrg != null">app_org,</if>
            <if test="type != null">type,</if>
            <if test="januaryNum != null">january_num,</if>
            <if test="februaryNum != null">february_num,</if>
            <if test="marchNum != null">march_num,</if>
            <if test="aprilNum != null">april_num,</if>
            <if test="mayNum != null">may_num,</if>
            <if test="juneNum != null">june_num,</if>
            <if test="julyNum != null">july_num,</if>
            <if test="augustNum != null">august_num,</if>
            <if test="septemberNum != null">september_num,</if>
            <if test="octoberNum != null">october_num,</if>
            <if test="novemberNum != null">november_num,</if>
            <if test="decemberNum != null">december_num,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <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="appOrg != null">#{appOrg},</if>
            <if test="type != null">#{type},</if>
            <if test="januaryNum != null">#{januaryNum},</if>
            <if test="februaryNum != null">#{februaryNum},</if>
            <if test="marchNum != null">#{marchNum},</if>
            <if test="aprilNum != null">#{aprilNum},</if>
            <if test="mayNum != null">#{mayNum},</if>
            <if test="juneNum != null">#{juneNum},</if>
            <if test="julyNum != null">#{julyNum},</if>
            <if test="augustNum != null">#{augustNum},</if>
            <if test="septemberNum != null">#{septemberNum},</if>
            <if test="octoberNum != null">#{octoberNum},</if>
            <if test="novemberNum != null">#{novemberNum},</if>
            <if test="decemberNum != null">#{decemberNum},</if>
         </trim>
    </insert>

    <update id="updatePlatEmployeeHealthChart" parameterType="PlatEmployeeHealthChart">
        update large_plat_employee_health_chart
        <trim prefix="SET" suffixOverrides=",">
            <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="appOrg != null">app_org = #{appOrg},</if>
            <if test="type != null">type = #{type},</if>
            <if test="januaryNum != null">january_num = #{januaryNum},</if>
            <if test="februaryNum != null">february_num = #{februaryNum},</if>
            <if test="marchNum != null">march_num = #{marchNum},</if>
            <if test="aprilNum != null">april_num = #{aprilNum},</if>
            <if test="mayNum != null">may_num = #{mayNum},</if>
            <if test="juneNum != null">june_num = #{juneNum},</if>
            <if test="julyNum != null">july_num = #{julyNum},</if>
            <if test="augustNum != null">august_num = #{augustNum},</if>
            <if test="septemberNum != null">september_num = #{septemberNum},</if>
            <if test="octoberNum != null">october_num = #{octoberNum},</if>
            <if test="novemberNum != null">november_num = #{novemberNum},</if>
            <if test="decemberNum != null">december_num = #{decemberNum},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlatEmployeeHealthChartById" parameterType="Long">
        delete from large_plat_employee_health_chart where id = #{id}
    </delete>

    <delete id="deletePlatEmployeeHealthChartByIds" parameterType="String">
        delete from large_plat_employee_health_chart where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <delete id="reallyDeleteByWrapper">
        DELETE FROM large_plat_employee_health_chart ${ew.customSqlSegment}
    </delete>
</mapper>