zhangy 2 lat temu
rodzic
commit
3db3f474ce

+ 18 - 1
src/main/java/com/steerinfo/ems/emssafeinfo/controller/EmsSafeinfoController.java

@@ -61,7 +61,24 @@ public class EmsSafeinfoController extends BaseRESTfulController {
     //@RequiresPermissions("emssafeinfo:view")
     @GetMapping(value = "/")
     public RESTfulResult list(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
-        PageList<EmsSafeinfo> list = emsSafeinfoService.queryForPage(parmas, pageNum, pageSize);
+        HashMap<String,Object> hashMap = new HashMap<>();
+        String[] arr= null;
+        String[] arr2= null;
+        String dates=null;
+        String dates2=null;
+        if (parmas.get("process")!=null){
+            arr =parmas.get("process").toString().split(",");
+        }
+
+        if (parmas.get("type")!=null){
+            arr2 =parmas.get("type").toString().split(",");
+
+        }
+        if (parmas.get("dates")!=null && parmas.get("dates2")!=null){
+             dates=parmas.get("dates").toString();
+             dates2 = parmas.get("dates2").toString();
+        }
+        PageList<EmsSafeinfo> list = emsSafeinfoService.queryForPage2(dates,dates2,arr2,arr, pageNum, pageSize);
         return success(list);
     }
 

+ 7 - 1
src/main/java/com/steerinfo/ems/emssafeinfo/mapper/EmsSafeinfoMapper.java

@@ -3,8 +3,14 @@ package com.steerinfo.ems.emssafeinfo.mapper;
 import com.steerinfo.ems.emssafeinfo.model.EmsSafeinfo;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface EmsSafeinfoMapper extends IBaseMapper<EmsSafeinfo, Short> {
     String selectmaxid();
-}
+
+    List<EmsSafeinfo> selectByParameters2(@Param("dates") String dates, @Param("dates2") String dates2, @Param("type") String[] type, @Param("process") String[] process);
+}

+ 41 - 1
src/main/java/com/steerinfo/ems/emssafeinfo/mapper/EmsSafeinfoMapper.xml

@@ -279,7 +279,47 @@
   </select>
   <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
     <include refid="select"/>
-    <include refid="where"/>
+    <where>
+      <if test="id != null">
+        and ID = #{id}
+      </if>
+      <if test="process != null and process != ''">
+        and PROCESS in
+        <foreach collection="array" index="index" item="process" open="(" separator="," close=")">
+          #{process}
+        </foreach>
+      </if>
+      <if test="type != null and type != ''">
+        and TYPE in
+        <foreach collection="array" index="index" item="type" open="(" separator="," close=")">
+          #{type}
+        </foreach>
+      </if>
+      <if test="dates != null and dates != ''">
+        and DATES BETWEEN #{dates} and #{dates2}
+      </if>
+    </where>
+  </select>
+
+  <select id="selectByParameters2"  resultMap="BaseResultMap">
+    <include refid="select"/>
+    <where>
+      <if test="process != null and process != ''">
+        and PROCESS in
+        <foreach collection="process" index="index" item="process" open="(" separator="," close=")">
+          #{process}
+        </foreach>
+      </if>
+      <if test="type != null and type != ''">
+        and TYPE in
+        <foreach collection="type" index="index" item="type" open="(" separator="," close=")">
+          #{type}
+        </foreach>
+      </if>
+      <if test="dates != null and dates != ''">
+        and DATES BETWEEN #{dates} and #{dates2}
+      </if>
+    </where>
   </select>
   <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
     <include refid="select"/>

+ 3 - 3
src/main/java/com/steerinfo/ems/emssafeinfo/service/IEmsSafeinfoService.java

@@ -2,6 +2,7 @@ package com.steerinfo.ems.emssafeinfo.service;
 
 import com.steerinfo.ems.emssafeinfo.model.EmsSafeinfo;
 import com.steerinfo.framework.service.IBaseService;
+import com.steerinfo.framework.service.pagehelper.PageList;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
@@ -24,7 +25,6 @@ public interface IEmsSafeinfoService extends IBaseService<EmsSafeinfo, Short>{
     List<EmsSafeinfo> batchImport(String fileName, MultipartFile file) throws Exception;
 
     List<EmsSafeinfo> getList(Map<String, Object> parameters);
+    PageList<EmsSafeinfo> queryForPage2(String dates, String dates2, String[] type, String[] process, Integer pageNum, Integer pageSize);
 
-
-
-}
+}

+ 11 - 0
src/main/java/com/steerinfo/ems/emssafeinfo/service/impl/EmsSafeinfoServiceImpl.java

@@ -7,6 +7,9 @@ import com.steerinfo.ems.emssafeinfo.service.IEmsSafeinfoService;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
 
+import com.steerinfo.framework.service.pagehelper.PageHelper;
+import com.steerinfo.framework.service.pagehelper.PageList;
+import org.apache.ibatis.annotations.Param;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.Cell;
@@ -104,4 +107,12 @@ public class EmsSafeinfoServiceImpl extends BaseServiceImpl<EmsSafeinfo, Short>
         List<EmsSafeinfo> list = this.getMapper().selectByParameters(parameters);
         return list;
     }
+
+    @Override
+    public PageList<EmsSafeinfo> queryForPage2(String dates,String dates2,String[] type,String[] process, Integer pageNum, Integer pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<EmsSafeinfo> rows = emsSafeinfoMapper.selectByParameters2( dates, dates2, type,process);
+        PageList pageInfo = new PageList(rows);
+        return pageInfo;
+    }
 }