<?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.bonus.boot.manager.health.dao.SpecialPositionsDao">

    <select id="getList" resultType="com.bonus.boot.manager.health.entity.SpecialPositionsBean" parameterType="com.bonus.boot.manager.health.entity.SpecialPositionsBean">
        SELECT id,job_name as jobName,job_descrip as jobDescrip,job_hazard as jobHazard,phy_cycle as phyCycle,
        is_active as isActive,create_time as createTime,update_time as updateTime
        from pm_base_special_job
        where 1=1
        <if test="jobName !=null and jobName !=''">
          and job_name like concat ('%',#{jobName},'%')
        </if>
        and is_active = '1'
    </select>
    
    <insert id="addSpecialPost" parameterType="com.bonus.boot.manager.health.entity.SpecialPositionsBean">
        insert into  pm_base_special_job(job_name,job_descrip,job_hazard,phy_cycle,is_active) values (
        #{jobName},#{jobDescrip},#{jobHazard},#{phyCycle},'1'
        );
    </insert>

    <update id="modifySpecialPost" parameterType="com.bonus.boot.manager.health.entity.SpecialPositionsBean">
        update pm_base_special_job
        <set>
            <if test="jobName !=null and jobName !=''">
                job_name = #{jobName},
            </if>
            <if test="jobDescrip !=null and jobDescrip !=''">
                job_descrip = #{jobDescrip},
            </if>
            <if test="jobHazard !=null and jobHazard !=''">
                job_hazard = #{jobHazard},
            </if>
            <if test="phyCycle !=null and phyCycle !=''">
                phy_cycle = #{phyCycle},
            </if>

        </set>
        where id = #{id}
    </update>

    <update id="del" parameterType="com.bonus.boot.manager.health.entity.SpecialPositionsBean">
        update pm_base_special_job set is_active = '0' where  id = #{id}
    </update>
</mapper>

