Bladeren bron

各省平均销售数据

李天标 5 jaren geleden
bovenliggende
commit
40bf372664

+ 21 - 0
src/main/java/com/shawn/model/Bean/ChartColumn2.java

@@ -0,0 +1,21 @@
+package com.shawn.model.Bean;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+import java.util.ArrayList;
+@Accessors(chain = true)
+@NoArgsConstructor
+@Getter
+@Setter
+@ToString
+public class ChartColumn2 {
+    @ApiModelProperty(value="统计类目")
+    private ArrayList<String> categories;
+    @ApiModelProperty(value="统计类目值")
+    private ArrayList<ChartSerie> series;
+}

+ 3 - 0
src/main/java/com/shawn/repository/TAreaMapper.java

@@ -10,5 +10,8 @@ import com.shawn.model.entity.TAreaExample;
 import com.shawn.model.param.TAreaParam;
 import com.shawn.repository.base.BaseDaoInterface;
 
+import java.util.List;
+
 public interface TAreaMapper extends BaseDaoInterface<TArea,TAreaExample,TAreaParam, Long>{
+    List<TArea> getProvinceList();
 }

+ 2 - 0
src/main/java/com/shawn/repository/TEquipmentMapper.java

@@ -15,4 +15,6 @@ public interface TEquipmentMapper extends BaseDaoInterface<TEquipment,TEquipment
     String findMachineTotalNum(StatisticsParam param);
 
     String findMachineUseNum(StatisticsParam param);
+
+    String getMuchaineNum(StatisticsParam param);
 }

+ 2 - 0
src/main/java/com/shawn/repository/TOrderMapper.java

@@ -29,4 +29,6 @@ public interface TOrderMapper extends BaseDaoInterface<TOrder,TOrderExample,TOrd
      * @return
      */
     public List<ChartBean> getEquipmentStatistics(StatisticsParam param);
+
+    String getProvincePrice(StatisticsParam param);
 }

+ 149 - 76
src/main/java/com/shawn/service/impl/TOrderServiceImpl.java

@@ -1,17 +1,22 @@
 /**
  * Date:2019-09-23 17:09:15
  * author:吴洪双
-*/
+ */
 
 package com.shawn.service.impl;
 
 import com.shawn.constant.ChartType;
 import com.shawn.model.Bean.ChartBean;
 import com.shawn.model.Bean.ChartColumn;
+import com.shawn.model.Bean.ChartColumn2;
+import com.shawn.model.Bean.ChartSerie;
+import com.shawn.model.entity.TArea;
 import com.shawn.model.entity.TOrder;
 import com.shawn.model.entity.TOrderExample;
 import com.shawn.model.param.StatisticsParam;
 import com.shawn.model.param.TOrderParam;
+import com.shawn.repository.TAreaMapper;
+import com.shawn.repository.TEquipmentMapper;
 import com.shawn.repository.TOrderMapper;
 import com.shawn.service.base.BaseService;
 import com.shawn.service.interfac.TOrderServiceInterface;
@@ -21,87 +26,155 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
+
 @Slf4j
 @Service
