Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	carbon-h5/carbon-h5-service/src/main/java/com/hcloud/microserver/h5/service/impl/CustomerCarbonValServiceImpl.java
#	carbon-h5/carbon-h5-service/src/main/resources/com/hcloud/microserver/h5/dao/CustomerCarbonValMapper.xml
赵冬冬 4 rokov pred
rodič
commit
4166a9023c

+ 12 - 11
carbon-h5/carbon-h5-service/src/main/java/com/hcloud/microserver/h5/controller/web/CustomerCarbonValController.java

@@ -1,7 +1,7 @@
 package com.hcloud.microserver.h5.controller.web;
 
+import com.hcloud.microserver.commoncore.annotation.CurrentUser;
 import com.hcloud.microserver.commoncore.base.ResponseBase;
-import com.hcloud.microserver.commoncore.base.ResultVO;
 import com.hcloud.microserver.commoncore.enums.ResultEnum;
 import com.hcloud.microserver.commoncore.exception.GlobalException;
 import com.hcloud.microserver.commoncore.util.string.StringUtils;
@@ -11,6 +11,7 @@ import com.hcloud.microserver.h5.facade.carbon.forms.CustomerInfoForm;
 import com.hcloud.microserver.h5.facade.carbon.vo.CustomerCarbonValRankVO;
 import com.hcloud.microserver.h5.service.CustomerCarbonValService;
 import com.hcloud.microserver.h5.service.CustomerService;
+import com.hcloud.microserver.h5.util.CurrUserUtil;
 import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -40,17 +41,17 @@ public class CustomerCarbonValController extends CarbonBaseController {
         }
         CustomerCarbonValRankForm form = new CustomerCarbonValRankForm();
         form.setType(type);
-        //获取当前登录用户
-        CustomerInfoForm customerInfo = customerService.getCurrentMember();
-        if (customerInfo == null) {
-            return responseError(new ResultVO(ResultEnum.TOKEN_EXPIRED));
-        }
-        if (StringUtils.isEmpty(form.getCustomerId())){
-            form.setCustomerId(customerInfo.getGuid());
-        }
-        if (form.getCustomerType() == null){
-            form.setCustomerType(customerInfo.getCustomerType());
+        //获取是否有登录用户
+        CustomerInfoForm customerInfo = CurrUserUtil.getCurrentMember();
+        if (customerInfo != null) {
+            if (StringUtils.isEmpty(form.getCustomerId())){
+                form.setCustomerId(customerInfo.getGuid());
+            }
+            if (form.getCustomerType() == null){
+                form.setCustomerType(customerInfo.getCustomerType());
+            }
         }
+
         CustomerCarbonValRankVO vo = customerCarbonValService.getCustomerCarbonValRankList(form);
         return responseResultSuccess(vo);
     }

+ 13 - 11
carbon-h5/carbon-h5-service/src/main/java/com/hcloud/microserver/h5/service/impl/CustomerCarbonValServiceImpl.java

@@ -1,5 +1,6 @@
 package com.hcloud.microserver.h5.service.impl;
 
+import com.hcloud.microserver.commoncore.util.string.StringUtils;
 import com.hcloud.microserver.commoncore.util.UUIDUtils;
 import com.hcloud.microserver.h5.bo.ContributionBO;
 import com.hcloud.microserver.h5.dao.CustomerCarbonValMapper;
