yurk 2 anni fa
parent
commit
38e34f378f

+ 9 - 3
fhKeeper/formulahousekeeper/ops-platform/src/main/java/com/management/platform/controller/OperationRecordController.java

@@ -21,6 +21,7 @@ import java.time.format.DateTimeFormatter;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -41,12 +42,16 @@ public class OperationRecordController {
     private CompanyMapper companyMapper;
 
     @RequestMapping("/getList")
-    public HttpRespMsg getList(Integer companyId,String startDate,String endDate,Integer pageIndex ,Integer pageSize){
+    public HttpRespMsg getList(String companyName,String startDate,String endDate,Integer pageIndex ,Integer pageSize){
         HttpRespMsg httpRespMsg=new HttpRespMsg();
         List<Company> companyList = companyMapper.selectList(null);
         QueryWrapper<OperationRecord> queryWrapper=new QueryWrapper<>();
-        if(companyId!=null){
-            queryWrapper.eq("company_id",companyId);
+        if(companyName!=null&&companyName!=""){
+            List<Integer> list = companyList.stream().filter(cl -> cl.getCompanyName().contains(companyName)).map(Company::getId).collect(Collectors.toList());
+            if(list.size()<=0){
+                return new HttpRespMsg();
+            }
+            queryWrapper.in("company_id",list);
         }
         if(startDate!=null && endDate!=null){
             LocalDateTime start = LocalDate.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")).atTime(LocalTime.now());
@@ -62,6 +67,7 @@ public class OperationRecordController {
             if(first.isPresent()){
                 operationRecord.setCompanyName(first.get().getCompanyName());
             }
+            operationRecord.setTime(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(operationRecord.getOperationTime()));
         }
         long total=operationRecordIPage.getTotal();
         HashMap map=new HashMap();

+ 3 - 0
fhKeeper/formulahousekeeper/ops-platform/src/main/java/com/management/platform/entity/OperationRecord.java

@@ -50,6 +50,9 @@ public class OperationRecord extends Model<OperationRecord> {
     @TableField(exist = false)
     private String companyName;
 
+    @TableField(exist = false)
+    private String time;
+
 
     @Override
     protected Serializable pkVal() {