<?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.goafanti.common.dao.PersonnelLevelMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.PersonnelLevel">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="jobs" jdbcType="INTEGER" property="jobs" />
    <result column="lvl" jdbcType="INTEGER" property="lvl" />
    <result column="allowance" jdbcType="DECIMAL" property="allowance" />
    <result column="alive_rewards" jdbcType="DECIMAL" property="aliveRewards" />
    <result column="rewards" jdbcType="DECIMAL" property="rewards" />
    <result column="two_rewards" jdbcType="DECIMAL" property="twoRewards" />
    <result column="three_rewards" jdbcType="DECIMAL" property="threeRewards" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    id, jobs, lvl, allowance, alive_rewards, rewards, two_rewards, three_rewards, create_time
  </sql>
  <select id="selectByExample" parameterType="com.goafanti.common.model.PersonnelLevelExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from personnel_level
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    select 
    <include refid="Base_Column_List" />
    from personnel_level
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    delete from personnel_level
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.goafanti.common.model.PersonnelLevelExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    delete from personnel_level
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.PersonnelLevel">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    insert into personnel_level (id, jobs, lvl, 
      allowance, alive_rewards, rewards, 
      two_rewards, three_rewards, create_time
      )
    values (#{id,jdbcType=INTEGER}, #{jobs,jdbcType=INTEGER}, #{lvl,jdbcType=INTEGER}, 
      #{allowance,jdbcType=DECIMAL}, #{aliveRewards,jdbcType=DECIMAL}, #{rewards,jdbcType=DECIMAL}, 
      #{twoRewards,jdbcType=DECIMAL}, #{threeRewards,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.PersonnelLevel">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    insert into personnel_level
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="jobs != null">
        jobs,
      </if>
      <if test="lvl != null">
        lvl,
      </if>
      <if test="allowance != null">
        allowance,
      </if>
      <if test="aliveRewards != null">
        alive_rewards,
      </if>
      <if test="rewards != null">
        rewards,
      </if>
      <if test="twoRewards != null">
        two_rewards,
      </if>
      <if test="threeRewards != null">
        three_rewards,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="jobs != null">
        #{jobs,jdbcType=INTEGER},
      </if>
      <if test="lvl != null">
        #{lvl,jdbcType=INTEGER},
      </if>
      <if test="allowance != null">
        #{allowance,jdbcType=DECIMAL},
      </if>
      <if test="aliveRewards != null">
        #{aliveRewards,jdbcType=DECIMAL},
      </if>
      <if test="rewards != null">
        #{rewards,jdbcType=DECIMAL},
      </if>
      <if test="twoRewards != null">
        #{twoRewards,jdbcType=DECIMAL},
      </if>
      <if test="threeRewards != null">
        #{threeRewards,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.goafanti.common.model.PersonnelLevelExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    select count(*) from personnel_level
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    update personnel_level
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.jobs != null">
        jobs = #{record.jobs,jdbcType=INTEGER},
      </if>
      <if test="record.lvl != null">
        lvl = #{record.lvl,jdbcType=INTEGER},
      </if>
      <if test="record.allowance != null">
        allowance = #{record.allowance,jdbcType=DECIMAL},
      </if>
      <if test="record.aliveRewards != null">
        alive_rewards = #{record.aliveRewards,jdbcType=DECIMAL},
      </if>
      <if test="record.rewards != null">
        rewards = #{record.rewards,jdbcType=DECIMAL},
      </if>
      <if test="record.twoRewards != null">
        two_rewards = #{record.twoRewards,jdbcType=DECIMAL},
      </if>
      <if test="record.threeRewards != null">
        three_rewards = #{record.threeRewards,jdbcType=DECIMAL},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    update personnel_level
    set id = #{record.id,jdbcType=INTEGER},
      jobs = #{record.jobs,jdbcType=INTEGER},
      lvl = #{record.lvl,jdbcType=INTEGER},
      allowance = #{record.allowance,jdbcType=DECIMAL},
      alive_rewards = #{record.aliveRewards,jdbcType=DECIMAL},
      rewards = #{record.rewards,jdbcType=DECIMAL},
      two_rewards = #{record.twoRewards,jdbcType=DECIMAL},
      three_rewards = #{record.threeRewards,jdbcType=DECIMAL},
      create_time = #{record.createTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PersonnelLevel">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    update personnel_level
    <set>
      <if test="jobs != null">
        jobs = #{jobs,jdbcType=INTEGER},
      </if>
      <if test="lvl != null">
        lvl = #{lvl,jdbcType=INTEGER},
      </if>
      <if test="allowance != null">
        allowance = #{allowance,jdbcType=DECIMAL},
      </if>
      <if test="aliveRewards != null">
        alive_rewards = #{aliveRewards,jdbcType=DECIMAL},
      </if>
      <if test="rewards != null">
        rewards = #{rewards,jdbcType=DECIMAL},
      </if>
      <if test="twoRewards != null">
        two_rewards = #{twoRewards,jdbcType=DECIMAL},
      </if>
      <if test="threeRewards != null">
        three_rewards = #{threeRewards,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PersonnelLevel">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Apr 29 14:40:21 CST 2020.
    -->
    update personnel_level
    set jobs = #{jobs,jdbcType=INTEGER},
      lvl = #{lvl,jdbcType=INTEGER},
      allowance = #{allowance,jdbcType=DECIMAL},
      alive_rewards = #{aliveRewards,jdbcType=DECIMAL},
      rewards = #{rewards,jdbcType=DECIMAL},
      two_rewards = #{twoRewards,jdbcType=DECIMAL},
      three_rewards = #{threeRewards,jdbcType=DECIMAL},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
  
  <select id="selectAll" resultType="com.goafanti.personnel.bo.OutPersonnelLvlBo">
  select a.id,a.jobs,b.jobs_name jobsName,a.lvl,b.lvl_name lvlName ,a.allowance,a.alive_rewards aliveRewards,
	a.rewards ,a.two_rewards twoRewards,a.three_rewards threeRewards,a.create_time
	from personnel_level a left join admin_level b on a.jobs=b.jobs and a.lvl=b.lvl
  </select>
</mapper>