-public class TOrderServiceImpl extends BaseService<TOrder,TOrderExample,TOrderParam,Long> implements TOrderServiceInterface{
-	@Autowired
-	private TOrderMapper tOrderMapper;
-	@Autowired
-	public TOrderServiceImpl(TOrderMapper dao) {
-		super(dao);
-	}
+public class TOrderServiceImpl extends BaseService<TOrder, TOrderExample, TOrderParam, Long> implements TOrderServiceInterface {
+    @Autowired
+    private TOrderMapper tOrderMapper;
+
+    @Autowired
+    public TOrderServiceImpl(TOrderMapper dao) {
+        super(dao);
+    }
+
+    @Override
+    public String getResourceName() {
+        return "TOrder";
+    }
+
+    @Autowired
+    private TEquipmentMapper tEquipmentMapper;
+
+    @Autowired
+    private TAreaMapper tAreaMapper;
+
+    @Override
+    public ChartColumn getStatistics(StatisticsParam param) {
 
-	@Override
-	public String getResourceName() {
-		return "TOrder";
-	}
+        List<ChartBean> list = new ArrayList<>();
+        String msg = "";
+        if (ChartType.day.toString().equals(param.getChartType())) {
+            list = tOrderMapper.getDayStatistics(param);
+            msg = "日统计";
+        }
+        if (ChartType.week.toString().equals(param.getChartType())) {
+            list = tOrderMapper.getWeekStatistics(param);
+            msg = "周统计";
+        }
+        if (ChartType.month.toString().equals(param.getChartType())) {
+            list = tOrderMapper.getMonthStatistics(param);
+            msg = "月统计";
+        }
+        if (ChartType.year.toString().equals(param.getChartType())) {
+            list = tOrderMapper.getYearStatistics(param);
+            msg = "年统计";
+        }
 
-	@Override
-	public ChartColumn getStatistics(StatisticsParam param){
+        if (CollectionUtils.isEmpty(list)) {
+            throw new MyException("获取" + msg + "数据为空");
+        }
+        ChartColumn chartColumn = new ChartColumn(list);
+        return chartColumn;
+    }
 
-		List<ChartBean> list = new ArrayList<>();
-		String msg = "";
-		if(ChartType.day.toString().equals(param.getChartType())){
-			list = tOrderMapper.getDayStatistics(param);
-			msg = "日统计";
-		}
-		if(ChartType.week.toString().equals(param.getChartType())){
-			list = tOrderMapper.getWeekStatistics(param);
-			msg = "周统计";
-		}
-		if(ChartType.month.toString().equals(param.getChartType())){
-			list = tOrderMapper.getMonthStatistics(param);
-			msg = "月统计";
-		}
-		if(ChartType.year.toString().equals(param.getChartType())){
-			list = tOrderMapper.getYearStatistics(param);
-			msg = "年统计";
-		}
+    @Override
+    public List<ChartBean> getMainStatistics(StatisticsParam param) {
+        List<ChartBean> list = tOrderMapper.getMainStatistics(param);
+        if (CollectionUtils.isEmpty(list)) {
+            throw new MyException("获取数据为空");
+        }
+        return list;
+    }
 
-		if(CollectionUtils.isEmpty(list)){
-			throw new MyException("获取"+msg+"数据为空");
-		}
-		ChartColumn chartColumn = new ChartColumn(list);
-		return chartColumn;
-	}
+    /**
+     *  统计 机器销售
+     * @param param
+     * @return
+     */
+    @Override
+    public ChartColumn getEquipmentStatistics(StatisticsParam param) {
+        List<ChartBean> list = new ArrayList<>();
+        String msg = "";
+        if (ChartType.day.toString().equals(param.getChartType())) {
+            msg = "日统计";
+        }
+        if (ChartType.week.toString().equals(param.getChartType())) {
+            msg = "周统计";
+        }
+        if (ChartType.month.toString().equals(param.getChartType())) {
+            msg = "月统计";
+        }
+        if (ChartType.year.toString().equals(param.getChartType())) {
+            msg = "年统计";
+        }
+        list = tOrderMapper.getEquipmentStatistics(param);
+        if (CollectionUtils.isEmpty(list)) {
+            throw new MyException("获取" + msg + "数据为空");
+        }
+        ChartColumn chartColumn = new ChartColumn(list);
+        return chartColumn;
+    }
 
-	@Override
-	public List<ChartBean> getMainStatistics(StatisticsParam param){
-		List<ChartBean> list = tOrderMapper.getMainStatistics(param);
-		if(CollectionUtils.isEmpty(list)){
-			throw new MyException("获取数据为空");
-		}
-		return list;
-	}
+    /**
+     *  统计 各个省份平均销售排行
+     * @param param
+     * @return
+     */
+    @Override
+    public ChartColumn2 getProvince(StatisticsParam param) {
+        //获取有多少个省份
+        List<TArea> list1 = tAreaMapper.getProvinceList();
+        Map<Long, String> map1 = new HashMap<>();
+        for (TArea area : list1) {
+            String fullname = area.getFullName();
+            String provinceName = fullname.substring(0, 3);
+            String treePath = area.getTreePath();
+            String[] str = treePath.split(",");
+            Long s = null;
+            if (str.length > 1) {
+                s = Long.valueOf(str[1]);
+            }
+            if (str.length <= 1) {
+                s = area.getId();
+            }
+            map1.put(s, provinceName);
+        }
+        Map<String, Long> map2 = new HashMap<>();
+        for (Long key : map1.keySet()) {
+            //当前时间之前某个省总有多少台机器
+            param.setAdminId(String.valueOf(key));
+            param.setChartType(map1.get(key));
+            String num = tEquipmentMapper.getMuchaineNum(param);
+            String price = tOrderMapper.getProvincePrice(param);
+            if (price != null) {
+                Double pingJunPrice = Double.valueOf(price) / Double.valueOf(num);
+                map2.put(map1.get(key), Math.round(pingJunPrice));
+            }
+        }
 
-	/**
-	 *  统计 机器销售
-	 * @param param
-	 * @return
-	 */
-	@Override
-	public ChartColumn getEquipmentStatistics(StatisticsParam param){
-		List<ChartBean> list = new ArrayList<>();
-		String msg = "";
-		if(ChartType.day.toString().equals(param.getChartType())){
-			msg = "日统计";
-		}
-		if(ChartType.week.toString().equals(param.getChartType())){
-			msg = "周统计";
-		}
-		if(ChartType.month.toString().equals(param.getChartType())){
-			msg = "月统计";
-		}
-		if(ChartType.year.toString().equals(param.getChartType())){
-			msg = "年统计";
-		}
-		list = tOrderMapper.getEquipmentStatistics(param);
-		if(CollectionUtils.isEmpty(list)){
-			throw new MyException("获取"+msg+"数据为空");
-		}
-		ChartColumn chartColumn = new ChartColumn(list);
-		return chartColumn;
-	}
+        List<Map.Entry<String, Long>> infoIds = new ArrayList<Map.Entry<String, Long>>(map2.entrySet());
+        Collections.sort(infoIds, new Comparator<Map.Entry<String, Long>>() {
+            public int compare(Map.Entry<String, Long> o1,
+                               Map.Entry<String, Long> o2) {
+                return (int)(o2.getValue() - o1.getValue());
+            }
+        });
+        ChartColumn2 chartColumn = new ChartColumn2();
+        ArrayList<ChartSerie> series = new ArrayList<>();
+        ChartSerie chartSerie=new ChartSerie();
+        ArrayList<String> categories = new ArrayList<>();
+        ArrayList<Integer> data = new ArrayList<>();
+        for(Map.Entry<String, Long> a:infoIds){
+            categories.add(a.getKey());
+            data.add(Math.toIntExact(a.getValue()));
+        }
+        chartSerie.setName("平均销售额");
+        chartSerie.setData(data);
+        series.add(chartSerie);
+        chartColumn.setSeries(series);
+        chartColumn.setCategories(categories);
+        return chartColumn;
+    }
 }

+ 8 - 0
src/main/java/com/shawn/service/interfac/TOrderServiceInterface.java

@@ -7,6 +7,7 @@ package com.shawn.service.interfac;
 
 import com.shawn.model.Bean.ChartBean;
 import com.shawn.model.Bean.ChartColumn;
+import com.shawn.model.Bean.ChartColumn2;
 import com.shawn.model.entity.TOrder;
 import com.shawn.model.entity.TOrderExample;
 import com.shawn.model.param.StatisticsParam;
@@ -26,4 +27,11 @@ public interface TOrderServiceInterface extends BaseServiceInterface<TOrder,TOrd
      * @return
      */
     public ChartColumn getEquipmentStatistics(StatisticsParam param);
+
+    /**
+     *  统计 各个省份平均销售排行
+     * @param param
+     * @return
+     */
+    ChartColumn2 getProvince(StatisticsParam param);
 }

