Ver código fonte

添加过滤条件

my-csc-config-file.git 4 anos atrás
pai
commit
330cde7ebf

+ 2 - 0
src/main/java/com/unissoft/mapper/StatisticsWorkCompletionMapper.java

@@ -19,5 +19,7 @@ public interface StatisticsWorkCompletionMapper extends BaseMapper<StatisticsWor
19 19
 
20 20
     IPage<StatisticsWorkCompletion> getPage(IPage<StatisticsWorkCompletion> page, @Param("depots") List<Integer> depots, @Param("sTime") String sTime);
21 21
 
22
+    IPage<StatisticsWorkCompletion> getGroupPage(IPage<StatisticsWorkCompletion> page, @Param("depots") List<Integer> depots, @Param("sTime") String sTime);
23
+
22 24
     List<StatisticsWorkCompletion> getGroupByDepotId(@Param("depots") List<Integer> depots, @Param("sTime") String sTime);
23 25
 }

+ 33 - 0
src/main/java/com/unissoft/mapper/StatisticsWorkCompletionMapper.xml

@@ -33,6 +33,7 @@
33 33
         FROM
34 34
         statistics_work_completion
35 35
         <where>
36
+            and depot_id != 1
36 37
             <if test="sTime != null and sTime != ''">
37 38
                 and DATE_FORMAT(`s_time`, '%Y%m') = DATE_FORMAT(#{sTime}, '%Y%m')
38 39
             </if>
@@ -45,12 +46,44 @@
45 46
         s_score DESC
46 47
     </select>
47 48
 
49
+    <select id="getGroupPage" resultMap="BaseResultMap">
50
+        SELECT
51
+        id,
52
+        personnel_id,
53
+        personnel_name,
54
+        s_position,
55
+        depot_id,
56
+        depot_name,
57
+        s_time,
58
+        round(AVG(monthly_work_quantity),0) monthly_work_quantity,
59
+        round(AVG(finish_on_time),0) finish_on_time,
60
+        round(AVG(late_completion),0) late_completion ,
61
+        round(AVG(s_overdue),0) s_overdue,
62
+        round(AVG(s_score),0) s_score
63
+        FROM
64
+        statistics_work_completion
65
+        <where>
66
+            and depot_id != 1
67
+            <if test="sTime != null and sTime != ''">
68
+                and DATE_FORMAT(`s_time`, '%Y%m') = DATE_FORMAT(#{sTime}, '%Y%m')
69
+            </if>
70
+            <if test="depots != null">
71
+                AND depot_id IN
72
+                <foreach item="item" collection="depots" index="index" open="(" separator="," close=")">#{item}</foreach>
73
+            </if>
74
+        </where>
75
+        GROUP BY depot_id
76
+        ORDER BY
77
+        s_score DESC
78
+    </select>
79
+
48 80
     <select id="getGroupByDepotId" resultMap="BaseResultMap">
49 81
         SELECT
50 82
         <include refid="Base_Column_List"/>
51 83
         FROM
52 84
         statistics_work_completion
53 85
         <where>
86
+            and depot_id != 1
54 87
             <if test="sTime != null and sTime != ''">
55 88
                 and DATE_FORMAT(`s_time`, '%Y%m') = DATE_FORMAT(#{sTime}, '%Y%m')
56 89
             </if>

+ 2 - 0
src/main/java/com/unissoft/mapper/SysUserActivityMapper.java

@@ -19,5 +19,7 @@ public interface SysUserActivityMapper extends BaseMapper<SysUserActivity> {
19 19
 
20 20
     IPage<SysUserActivity> getPage(IPage<SysUserActivity> page, @Param("depots") List<Integer> depots, @Param("sTime") String sTime);
21 21
 
22
+    IPage<SysUserActivity> getGroupPage(IPage<SysUserActivity> page, @Param("depots") List<Integer> depots, @Param("sTime") String sTime);
23
+
22 24
     List<SysUserActivity> getGroupByDepotId(@Param("depots") List<Integer> depots, @Param("sTime") String sTime);
23 25
 }

+ 32 - 0
src/main/java/com/unissoft/mapper/SysUserActivityMapper.xml

@@ -30,6 +30,36 @@
30 30
         FROM
31 31
         sys_user_activity
32 32
         <where>
33
+            and depot_id != 1
34
+            <if test="sTime != null and sTime != ''">
35
+                and DATE_FORMAT(`act_time`, '%Y%m') = DATE_FORMAT(#{sTime}, '%Y%m')
36
+            </if>
37
+            <if test="depots != null">
38
+                AND depot_id IN
39
+                <foreach item="item" collection="depots" index="index" open="(" separator="," close=")">#{item}</foreach>
40
+            </if>
41
+        </where>
42
+        ORDER BY
43
+        us_activity DESC
44
+    </select>
45
+
46
+    <select id="getGroupPage" resultMap="BaseResultMap">
47
+        SELECT
48
+        id,
49
+        user_id,
50
+        personnel_name,
51
+        depot_id,
52
+        depot_name,
53
+        round(AVG(province_ranking), 0) province_ranking,
54
+        depot_ranking,
55
+        s_position,
56
+        completion_id,
57
+        act_time,
58
+        round(AVG(us_activity), 0) us_activity
59
+        FROM
60
+        sys_user_activity
61
+        <where>
62
+            and depot_id != 1
33 63
             <if test="sTime != null and sTime != ''">
34 64
                 and DATE_FORMAT(`act_time`, '%Y%m') = DATE_FORMAT(#{sTime}, '%Y%m')
35 65
             </if>
@@ -38,6 +68,8 @@
38 68
                 <foreach item="item" collection="depots" index="index" open="(" separator="," close=")">#{item}</foreach>
39 69
             </if>
40 70
         </where>
71
+        GROUP BY
72
+        depot_id
41 73
         ORDER BY
42 74
         us_activity DESC
43 75
     </select>

+ 2 - 2
src/main/java/com/unissoft/ventilation/controller/StatisticsWorkCompletionController.java

@@ -31,8 +31,8 @@ public class StatisticsWorkCompletionController {
31 31
     @Autowired
32 32
     private StatisticsWorkCompletionService workCompletionService;
33 33
 
34
-    @ApiOperation(value = "统计列表分页查询,其中type属性代表是否查询单个库下面的数据(1代表单个库,空代表所有)", notes = "{\n" +
35
-            "  \"condition\": \"{'depotId':'2','sTime':'2021-03','type':'1'}\",\n" +
34
+    @ApiOperation(value = "统计列表分页查询,其中type属性代表是否查询单个库下面的数据(1代表单个库,空代表所有);groupBy=1代表查询首页跳转到分页列表,groupBy=2代表查看库内工作情况排名分页列表", notes = "{\n" +
35
+            "  \"condition\": \"{'depotId':'2','sTime':'2021-03','type':'1','groupBy':'1'}\",\n" +
36 36
             "  \"pageIndex\": 1,\n" +
37 37
             "  \"pageSize\": 10\n" +
38 38
             "}")

+ 1 - 1
src/main/java/com/unissoft/ventilation/controller/SysUserActivityController.java

@@ -29,7 +29,7 @@ public class SysUserActivityController {
29 29
     @Autowired
30 30
     private SysUserActivityService activityService;
31 31
 
32
-    @ApiOperation(value = "统计列表分页查询,其中type属性代表是否查询单个库下面的数据(1代表单个库,空代表所有)", notes = "{\n" +
32
+    @ApiOperation(value = "统计列表分页查询,其中type属性代表是否查询单个库下面的数据(1代表单个库,空代表所有);groupBy=1代表查询首页跳转到分页列表,groupBy=2代表查看库内活跃排名分页列表", notes = "{\n" +
33 33
             "  \"condition\": \"{'depotId':'2','sTime':'2021-03','type':'1'}\",\n" +
34 34
             "  \"pageIndex\": 1,\n" +
35 35
             "  \"pageSize\": 10\n" +

+ 10 - 2
src/main/java/com/unissoft/ventilation/service/impl/StatisticsWorkCompletionServiceImpl.java

@@ -44,12 +44,13 @@ public class StatisticsWorkCompletionServiceImpl extends ServiceImpl<StatisticsW
44 44
     public IPage<StatisticsWorkCompletion> getByPage(PageParam pageParam) {
45 45
         Integer pageIndex = pageParam.getPageIndex();
46 46
         Integer pageSize = pageParam.getPageSize();
47
-        String depotId = null, sTime = null, type = null;
47
+        String depotId = null, sTime = null, type = null, groupBy = null;
48 48
         if (!StringUtils.isEmpty(pageParam.getCondition())) {
49 49
             JSONObject object = new JSONObject(pageParam.getCondition());
50 50
             depotId = object.optString("depotId").trim();
51 51
             sTime = object.optString("sTime").trim();
52 52
             type = object.optString("type").trim();
53
+            groupBy = object.optString("groupBy").trim();
53 54
         }
54 55
 
55 56
         Page page = null;
@@ -72,7 +73,14 @@ public class StatisticsWorkCompletionServiceImpl extends ServiceImpl<StatisticsW
72 73
         } else {
73 74
             sTime += MyConstant.BURDEN_ZERO;
74 75
         }
75
-        IPage<StatisticsWorkCompletion> pageResult = workCompletionMapper.getPage(page, allDepotChild, sTime);
76
+        IPage<StatisticsWorkCompletion> pageResult = null;
77
+        if (groupBy.equals(MyConstant.ONE_STR)) {
78
+            //分组列表
79
+            pageResult = workCompletionMapper.getGroupPage(page, allDepotChild, sTime);
80
+        } else {
81
+            //单个库列表
82
+            pageResult = workCompletionMapper.getPage(page, allDepotChild, sTime);
83
+        }
76 84
         return pageResult;
77 85
     }
78 86
 

+ 10 - 2
src/main/java/com/unissoft/ventilation/service/impl/SysUserActivityServiceImpl.java

@@ -44,12 +44,13 @@ public class SysUserActivityServiceImpl extends ServiceImpl<SysUserActivityMappe
44 44
     public IPage<SysUserActivity> getByPage(PageParam pageParam) {
45 45
         Integer pageIndex = pageParam.getPageIndex();
46 46
         Integer pageSize = pageParam.getPageSize();
47
-        String depotId = null, sTime = null, type = null;
47
+        String depotId = null, sTime = null, type = null,groupBy=null;
48 48
         if (!StringUtils.isEmpty(pageParam.getCondition())) {
49 49
             JSONObject object = new JSONObject(pageParam.getCondition());
50 50
             depotId = object.optString("depotId").trim();
51 51
             sTime = object.optString("sTime").trim();
52 52
             type = object.optString("type").trim();
53
+            groupBy = object.optString("groupBy").trim();
53 54
         }
54 55
 
55 56
         Page page = null;
@@ -72,7 +73,14 @@ public class SysUserActivityServiceImpl extends ServiceImpl<SysUserActivityMappe
72 73
         } else {
73 74
             sTime += MyConstant.BURDEN_ZERO;
74 75
         }
75
-        IPage<SysUserActivity> pageResult = activityMapper.getPage(page, allDepotChild, sTime);
76
+        IPage<SysUserActivity> pageResult =null;
77
+        if (groupBy.equals(MyConstant.ONE_STR)){
78
+            //分组列表
79
+            pageResult = activityMapper.getGroupPage(page, allDepotChild, sTime);
80
+        }else {
81
+            //单个库列表
82
+            pageResult = activityMapper.getPage(page, allDepotChild, sTime);
83
+        }
76 84
         return pageResult;
77 85
     }
78 86