@@ -25,22 +26,23 @@ public class CustomerCarbonValServiceImpl implements CustomerCarbonValService {
     @Override
     public CustomerCarbonValRankVO getCustomerCarbonValRankList(CustomerCarbonValRankForm form) {
         List<CustomerCarbonValRankForm> list = customerCarbonValMapper.getCustomerCarbonValRankList(form);
-        if (list != null && list.size() > 0) {
-            CustomerCarbonValRankVO vo = new CustomerCarbonValRankVO();
-            form.setCurrCustomerRank(true); //查询当前客户排名
-            List<CustomerCarbonValRankForm> currCustomerRankList = customerCarbonValMapper.getCustomerCarbonValRankList(form);
-            if (currCustomerRankList != null && currCustomerRankList.size() > 0) {
-                vo.setCurrCustomerRankForm(currCustomerRankList.get(0));
+        CustomerCarbonValRankVO vo = new CustomerCarbonValRankVO();
+        if (list != null && list.size() > 0 && StringUtils.isNotEmpty(form.getCustomerId())){
+            if ((form.getType() == 1 && form.getCustomerType() == 1)  //查询当前客户排名
+                    || (form.getType() == 2 && form.getCustomerType() > 1)){
+                form.setCurrCustomerRank(true);
+                List<CustomerCarbonValRankForm> currCustomerRankList = customerCarbonValMapper.getCustomerCarbonValRankList(form);
+                if (currCustomerRankList != null && currCustomerRankList.size() > 0)
+                    vo.setCurrCustomerRankForm(currCustomerRankList.get(0));
             }
-            vo.setList(list);
-            return vo;
         }
-        return null;
+        vo.setList(list);
+        return vo;
     }
 
     @Override
-    public BigDecimal selectCarbonAmountByCustomerId(String guid) {
-        return customerCarbonValMapper.selectCarbonAmountByCustomerId(guid);
+    public BigDecimal selectCarbonAmountByCustomerId(String guid){
+       return customerCarbonValMapper.selectCarbonAmountByCustomerId(guid);
     }
 
     @Transactional

+ 52 - 0
carbon-h5/carbon-h5-service/src/main/java/com/hcloud/microserver/h5/util/CurrUserUtil.java

@@ -0,0 +1,52 @@
+package com.hcloud.microserver.h5.util;
+
+import com.hcloud.microserver.commoncore.enums.ResultEnum;
+import com.hcloud.microserver.commoncore.exception.GlobalException;
+import com.hcloud.microserver.commoncore.util.string.StringUtils;
+import com.hcloud.microserver.h5.bo.CustomerDetails;
+import com.hcloud.microserver.h5.facade.carbon.forms.CustomerInfoForm;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+
+/**
+ * @className:
+ * @description: 当前登录用户
+ * @author: lym
+ * @date: 2020/11/27
+ */
+public class CurrUserUtil {
+
+    public static CustomerInfoForm getCurrentMember() {
+        SecurityContext ctx = SecurityContextHolder.getContext();
+        Authentication auth = ctx.getAuthentication();
+        Object principal = auth.getPrincipal();
+        if (principal instanceof CustomerDetails) {
+            CustomerDetails memberDetails = (CustomerDetails) principal;
+            return memberDetails.getCustomerInfo();
+        }
+        return null;
+    }
+
+    public static CustomerInfoForm getCurrentCustomerInfo(){
+        CustomerInfoForm customerInfo = getCurrentMember();
+        if (customerInfo == null) {
+            throw new GlobalException(ResultEnum.TOKEN_EXPIRED);
+        }
+        return customerInfo;
+    }
+
+    /**
+     * 获取登录用户id
+     * lym
+     * @return
+     */
+    public static String getCustomerId(){
+        CustomerInfoForm customerInfo = getCurrentCustomerInfo();
+        String customerId = customerInfo.getGuid();
+        if (StringUtils.isEmpty(customerId)) {
+            throw new GlobalException(ResultEnum.TOKEN_EXPIRED);
+        }
+        return customerId;
+    }
+}

+ 312 - 319
carbon-h5/carbon-h5-service/src/main/resources/com/hcloud/microserver/h5/dao/CustomerCarbonValMapper.xml

@@ -1,119 +1,115 @@
 <?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.hcloud.microserver.h5.dao.CustomerCarbonValMapper">
-    <resultMap id="BaseResultMap" type="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonVal">
-        <id column="guid" property="guid" jdbcType="CHAR"/>
-        <result column="t_customer_id" property="tCustomerId" jdbcType="CHAR"/>
-        <result column="t_customer_name" property="tCustomerName" jdbcType="VARCHAR"/>
-        <result column="carbon_val" property="carbonVal" jdbcType="DECIMAL"/>
-        <result column="status" property="status" jdbcType="INTEGER"/>
-        <result column="type" property="type" jdbcType="INTEGER"/>
-        <result column="tb_guid" property="tbGuid" jdbcType="CHAR"/>
-        <result column="tb_name" property="tbName" jdbcType="CHAR"/>
-        <result column="remarks" property="remarks" jdbcType="CHAR"/>
-        <result column="year_time" property="yearTime" jdbcType="INTEGER"/>
-        <result column="create_user" property="createUser" jdbcType="CHAR"/>
-        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
-        <result column="update_user" property="updateUser" jdbcType="CHAR"/>
-        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
-    </resultMap>
-    <sql id="Example_Where_Clause">
-        <where>
-            <foreach collection="oredCriteria" item="criteria" separator="or">
-                <if test="criteria.valid">
-                    <trim prefix="(" suffix=")" prefixOverrides="and">
-                        <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 collection="criterion.value" item="listItem" open="(" close=")"
-                                             separator=",">
-                                        #{listItem}
-                                    </foreach>
-                                </when>
-                            </choose>
-                        </foreach>
-                    </trim>
-                </if>
+<mapper namespace="com.hcloud.microserver.h5.dao.CustomerCarbonValMapper" >
+  <resultMap id="BaseResultMap" type="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonVal" >
+    <id column="guid" property="guid" jdbcType="CHAR" />
+    <result column="t_customer_id" property="tCustomerId" jdbcType="CHAR" />
+    <result column="t_customer_name" property="tCustomerName" jdbcType="VARCHAR" />
+    <result column="carbon_val" property="carbonVal" jdbcType="DECIMAL" />
+    <result column="status" property="status" jdbcType="INTEGER" />
+    <result column="type" property="type" jdbcType="INTEGER" />
+    <result column="tb_guid" property="tbGuid" jdbcType="CHAR" />
+    <result column="tb_name" property="tbName" jdbcType="CHAR" />
+    <result column="remarks" property="remarks" jdbcType="CHAR" />
+    <result column="year_time" property="yearTime" jdbcType="INTEGER" />
+    <result column="create_user" property="createUser" jdbcType="CHAR" />
+    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
+    <result column="update_user" property="updateUser" jdbcType="CHAR" />
+    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
+  </resultMap>
+  <sql id="Example_Where_Clause" >
+    <where >
+      <foreach collection="oredCriteria" item="criteria" separator="or" >
+        <if test="criteria.valid" >
+          <trim prefix="(" suffix=")" prefixOverrides="and" >
+            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
             </foreach>
-        </where>
-    </sql>
-    <sql id="Update_By_Example_Where_Clause">
-        <where>
-            <foreach collection="example.oredCriteria" item="criteria" separator="or">
-                <if test="criteria.valid">
-                    <trim prefix="(" suffix=")" prefixOverrides="and">
-                        <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 collection="criterion.value" item="listItem" open="(" close=")"
-                                             separator=",">
-                                        #{listItem}
-                                    </foreach>
-                                </when>
-                            </choose>
-                        </foreach>
-                    </trim>
-                </if>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause" >
+    <where >
+      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
+        <if test="criteria.valid" >
+          <trim prefix="(" suffix=")" prefixOverrides="and" >
+            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
             </foreach>
-        </where>
-    </sql>
-    <sql id="Base_Column_List">
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List" >
     guid, t_customer_id, t_customer_name, carbon_val, status, type, tb_guid, tb_name, 
     remarks, year_time, create_user, create_time, update_user, update_time
   </sql>
-    <select id="selectByExample" resultMap="BaseResultMap"
-            parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonValExample">
-        select
-        <if test="distinct">
-            distinct
-        </if>
-        <include refid="Base_Column_List"/>
-        from t_customer_carbon_val
-        <if test="_parameter != null">
-            <include refid="Example_Where_Clause"/>
-        </if>
-        <if test="orderByClause != null">
-            order by ${orderByClause}
-        </if>
-    </select>
-    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
-        select
-        <include refid="Base_Column_List"/>
-        from t_customer_carbon_val
-        where guid = #{guid,jdbcType=CHAR}
-    </select>
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonValExample" >
+    select
+    <if test="distinct" >
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from t_customer_carbon_val
+    <if test="_parameter != null" >
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null" >
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
+    select 
+    <include refid="Base_Column_List" />
+    from t_customer_carbon_val
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
     delete from t_customer_carbon_val
     where guid = #{guid,jdbcType=CHAR}
   </delete>
-    <delete id="deleteByExample"
-            parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonValExample">
-        delete from t_customer_carbon_val
-        <if test="_parameter != null">
-            <include refid="Example_Where_Clause"/>
-        </if>
-    </delete>
-    <insert id="insert" parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonVal">
+  <delete id="deleteByExample" parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonValExample" >
+    delete from t_customer_carbon_val
+    <if test="_parameter != null" >
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonVal" >
     insert into t_customer_carbon_val (guid, t_customer_id, t_customer_name, 
       carbon_val, status, type, 
       tb_guid, tb_name, remarks, year_time, 
@@ -125,222 +121,219 @@
       #{createUser,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=CHAR}, 
       #{updateTime,jdbcType=TIMESTAMP})
   </insert>
-    <insert id="insertSelective" parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonVal">
-        insert into t_customer_carbon_val
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="guid != null">
-                guid,
-            </if>
-            <if test="tCustomerId != null">
-                t_customer_id,
-            </if>
-            <if test="tCustomerName != null">
-                t_customer_name,
-            </if>
-            <if test="carbonVal != null">
-                carbon_val,
-            </if>
-            <if test="status != null">
-                status,
-            </if>
-            <if test="type != null">
-                type,
-            </if>
-            <if test="tbGuid != null">
-                tb_guid,
-            </if>
-            <if test="tbName != null">
-                tb_name,
-            </if>
-            <if test="remarks != null">
-                remarks,
-            </if>
-            <if test="yearTime != null">
-                year_time,
-            </if>
-            <if test="createUser != null">
-                create_user,
-            </if>
-            <if test="createTime != null">
-                create_time,
-            </if>
-            <if test="updateUser != null">
-                update_user,
-            </if>
-            <if test="updateTime != null">
-                update_time,
-            </if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="guid != null">
-                #{guid,jdbcType=CHAR},
-            </if>
-            <if test="tCustomerId != null">
-                #{tCustomerId,jdbcType=CHAR},
-            </if>
-            <if test="tCustomerName != null">
-                #{tCustomerName,jdbcType=VARCHAR},
-            </if>
-            <if test="carbonVal != null">
-                #{carbonVal,jdbcType=DECIMAL},
-            </if>
-            <if test="status != null">
-                #{status,jdbcType=INTEGER},
-            </if>
-            <if test="type != null">
-                #{type,jdbcType=INTEGER},
-            </if>
-            <if test="tbGuid != null">
-                #{tbGuid,jdbcType=CHAR},
-            </if>
-            <if test="tbName != null">
-                #{tbName,jdbcType=CHAR},
-            </if>
-            <if test="remarks != null">
-                #{remarks,jdbcType=CHAR},
-            </if>
-            <if test="yearTime != null">
-                #{yearTime,jdbcType=INTEGER},
-            </if>
-            <if test="createUser != null">
-                #{createUser,jdbcType=CHAR},
-            </if>
-            <if test="createTime != null">
-                #{createTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="updateUser != null">
-                #{updateUser,jdbcType=CHAR},
-            </if>
-            <if test="updateTime != null">
-                #{updateTime,jdbcType=TIMESTAMP},
-            </if>
-        </trim>
-    </insert>
-
-    <select id="countByExample" parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonValExample"
-            resultType="java.lang.Integer">
-        select count(*) from t_customer_carbon_val
-        <if test="_parameter != null">
-            <include refid="Example_Where_Clause"/>
-        </if>
-    </select>
-    <update id="updateByExampleSelective" parameterType="map">
-        update t_customer_carbon_val
-        <set>
-            <if test="record.guid != null">
-                guid = #{record.guid,jdbcType=CHAR},
-            </if>
-            <if test="record.tCustomerId != null">
-                t_customer_id = #{record.tCustomerId,jdbcType=CHAR},
-            </if>
-            <if test="record.tCustomerName != null">
-                t_customer_name = #{record.tCustomerName,jdbcType=VARCHAR},
-            </if>
-            <if test="record.carbonVal != null">
-                carbon_val = #{record.carbonVal,jdbcType=DECIMAL},
-            </if>
-            <if test="record.status != null">
-                status = #{record.status,jdbcType=INTEGER},
-            </if>
-            <if test="record.type != null">
-                type = #{record.type,jdbcType=INTEGER},
-            </if>
-            <if test="record.tbGuid != null">
-                tb_guid = #{record.tbGuid,jdbcType=CHAR},
-            </if>
-            <if test="record.tbName != null">
-                tb_name = #{record.tbName,jdbcType=CHAR},
-            </if>
-            <if test="record.remarks != null">
-                remarks = #{record.remarks,jdbcType=CHAR},
-            </if>
-            <if test="record.yearTime != null">
-                year_time = #{record.yearTime,jdbcType=INTEGER},
-            </if>
-            <if test="record.createUser != null">
-                create_user = #{record.createUser,jdbcType=CHAR},
-            </if>
-            <if test="record.createTime != null">
-                create_time = #{record.createTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="record.updateUser != null">
-                update_user = #{record.updateUser,jdbcType=CHAR},
-            </if>
-            <if test="record.updateTime != null">
-                update_time = #{record.updateTime,jdbcType=TIMESTAMP},
-            </if>
-        </set>
-        <if test="_parameter != null">
-            <include refid="Update_By_Example_Where_Clause"/>
-        </if>
-    </update>
-    <update id="updateByExample" parameterType="map">
-        update t_customer_carbon_val
-        set guid = #{record.guid,jdbcType=CHAR},
+  <insert id="insertSelective" parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonVal" >
+    insert into t_customer_carbon_val
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="guid != null" >
+        guid,
+      </if>
+      <if test="tCustomerId != null" >
+        t_customer_id,
+      </if>
+      <if test="tCustomerName != null" >
+        t_customer_name,
+      </if>
+      <if test="carbonVal != null" >
+        carbon_val,
+      </if>
+      <if test="status != null" >
+        status,
+      </if>
+      <if test="type != null" >
+        type,
+      </if>
+      <if test="tbGuid != null" >
+        tb_guid,
+      </if>
+      <if test="tbName != null" >
+        tb_name,
+      </if>
+      <if test="remarks != null" >
+        remarks,
+      </if>
+      <if test="yearTime != null" >
+        year_time,
+      </if>
+      <if test="createUser != null" >
+        create_user,
+      </if>
+      <if test="createTime != null" >
+        create_time,
+      </if>
+      <if test="updateUser != null" >
+        update_user,
+      </if>
+      <if test="updateTime != null" >
+        update_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="guid != null" >
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="tCustomerId != null" >
+        #{tCustomerId,jdbcType=CHAR},
+      </if>
+      <if test="tCustomerName != null" >
+        #{tCustomerName,jdbcType=VARCHAR},
+      </if>
+      <if test="carbonVal != null" >
+        #{carbonVal,jdbcType=DECIMAL},
+      </if>
+      <if test="status != null" >
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="type != null" >
+        #{type,jdbcType=INTEGER},
+      </if>
+      <if test="tbGuid != null" >
+        #{tbGuid,jdbcType=CHAR},
+      </if>
+      <if test="tbName != null" >
+        #{tbName,jdbcType=CHAR},
+      </if>
+      <if test="remarks != null" >
+        #{remarks,jdbcType=CHAR},
+      </if>
+      <if test="yearTime != null" >
+        #{yearTime,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null" >
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null" >
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateUser != null" >
+        #{updateUser,jdbcType=CHAR},
+      </if>
+      <if test="updateTime != null" >
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonValExample" resultType="java.lang.Integer" >
+    select count(*) from t_customer_carbon_val
+    <if test="_parameter != null" >
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map" >
+    update t_customer_carbon_val
+    <set >
+      <if test="record.guid != null" >
+        guid = #{record.guid,jdbcType=CHAR},
+      </if>
+      <if test="record.tCustomerId != null" >
         t_customer_id = #{record.tCustomerId,jdbcType=CHAR},
+      </if>
+      <if test="record.tCustomerName != null" >
         t_customer_name = #{record.tCustomerName,jdbcType=VARCHAR},
+      </if>
+      <if test="record.carbonVal != null" >
         carbon_val = #{record.carbonVal,jdbcType=DECIMAL},
+      </if>
+      <if test="record.status != null" >
         status = #{record.status,jdbcType=INTEGER},
+      </if>
+      <if test="record.type != null" >
         type = #{record.type,jdbcType=INTEGER},
+      </if>
+      <if test="record.tbGuid != null" >
         tb_guid = #{record.tbGuid,jdbcType=CHAR},
+      </if>
+      <if test="record.tbName != null" >
         tb_name = #{record.tbName,jdbcType=CHAR},
+      </if>
+      <if test="record.remarks != null" >
         remarks = #{record.remarks,jdbcType=CHAR},
+      </if>
+      <if test="record.yearTime != null" >
         year_time = #{record.yearTime,jdbcType=INTEGER},
+      </if>
+      <if test="record.createUser != null" >
         create_user = #{record.createUser,jdbcType=CHAR},
+      </if>
+      <if test="record.createTime != null" >
         create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.updateUser != null" >
         update_user = #{record.updateUser,jdbcType=CHAR},
-        update_time = #{record.updateTime,jdbcType=TIMESTAMP}
-        <if test="_parameter != null">
-            <include refid="Update_By_Example_Where_Clause"/>
-        </if>
-    </update>
-    <update id="updateByPrimaryKeySelective"
-            parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonVal">
-        update t_customer_carbon_val
-        <set>
-            <if test="tCustomerId != null">
-                t_customer_id = #{tCustomerId,jdbcType=CHAR},
-            </if>
-            <if test="tCustomerName != null">
-                t_customer_name = #{tCustomerName,jdbcType=VARCHAR},
-            </if>
-            <if test="carbonVal != null">
-                carbon_val = #{carbonVal,jdbcType=DECIMAL},
-            </if>
-            <if test="status != null">
-                status = #{status,jdbcType=INTEGER},
-            </if>
-            <if test="type != null">
-                type = #{type,jdbcType=INTEGER},
-            </if>
-            <if test="tbGuid != null">
-                tb_guid = #{tbGuid,jdbcType=CHAR},
-            </if>
-            <if test="tbName != null">
-                tb_name = #{tbName,jdbcType=CHAR},
-            </if>
-            <if test="remarks != null">
-                remarks = #{remarks,jdbcType=CHAR},
-            </if>
-            <if test="yearTime != null">
-                year_time = #{yearTime,jdbcType=INTEGER},
-            </if>
-            <if test="createUser != null">
-                create_user = #{createUser,jdbcType=CHAR},
-            </if>
-            <if test="createTime != null">
-                create_time = #{createTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="updateUser != null">
-                update_user = #{updateUser,jdbcType=CHAR},
-            </if>
-            <if test="updateTime != null">
-                update_time = #{updateTime,jdbcType=TIMESTAMP},
-            </if>
-        </set>
-        where guid = #{guid,jdbcType=CHAR}
-    </update>
-    <update id="updateByPrimaryKey" parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonVal">
+      </if>
+      <if test="record.updateTime != null" >
+        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    <if test="_parameter != null" >
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map" >
+    update t_customer_carbon_val
+    set guid = #{record.guid,jdbcType=CHAR},
+      t_customer_id = #{record.tCustomerId,jdbcType=CHAR},
+      t_customer_name = #{record.tCustomerName,jdbcType=VARCHAR},
+      carbon_val = #{record.carbonVal,jdbcType=DECIMAL},
+      status = #{record.status,jdbcType=INTEGER},
+      type = #{record.type,jdbcType=INTEGER},
+      tb_guid = #{record.tbGuid,jdbcType=CHAR},
+      tb_name = #{record.tbName,jdbcType=CHAR},
+      remarks = #{record.remarks,jdbcType=CHAR},
+      year_time = #{record.yearTime,jdbcType=INTEGER},
+      create_user = #{record.createUser,jdbcType=CHAR},
+      create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      update_user = #{record.updateUser,jdbcType=CHAR},
+      update_time = #{record.updateTime,jdbcType=TIMESTAMP}
+    <if test="_parameter != null" >
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonVal" >
+    update t_customer_carbon_val
+    <set >
+      <if test="tCustomerId != null" >
+        t_customer_id = #{tCustomerId,jdbcType=CHAR},
+      </if>
+      <if test="tCustomerName != null" >
+        t_customer_name = #{tCustomerName,jdbcType=VARCHAR},
+      </if>
+      <if test="carbonVal != null" >
+        carbon_val = #{carbonVal,jdbcType=DECIMAL},
+      </if>
+      <if test="status != null" >
+        status = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="type != null" >
+        type = #{type,jdbcType=INTEGER},
+      </if>
+      <if test="tbGuid != null" >
+        tb_guid = #{tbGuid,jdbcType=CHAR},
+      </if>
+      <if test="tbName != null" >
+        tb_name = #{tbName,jdbcType=CHAR},
+      </if>
+      <if test="remarks != null" >
+        remarks = #{remarks,jdbcType=CHAR},
+      </if>
+      <if test="yearTime != null" >
+        year_time = #{yearTime,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null" >
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null" >
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateUser != null" >
+        update_user = #{updateUser,jdbcType=CHAR},
+      </if>
+      <if test="updateTime != null" >
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microserver.h5.facade.carbon.entity.CustomerCarbonVal" >
     update t_customer_carbon_val
     set t_customer_id = #{tCustomerId,jdbcType=CHAR},
       t_customer_name = #{tCustomerName,jdbcType=VARCHAR},
@@ -358,10 +351,10 @@
     where guid = #{guid,jdbcType=CHAR}
   </update>
 
-    <select id="getCustomerCarbonValRankList"
-            parameterType="com.hcloud.microserver.h5.facade.carbon.forms.CustomerCarbonValRankForm"
-            resultType="com.hcloud.microserver.h5.facade.carbon.forms.CustomerCarbonValRankForm">
-        SELECT obj.* from (SELECT @rownum := @rownum + 1 AS rank,tmp.t_customer_id AS customerId,tmp.carbonVal
+  <!-- 查询客户购碳量排行榜 lym -->
+  <select id="getCustomerCarbonValRankList" parameterType="com.hcloud.microserver.h5.facade.carbon.forms.CustomerCarbonValRankForm"
+      resultType="com.hcloud.microserver.h5.facade.carbon.forms.CustomerCarbonValRankForm">
+      SELECT obj.* from (SELECT @rownum := @rownum + 1 AS rank,tmp.t_customer_id AS customerId,tmp.carbonVal
         ,IFNULL(c.customer_name,c.nick_name) AS customerName,c.head_image AS headImage
         FROM (SELECT @rownum := 0) r,(SELECT a.t_customer_id,SUM(a.carbon_val) AS carbonVal
         FROM t_customer_carbon_val a
@@ -369,20 +362,20 @@
         WHERE a.year_time BETWEEN YEAR(DATE_SUB(NOW(),INTERVAL 3 YEAR)) AND YEAR(NOW())
         AND a.type = 1
         <if test="type != null and type == 1">
-            AND b.customer_type = 1
+          AND b.customer_type = 1
         </if>
         <if test="type != null and type == 2">
-            AND b.customer_type != 1
+          AND b.customer_type != 1
         </if>
         GROUP BY t_customer_id
         ) tmp
         LEFT JOIN t_customer_info c ON tmp.t_customer_id = c.guid
         ORDER BY tmp.carbonVal DESC
-        ) obj WHERE 1 = 1
+      ) obj WHERE 1 = 1
         <if test="customerId != null and isCurrCustomerRank != null and isCurrCustomerRank == true">
-            AND obj.CustomerId = #{customerId}
+          AND obj.CustomerId = #{customerId}
         </if>
-    </select>
+  </select>
     <select id="selectCarbonAmountByCustomerId" resultType="java.math.BigDecimal">
         SELECT
             SUM(a.carbon_val)