+ 20 - 0
src/main/java/com/shawn/web/controller/TOrderController.java

@@ -9,6 +9,7 @@ import java.util.*;
 
 import com.shawn.model.Bean.ChartBean;
 import com.shawn.model.Bean.ChartColumn;
+import com.shawn.model.Bean.ChartColumn2;
 import com.shawn.model.param.StatisticsParam;
 import com.shawn.util.FgObjectUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -84,4 +85,23 @@ public class TOrderController extends BaseController<TOrder,TOrderExample,TOrder
 						.setData(chartColumn)
 						.setMessage("SUCCESS"));
 	}
+
+	/**
+	 *  统计 各个省份平均销售排行
+	 * @param param
+	 * @return
+	 */
+	@PostMapping("/getProvince")
+	public ResponseEntity<?> getProvince(@RequestBody StatisticsParam param) {
+		log.info("param:{}", param);
+		FgObjectUtil.objectNullOrEmptySel(param, "chartType$");
+		ChartColumn2 chartColumn  = tOrderService.getProvince(param);
+
+		return ResponseEntity
+				.status(HttpStatus.OK)
+				.body(new ResultMessage()
+						.setCode(true)
+						.setData(chartColumn)
+						.setMessage("SUCCESS"));
+	}
 }

+ 348 - 329
src/main/resources/com/shawn/repository/mybatis/TAreaMapper.xml

