소스 검색

异常粮情机构列表

hanqingsong 3 년 전
부모
커밋
8b1e11019c
2개의 변경된 파일29개의 추가작업 그리고 47개의 파일을 삭제
  1. 23 25
      src/main/java/com/unissoft/mapper/GrainConditionRecordMapper.xml
  2. 6 22
      src/main/java/com/unissoft/model/GrainError.java

+ 23 - 25
src/main/java/com/unissoft/mapper/GrainConditionRecordMapper.xml

@@ -83,32 +83,30 @@
83 83
     </select>
84 84
     <select id="getGrainErrorCount" resultType="com.unissoft.model.GrainError">
85 85
         SELECT
86
-            gr.id pId,
87
-            grc.id cId,
88
-            gr.depot_id depotId,
89
-            gr.check_year checkYear,
90
-            gr.check_year_week checkYearWeek,
91
-            gr.house_id houseId,
92
-            grc.anomalous_status anomalousStatus,
93
-            grc.enum_id enumId,
94
-            grc.operation_time operationTime
86
+            CONCAT(
87
+            check_year,
88
+            '年',
89
+            check_year_week,
90
+            '周'
91
+            ) yearJoinWeek,
92
+            depot_id depotId,
93
+            COUNT(house_id) houseCount,
94
+            COUNT(grain_error) grainErrorCount,
95
+            max(operation_time) operationTime
95 96
         FROM
96
-            grain_condition_record gr
97
-        INNER JOIN grain_condition_record_child grc ON gr.id = grc.parent_id
98
-        AND grc.enum_id = 191
99
-        AND gr.enum_id = 19
100
-        AND grc.anomalous_status = 1
101
-        AND gr.anomalous_status = 1
102
-        <if test="params.checkYear != null">
103
-            AND gr.check_year = #{params.checkYear}
104
-        </if>
105
-        <if test="params.checkYearWeek != null">
106
-            AND gr.check_year_week = #{params.checkYearWeek}
107
-        </if>
108
-        AND gr.depot_id IN
109
-        <foreach item="depotId" collection="params.depotIds" separator="," open="(" close=")">#{depotId}</foreach>
110
-        ORDER BY
111
-            gr.check_year_week
97
+          grain_condition_record
98
+        <where>
99
+            <if test="params.checkYear != null">
100
+                AND check_year = #{params.checkYear}
101
+            </if>
102
+            <if test="params.checkYearWeek != null">
103
+                AND check_year_week = #{params.checkYearWeek}
104
+            </if>
105
+            AND depot_id IN
106
+            <foreach item="depotId" collection="params.depotIds" separator="," open="(" close=")">#{depotId}</foreach>
107
+        </where>
108
+        GROUP BY
109
+          depot_id
112 110
     </select>
113 111
 
114 112
   <!--  <select id="getByPersonAndTime"  resultType="com.unissoft.model.GrainConditionRecord">

+ 6 - 22
src/main/java/com/unissoft/model/GrainError.java

@@ -24,30 +24,14 @@ import java.util.Date;
24 24
 public class GrainError implements Serializable {
25 25
     private static final long serialVersionUID = 2162086215502754428L;
26 26
 
27
-    @ApiModelProperty(value = "粮情检测记录id")
28
-    private Integer pId;
29
-
30
-    @ApiModelProperty(value = "粮情检测记录子表id")
31
-    private Integer cId;
32
-
27
+    @ApiModelProperty(value = "2021年11周")
28
+    private String yearJoinWeek;
33 29
     @ApiModelProperty(value = "库id")
34 30
     private Integer depotId;
35
-
36
-    @ApiModelProperty(value = "检查年份(用于粮情异常等,做年统计)")
37
-    private Integer checkYear;
38
-
39
-    @ApiModelProperty(value = "检查所在年第几周")
40
-    private Integer checkYearWeek;
41
-
42
-    @ApiModelProperty(value = "仓房id")
43
-    private Integer houseId;
44
-
45
-    @ApiModelProperty(value = "是否异常_选项(0:否,1:是)")
46
-    private Integer anomalousStatus;
47
-
48
-    @ApiModelProperty(value = "检查类型(子表检查项)")
49
-    private Integer enumId;
50
-
31
+    @ApiModelProperty(value = "仓房个数")
32
+    private Integer houseCount;
33
+    @ApiModelProperty(value = "异常粮情个数")
34
+    private Integer grainErrorCount;
51 35
     @ApiModelProperty(value = "检查(操作)时间(子表)")
52 36
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
53 37
     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")