Administrator před 2 roky
rodič
revize
c4bf687944

+ 8 - 4
src/main/java/com/sysu/admin/controller/lz/tree/LzTreeService.java

@@ -9,7 +9,11 @@ import com.sysu.admin.controller.lz.area.LzAreaRepository;
 import com.sysu.admin.site.CommonVo;
 import com.sysu.admin.support.base.BaseService;
 import com.sysu.admin.support.system.user.User;
+import com.sysu.admin.utils.GenericsUtil;
+import com.sysu.admin.utils.SqlUtil;
+import com.sysu.admin.utils.TextUtil;
 import com.xiesx.fastboot.core.jpa.JpaPlusRepository;
+import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -26,11 +30,11 @@ public class LzTreeService extends BaseService<LzTree, Integer> {
     public List<LzTree> findAll(CommonVo vo){
         String filter = " where 1=1 ";
         if(vo != null){
-            if(vo.getClazzId() != null){
-                filter += " and c.id = " + vo.getClazzId();
+            if(ArrayUtils.isNotEmpty(vo.getClazzIds())){
+                filter += SqlUtil.ArrayToInSql("and", "c.id", vo.getClazzIds());
             }
-            if(vo.getPeriodId() != null){
-                filter += " and b.lzPeriod.id = " + vo.getPeriodId();
+            if(ArrayUtils.isNotEmpty(vo.getPeriodIds())){
+                filter += SqlUtil.ArrayToInSql("and", "b.lzPeriod.id", vo.getPeriodIds());
             }
         }
         String sql = "SELECT a, b, c FROM LzTree a JOIN FETCH a.lzEveryday b JOIN FETCH a.clazz c";

+ 2 - 0
src/main/java/com/sysu/admin/site/CommonVo.java

@@ -11,7 +11,9 @@ public class CommonVo {
     private String code;
     private Integer level;
     private Integer clazzId;
+    private Integer[] clazzIds;
     private Integer periodId;
+    private Integer[] periodIds;
     private Double x1;
     private Double y1;
     private Double x2;

+ 2 - 2
src/main/java/com/sysu/admin/site/lz/LzTreeController.java

@@ -47,9 +47,9 @@ public class LzTreeController {
             LzEveryday lzEveryday = lzTree.getLzEveryday();
             lzTree.setWkt(GeoCastUtil.geomToWkt(lzTree.getPoint()));
             Integer warning = WarningCondition.getWarning(lzEveryday.getLzPeriod().getId(), lzEveryday.getWhitePoint());
-            if(warning == 1 || i % 10 == 0) {
+//            if(warning == 1 || i % 10 == 0) {
                 res.add(lzTree);
-            }
+//            }
             lzTree.setPartImgUrl(lzEveryday.getPartImgUrl());
             lzTree.setWarning(warning);
             i++;