@@ -1,140 +1,143 @@
 <?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.shawn.repository.TAreaMapper">
-  <resultMap id="BaseResultMap" type="com.shawn.model.entity.TArea">
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
-    <result column="modify_date" jdbcType="TIMESTAMP" property="modifyDate" />
-    <result column="orders" jdbcType="INTEGER" property="orders" />
-    <result column="name" jdbcType="VARCHAR" property="name" />
-    <result column="tree_path" jdbcType="VARCHAR" property="treePath" />
-    <result column="parent" jdbcType="BIGINT" property="parent" />
-    <result column="code" jdbcType="VARCHAR" property="code" />
-  </resultMap>
-  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.shawn.model.entity.TArea">
-    <result column="full_name" jdbcType="LONGVARCHAR" property="fullName" />
-  </resultMap>
-  <sql id="Example_Where_Clause">
-    <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>
+    <resultMap id="BaseResultMap" type="com.shawn.model.entity.TArea">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
+        <result column="modify_date" jdbcType="TIMESTAMP" property="modifyDate"/>
+        <result column="orders" jdbcType="INTEGER" property="orders"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="tree_path" jdbcType="VARCHAR" property="treePath"/>
+        <result column="parent" jdbcType="BIGINT" property="parent"/>
+        <result column="code" jdbcType="VARCHAR" property="code"/>
+    </resultMap>
+    <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.shawn.model.entity.TArea">
+        <result column="full_name" jdbcType="LONGVARCHAR" property="fullName"/>
+    </resultMap>
+    <sql id="Example_Where_Clause">
+        <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>
-          </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="(" 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>
+        </where>
+    </sql>
+    <sql id="Update_By_Example_Where_Clause">
+        <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>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Base_Column_List">
+        </where>
+    </sql>
+    <sql id="Base_Column_List">
     id, create_date, modify_date, orders, name, tree_path, parent, code
   </sql>
-  <sql id="Blob_Column_List">
+    <sql id="Blob_Column_List">
     full_name
   </sql>
-  <select id="selectByExampleWithBLOBs" parameterType="com.shawn.model.entity.TAreaExample" resultMap="ResultMapWithBLOBs">
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    ,
-    <include refid="Blob_Column_List" />
-    from t_area
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-  </select>
-  <select id="selectByExample" parameterType="com.shawn.model.entity.TAreaExample" resultMap="BaseResultMap">
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from t_area
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-    <if test="limit != null">
-      <if test="offset != null">
-        limit ${offset}, ${limit}
-      </if>
-      <if test="offset == null">
-        limit ${limit}
-      </if>
-    </if>
-  </select>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
-    select 
-    <include refid="Base_Column_List" />
-    ,
-    <include refid="Blob_Column_List" />
-    from t_area
-    where id = #{id,jdbcType=BIGINT}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    <select id="selectByExampleWithBLOBs" parameterType="com.shawn.model.entity.TAreaExample"
+            resultMap="ResultMapWithBLOBs">
+        select
+        <if test="distinct">
+            distinct
+        </if>
+        <include refid="Base_Column_List"/>
+        ,
+        <include refid="Blob_Column_List"/>
+        from t_area
+        <if test="_parameter != null">
+            <include refid="Example_Where_Clause"/>
+        </if>
+        <if test="orderByClause != null">
+            order by ${orderByClause}
+        </if>
+    </select>
+    <select id="selectByExample" parameterType="com.shawn.model.entity.TAreaExample" resultMap="BaseResultMap">
+        select
+        <if test="distinct">
+            distinct
+        </if>
+        <include refid="Base_Column_List"/>
+        from t_area
+        <if test="_parameter != null">
+            <include refid="Example_Where_Clause"/>
+        </if>
+        <if test="orderByClause != null">
+            order by ${orderByClause}
+        </if>
+        <if test="limit != null">
+            <if test="offset != null">
+                limit ${offset}, ${limit}
+            </if>
+            <if test="offset == null">
+                limit ${limit}
+            </if>
+        </if>
+    </select>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
+        select
+        <include refid="Base_Column_List"/>
+        ,
+        <include refid="Blob_Column_List"/>
+        from t_area
+        where id = #{id,jdbcType=BIGINT}
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     delete from t_area
     where id = #{id,jdbcType=BIGINT}
   </delete>
