admin
2019-08-21 28a4a6aaa9a44d2cc989dd11cc86960104067a0b
fanli/src/main/java/com/yeshi/fanli/mapping/integral/IntegralTaskClassMapper.xml
@@ -2,7 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.integral.IntegralTaskClassMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.integral.IntegralTaskClass">
   <resultMap id="BaseResultMap"
      type="com.yeshi.fanli.entity.integral.IntegralTaskClass">
    <id column="tc_id" property="id" jdbcType="BIGINT"/>
    <result column="tc_name" property="name" jdbcType="VARCHAR"/>
    <result column="tc_picture" property="picture" jdbcType="VARCHAR"/>
@@ -18,13 +19,15 @@
    <result column="tc_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="tc_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
   
   <result column="tc_unique_key" property="uniqueKey" typeHandler="com.yeshi.fanli.util.mybatishandler.integral.UniqueKeyEnumHandler"/>
      <result column="tc_unique_key" property="uniqueKey"
         typeHandler="com.yeshi.fanli.util.mybatishandler.integral.UniqueKeyEnumHandler" />
   <association property="jumpDetail" column="tc_jump_id"
      select="com.yeshi.fanli.dao.mybatis.common.JumpDetailV2Mapper.selectByPrimaryKey">
   </association>
  </resultMap>
  
  <resultMap id="BaseResultVOMap" type="com.yeshi.fanli.vo.integral.IntegralTaskClassVO">
   <resultMap id="BaseResultVOMap"
      type="com.yeshi.fanli.vo.integral.IntegralTaskClassVO">
    <id column="tc_id" property="id" jdbcType="BIGINT"/>
    <result column="tc_name" property="name" jdbcType="VARCHAR"/>
    <result column="tc_picture" property="picture" jdbcType="VARCHAR"/>