-  <delete id="deleteByExample" parameterType="com.shawn.model.entity.TAreaExample">
-    delete from t_area
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
-  <insert id="insert" parameterType="com.shawn.model.entity.TArea">
+    <delete id="deleteByExample" parameterType="com.shawn.model.entity.TAreaExample">
+        delete from t_area
+        <if test="_parameter != null">
+            <include refid="Example_Where_Clause"/>
+        </if>
+    </delete>
+    <insert id="insert" parameterType="com.shawn.model.entity.TArea">
     insert into t_area (id, create_date, modify_date, 
       orders, name, tree_path, 
       parent, code, full_name
@@ -144,168 +147,168 @@
       #{parent,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{fullName,jdbcType=LONGVARCHAR}
       )
   </insert>
-  <insert id="insertSelective" parameterType="com.shawn.model.entity.TArea">
-    insert into t_area
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="createDate != null">
-        create_date,
-      </if>
-      <if test="modifyDate != null">
-        modify_date,
-      </if>
-      <if test="orders != null">
-        orders,
-      </if>
-      <if test="name != null">
-        name,
-      </if>
-      <if test="treePath != null">
-        tree_path,
-      </if>
-      <if test="parent != null">
-        parent,
-      </if>
-      <if test="code != null">
-        code,
-      </if>
-      <if test="fullName != null">
-        full_name,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=BIGINT},
-      </if>
-      <if test="createDate != null">
-        #{createDate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="modifyDate != null">
-        #{modifyDate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="orders != null">
-        #{orders,jdbcType=INTEGER},
-      </if>
-      <if test="name != null">
-        #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="treePath != null">
-        #{treePath,jdbcType=VARCHAR},
-      </if>
-      <if test="parent != null">
-        #{parent,jdbcType=BIGINT},
-      </if>
-      <if test="code != null">
-        #{code,jdbcType=VARCHAR},
-      </if>
-      <if test="fullName != null">
-        #{fullName,jdbcType=LONGVARCHAR},
-      </if>
-    </trim>
-  </insert>
-  <select id="countByExample" parameterType="com.shawn.model.entity.TAreaExample" resultType="java.lang.Long">
-    select count(*) from t_area
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </select>
-  <update id="updateByExampleSelective" parameterType="map">
-    update t_area
-    <set>
-      <if test="record.id != null">
-        id = #{record.id,jdbcType=BIGINT},
-      </if>
-      <if test="record.createDate != null">
+    <insert id="insertSelective" parameterType="com.shawn.model.entity.TArea">
+        insert into t_area
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                id,
+            </if>
+            <if test="createDate != null">
+                create_date,
+            </if>
+            <if test="modifyDate != null">
+                modify_date,
+            </if>
+            <if test="orders != null">
+                orders,
+            </if>
+            <if test="name != null">
+                name,
+            </if>
+            <if test="treePath != null">
+                tree_path,
+            </if>
+            <if test="parent != null">
+                parent,
+            </if>
+            <if test="code != null">
+                code,
+            </if>
+            <if test="fullName != null">
+                full_name,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                #{id,jdbcType=BIGINT},
+            </if>
+            <if test="createDate != null">
+                #{createDate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="modifyDate != null">
+                #{modifyDate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="orders != null">
+                #{orders,jdbcType=INTEGER},
+            </if>
+            <if test="name != null">
+                #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="treePath != null">
+                #{treePath,jdbcType=VARCHAR},
+            </if>
+            <if test="parent != null">
+                #{parent,jdbcType=BIGINT},
+            </if>
+            <if test="code != null">
+                #{code,jdbcType=VARCHAR},
+            </if>
+            <if test="fullName != null">
+                #{fullName,jdbcType=LONGVARCHAR},
+            </if>
+        </trim>
+    </insert>
+    <select id="countByExample" parameterType="com.shawn.model.entity.TAreaExample" resultType="java.lang.Long">
+        select count(*) from t_area
+        <if test="_parameter != null">
+            <include refid="Example_Where_Clause"/>
+        </if>
+    </select>
+    <update id="updateByExampleSelective" parameterType="map">
+        update t_area
+        <set>
+            <if test="record.id != null">
+                id = #{record.id,jdbcType=BIGINT},
+            </if>
+            <if test="record.createDate != null">
+                create_date = #{record.createDate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="record.modifyDate != null">
+                modify_date = #{record.modifyDate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="record.orders != null">
+                orders = #{record.orders,jdbcType=INTEGER},
+            </if>
+            <if test="record.name != null">
+                name = #{record.name,jdbcType=VARCHAR},
+            </if>
+            <if test="record.treePath != null">
+                tree_path = #{record.treePath,jdbcType=VARCHAR},
+            </if>
+            <if test="record.parent != null">
+                parent = #{record.parent,jdbcType=BIGINT},
+            </if>
+            <if test="record.code != null">
+                code = #{record.code,jdbcType=VARCHAR},
+            </if>
+            <if test="record.fullName != null">
+                full_name = #{record.fullName,jdbcType=LONGVARCHAR},
+            </if>
+        </set>
+        <if test="_parameter != null">
+            <include refid="Update_By_Example_Where_Clause"/>
+        </if>
+    </update>
+    <update id="updateByExampleWithBLOBs" parameterType="map">
+        update t_area
+        set id = #{record.id,jdbcType=BIGINT},
         create_date = #{record.createDate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.modifyDate != null">
         modify_date = #{record.modifyDate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.orders != null">
         orders = #{record.orders,jdbcType=INTEGER},
-      </if>
-      <if test="record.name != null">
         name = #{record.name,jdbcType=VARCHAR},
-      </if>
-      <if test="record.treePath != null">
         tree_path = #{record.treePath,jdbcType=VARCHAR},
-      </if>
-      <if test="record.parent != null">
         parent = #{record.parent,jdbcType=BIGINT},
-      </if>
-      <if test="record.code != null">
         code = #{record.code,jdbcType=VARCHAR},
-      </if>
-      <if test="record.fullName != null">
-        full_name = #{record.fullName,jdbcType=LONGVARCHAR},
-      </if>
-    </set>
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExampleWithBLOBs" parameterType="map">
-    update t_area
-    set id = #{record.id,jdbcType=BIGINT},
-      create_date = #{record.createDate,jdbcType=TIMESTAMP},
-      modify_date = #{record.modifyDate,jdbcType=TIMESTAMP},
-      orders = #{record.orders,jdbcType=INTEGER},
-      name = #{record.name,jdbcType=VARCHAR},
-      tree_path = #{record.treePath,jdbcType=VARCHAR},
-      parent = #{record.parent,jdbcType=BIGINT},
-      code = #{record.code,jdbcType=VARCHAR},
-      full_name = #{record.fullName,jdbcType=LONGVARCHAR}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExample" parameterType="map">
-    update t_area
-    set id = #{record.id,jdbcType=BIGINT},
-      create_date = #{record.createDate,jdbcType=TIMESTAMP},
-      modify_date = #{record.modifyDate,jdbcType=TIMESTAMP},
-      orders = #{record.orders,jdbcType=INTEGER},
-      name = #{record.name,jdbcType=VARCHAR},
-      tree_path = #{record.treePath,jdbcType=VARCHAR},
-      parent = #{record.parent,jdbcType=BIGINT},
-      code = #{record.code,jdbcType=VARCHAR}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.shawn.model.entity.TArea">
-    update t_area
-    <set>
-      <if test="createDate != null">
-        create_date = #{createDate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="modifyDate != null">
-        modify_date = #{modifyDate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="orders != null">
-        orders = #{orders,jdbcType=INTEGER},
-      </if>
-      <if test="name != null">
-        name = #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="treePath != null">
-        tree_path = #{treePath,jdbcType=VARCHAR},
-      </if>
-      <if test="parent != null">
-        parent = #{parent,jdbcType=BIGINT},
-      </if>
-      <if test="code != null">
-        code = #{code,jdbcType=VARCHAR},
-      </if>
-      <if test="fullName != null">
-        full_name = #{fullName,jdbcType=LONGVARCHAR},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.shawn.model.entity.TArea">
+        full_name = #{record.fullName,jdbcType=LONGVARCHAR}
+        <if test="_parameter != null">
+            <include refid="Update_By_Example_Where_Clause"/>
+        </if>
+    </update>
+    <update id="updateByExample" parameterType="map">
+        update t_area
+        set id = #{record.id,jdbcType=BIGINT},
+        create_date = #{record.createDate,jdbcType=TIMESTAMP},
+        modify_date = #{record.modifyDate,jdbcType=TIMESTAMP},
+        orders = #{record.orders,jdbcType=INTEGER},
+        name = #{record.name,jdbcType=VARCHAR},
+        tree_path = #{record.treePath,jdbcType=VARCHAR},
+        parent = #{record.parent,jdbcType=BIGINT},
+        code = #{record.code,jdbcType=VARCHAR}
+        <if test="_parameter != null">
+            <include refid="Update_By_Example_Where_Clause"/>
+        </if>
+    </update>
+    <update id="updateByPrimaryKeySelective" parameterType="com.shawn.model.entity.TArea">
+        update t_area
+        <set>
+            <if test="createDate != null">
+                create_date = #{createDate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="modifyDate != null">
+                modify_date = #{modifyDate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="orders != null">
+                orders = #{orders,jdbcType=INTEGER},
+            </if>
+            <if test="name != null">
+                name = #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="treePath != null">
+                tree_path = #{treePath,jdbcType=VARCHAR},
+            </if>
+            <if test="parent != null">
+                parent = #{parent,jdbcType=BIGINT},
+            </if>
+            <if test="code != null">
+                code = #{code,jdbcType=VARCHAR},
+            </if>
+            <if test="fullName != null">
+                full_name = #{fullName,jdbcType=LONGVARCHAR},
+            </if>
+        </set>
+        where id = #{id,jdbcType=BIGINT}
+    </update>
+    <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.shawn.model.entity.TArea">
     update t_area
     set create_date = #{createDate,jdbcType=TIMESTAMP},
       modify_date = #{modifyDate,jdbcType=TIMESTAMP},