@@ -43,19 +46,34 @@
   <result column="totalCoin" property="totalCoin" jdbcType="INTEGER"/>
   <result column="taskNum" property="taskNum" jdbcType="INTEGER"/>
   
   <result column="tc_unique_key" property="uniqueKey" typeHandler="com.yeshi.fanli.util.mybatishandler.integral.UniqueKeyEnumHandler"/>
      <result column="tc_unique_key" property="uniqueKey"
         typeHandler="com.yeshi.fanli.util.mybatishandler.integral.UniqueKeyEnumHandler" />
   <association property="jumpDetail" column="tc_jump_id"
      select="com.yeshi.fanli.dao.mybatis.common.JumpDetailV2Mapper.selectByPrimaryKey">
   </association>
  </resultMap>
  
  <sql id="Base_Column_List">tc_id,tc_name,tc_picture,tc_unique_key,tc_tip,tc_btn_name,tc_jump_id,tc_params,tc_rule_name,tc_rule,tc_rule_link,tc_progress,tc_orderby,tc_state,tc_create_time,tc_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_integral_task_class where tc_id = #{id,jdbcType=BIGINT}
   <sql id="Base_Column_List">tc_id,tc_name,tc_picture,tc_unique_key,tc_tip,tc_btn_name,tc_jump_id,tc_params,tc_rule_name,tc_rule,tc_rule_link,tc_progress,tc_orderby,tc_state,tc_create_time,tc_update_time
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_integral_task_class where tc_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_integral_task_class where tc_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.integral.IntegralTaskClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_integral_task_class (tc_id,tc_name,tc_picture,tc_unique_key,tc_tip,tc_btn_name,tc_jump_id,tc_params,tc_rule_name,tc_rule,tc_rule_link,tc_progress,tc_orderby,tc_state,tc_create_time,tc_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{uniqueKey,jdbcType=VARCHAR},#{tip,jdbcType=VARCHAR},#{btnName,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{ruleName,jdbcType=VARCHAR},#{rule,jdbcType=VARCHAR},#{ruleLink,jdbcType=VARCHAR},#{progress,jdbcType=VARCHAR},#{orderBy,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.integral.IntegralTaskClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_integral_task_class
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
      yeshi_ec_integral_task_class where tc_id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" parameterType="com.yeshi.fanli.entity.integral.IntegralTaskClass"
      useGeneratedKeys="true" keyProperty="id">insert into
      yeshi_ec_integral_task_class
      (tc_id,tc_name,tc_picture,tc_unique_key,tc_tip,tc_btn_name,tc_jump_id,tc_params,tc_rule_name,tc_rule,tc_rule_link,tc_progress,tc_orderby,tc_state,tc_create_time,tc_update_time)
      values
      (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{uniqueKey,jdbcType=VARCHAR},#{tip,jdbcType=VARCHAR},#{btnName,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{ruleName,jdbcType=VARCHAR},#{rule,jdbcType=VARCHAR},#{ruleLink,jdbcType=VARCHAR},#{progress,jdbcType=VARCHAR},#{orderBy,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.integral.IntegralTaskClass"
      useGeneratedKeys="true" keyProperty="id">
      insert into yeshi_ec_integral_task_class
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">tc_id,</if>
      <if test="name != null">tc_name,</if>
@@ -73,7 +91,8 @@
      <if test="state != null">tc_state,</if>
      <if test="createTime != null">tc_create_time,</if>
      <if test="updateTime != null">tc_update_time,</if>
    </trim>values
      </trim>
      values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
@@ -93,8 +112,26 @@
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.integral.IntegralTaskClass">update yeshi_ec_integral_task_class set tc_name = #{name,jdbcType=VARCHAR},tc_picture = #{picture,jdbcType=VARCHAR},tc_unique_key = #{uniqueKey,jdbcType=VARCHAR},tc_tip = #{tip,jdbcType=VARCHAR},tc_btn_name = #{btnName,jdbcType=VARCHAR},tc_jump_id = #{jumpDetail.id,jdbcType=BIGINT},tc_params = #{params,jdbcType=VARCHAR},tc_rule_name = #{ruleName,jdbcType=VARCHAR},tc_rule = #{rule,jdbcType=VARCHAR},tc_rule_link = #{ruleLink,jdbcType=VARCHAR},tc_progress = #{progress,jdbcType=VARCHAR},tc_orderby = #{orderBy,jdbcType=INTEGER},tc_state = #{state,jdbcType=INTEGER},tc_create_time = #{createTime,jdbcType=TIMESTAMP},tc_update_time = #{updateTime,jdbcType=TIMESTAMP} where tc_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.integral.IntegralTaskClass">update yeshi_ec_integral_task_class
   <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.integral.IntegralTaskClass">update
      yeshi_ec_integral_task_class set tc_name =
      #{name,jdbcType=VARCHAR},tc_picture =
      #{picture,jdbcType=VARCHAR},tc_unique_key =
      #{uniqueKey,jdbcType=VARCHAR},tc_tip =
      #{tip,jdbcType=VARCHAR},tc_btn_name =
      #{btnName,jdbcType=VARCHAR},tc_jump_id =
      #{jumpDetail.id,jdbcType=BIGINT},tc_params =
      #{params,jdbcType=VARCHAR},tc_rule_name =
      #{ruleName,jdbcType=VARCHAR},tc_rule =
      #{rule,jdbcType=VARCHAR},tc_rule_link =
      #{ruleLink,jdbcType=VARCHAR},tc_progress =
      #{progress,jdbcType=VARCHAR},tc_orderby =
      #{orderBy,jdbcType=INTEGER},tc_state =
      #{state,jdbcType=INTEGER},tc_create_time =
      #{createTime,jdbcType=TIMESTAMP},tc_update_time =
      #{updateTime,jdbcType=TIMESTAMP} where tc_id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.integral.IntegralTaskClass">
      update yeshi_ec_integral_task_class
    <set>
      <if test="name != null">tc_name=#{name,jdbcType=VARCHAR},</if>
      <if test="picture != null">tc_picture=#{picture,jdbcType=VARCHAR},</if>
@@ -111,12 +148,15 @@
      <if test="state != null">tc_state=#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">tc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">tc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where tc_id = #{id,jdbcType=BIGINT}
      </set>
      where tc_id = #{id,jdbcType=BIGINT}
  </update>
  
   <select id="getIntegralTaskClassVO" resultMap="BaseResultVOMap">
    SELECT * FROM `yeshi_ec_integral_task_class` c
   LEFT JOIN (SELECT t.`it_cid` AS cid,SUM(t.`it_gold_coin` * (IFNULL(t.`it_upper_limit`,1)))AS totalCoin,SUM(t.`it_upper_limit`) AS taskNum
      LEFT JOIN (SELECT t.`it_cid` AS cid,SUM(t.`it_gold_coin` *
      (IFNULL(t.`it_upper_limit`,1)))AS totalCoin,SUM(t.`it_upper_limit`) AS
      taskNum
          FROM yeshi_ec_integral_task t
         WHERE t.`it_state` = 1 GROUP BY t.`it_cid`)ta ON ta.cid = c.`tc_id`
   WHERE c.`tc_state` = 1