@@ -317,7 +320,7 @@
       full_name = #{fullName,jdbcType=LONGVARCHAR}
     where id = #{id,jdbcType=BIGINT}
   </update>
-  <update id="updateByPrimaryKey" parameterType="com.shawn.model.entity.TArea">
+    <update id="updateByPrimaryKey" parameterType="com.shawn.model.entity.TArea">
     update t_area
     set create_date = #{createDate,jdbcType=TIMESTAMP},
       modify_date = #{modifyDate,jdbcType=TIMESTAMP},
@@ -328,52 +331,68 @@
       code = #{code,jdbcType=VARCHAR}
     where id = #{id,jdbcType=BIGINT}
   </update>
-  <insert id="insertBatch" parameterType="java.util.List">
-    insert into t_area (id,create_date,modify_date,orders,name,tree_path,parent,code,full_name)
-    <foreach collection="list" index="index" item="item" separator="union all">
-      select #{item.id,jdbcType=BIGINT},#{item.createDate,jdbcType=TIMESTAMP},#{item.modifyDate,jdbcType=TIMESTAMP},#{item.orders,jdbcType=INTEGER},#{item.name,jdbcType=VARCHAR},#{item.treePath,jdbcType=VARCHAR},#{item.parent,jdbcType=BIGINT},#{item.code,jdbcType=VARCHAR},#{item.fullName,jdbcType=LONGVARCHAR} from dual
-    </foreach>
-  </insert>
-  <delete id="deleteBatchByIdList" parameterType="java.util.List">
-    DELETE FROM t_area where id in 
-    <foreach close=")" collection="list" item="item" open="(" separator=",">
-      #{item}
-    </foreach>
-  </delete>
-  <update id="updateBatchByIdList" parameterType="com.shawn.model.param.TAreaParam">
-    update t_area
-    <trim prefix="set" suffixOverrides=",">
-      <if test="id != null">
-        id = #{id},
-      </if>
-      <if test="createDate != null">
-        create_date = #{createDate},
-      </if>
-      <if test="modifyDate != null">
-        modify_date = #{modifyDate},
-      </if>
-      <if test="orders != null">
-        orders = #{orders},
-      </if>
-      <if test="name != null">
-        name = #{name},
-      </if>
-      <if test="treePath != null">
-        tree_path = #{treePath},
-      </if>
-      <if test="parent != null">
-        parent = #{parent},
-      </if>
-      <if test="code != null">
-        code = #{code},
-      </if>
-      <if test="fullName != null">
-        full_name = #{fullName},
-      </if>
-    </trim>
-     where id in 
-    <foreach close=")" collection="primaryKeyList" item="item" open="(" separator=",">
-      #{item}
-    </foreach>
-  </update>
+    <insert id="insertBatch" parameterType="java.util.List">
+        insert into t_area (id,create_date,modify_date,orders,name,tree_path,parent,code,full_name)
+        <foreach collection="list" index="index" item="item" separator="union all">
+            select
+            #{item.id,jdbcType=BIGINT},#{item.createDate,jdbcType=TIMESTAMP},#{item.modifyDate,jdbcType=TIMESTAMP},#{item.orders,jdbcType=INTEGER},#{item.name,jdbcType=VARCHAR},#{item.treePath,jdbcType=VARCHAR},#{item.parent,jdbcType=BIGINT},#{item.code,jdbcType=VARCHAR},#{item.fullName,jdbcType=LONGVARCHAR}
+            from dual
+        </foreach>
+    </insert>
+    <delete id="deleteBatchByIdList" parameterType="java.util.List">
+        DELETE FROM t_area where id in
+        <foreach close=")" collection="list" item="item" open="(" separator=",">
+            #{item}
+        </foreach>
+    </delete>
+    <update id="updateBatchByIdList" parameterType="com.shawn.model.param.TAreaParam">
+        update t_area
+        <trim prefix="set" suffixOverrides=",">
+            <if test="id != null">
+                id = #{id},
+            </if>
+            <if test="createDate != null">
+                create_date = #{createDate},
+            </if>
+            <if test="modifyDate != null">
+                modify_date = #{modifyDate},
+            </if>
+            <if test="orders != null">
+                orders = #{orders},
+            </if>
+            <if test="name != null">
+                name = #{name},
+            </if>
+            <if test="treePath != null">
+                tree_path = #{treePath},
+            </if>
+            <if test="parent != null">
+                parent = #{parent},
+            </if>
+            <if test="code != null">
+                code = #{code},
+            </if>
+            <if test="fullName != null">
+                full_name = #{fullName},
+            </if>
+        </trim>
+        where id in
+        <foreach close=")" collection="primaryKeyList" item="item" open="(" separator=",">
+            #{item}
+        </foreach>
+    </update>
+
+    <select id="getProvinceList" resultMap="ResultMapWithBLOBs">
+        SELECT
+        *
+        FROM
+         t_area b
+        WHERE
+         b.id in (
+          SELECT DISTINCT
+           (a.area_id)
+          FROM
+           t_equipment a
+         )
+  </select>
 </mapper>

File diff suppressed because it is too large
+ 952 - 924
src/main/resources/com/shawn/repository/mybatis/TEquipmentMapper.xml


+ 30 - 1
src/main/resources/com/shawn/repository/mybatis/TOrderMapper.xml

@@ -797,6 +797,35 @@ AND a.create_date >= STR_TO_DATE(CONCAT(#{startDate},' 00:00:00'),'%Y/%m/%d %H:%
       <![CDATA[ AND a.create_date <= STR_TO_DATE(CONCAT(#{endDate},' 23:59:59'),'%Y/%m/%d %H:%i:%s') ]]>
 group by b.id
 order by salePrice desc
-limit 10
+limit 30
+  </select>
+  <select id="getProvincePrice"  parameterType="com.shawn.model.param.StatisticsParam" resultType="java.lang.String">
+       SELECT
+        	sum(c.price)
+        FROM
+        	t_order c
+        WHERE
+        	c. STATUS = '1'
+        AND c.equipment_id IN (
+        	SELECT
+        		a.id
+        	FROM
+        		t_equipment a
+        	WHERE
+        	 a.admin_id != '31'
+        	 AND
+        		a.area_id IN (
+                 SELECT
+                  b.id
+                 FROM
+                  t_area b
+                 WHERE
+                  b.id = #{adminId}
+                  or
+                  b.full_name LIKE "%"#{chartType}"%"
+            	)
+        )
+         AND c.create_date >= STR_TO_DATE(CONCAT(#{startDate},' 00:00:00'),'%Y/%m/%d %H:%i:%s')
+      <![CDATA[ AND c.create_date <= STR_TO_DATE(CONCAT(#{endDate},' 23:59:59'),'%Y/%m/%d %H:%i:%s') ]]>
   </select>
 </mapper>