cpT
2025-06-30 5aa831dffdfb0ca524362e8d649c28babc681ece
src/main/java/com/zy/asrs/controller/BasErrLogController.java
@@ -16,10 +16,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@RestController
public class BasErrLogController extends BaseController {
@@ -40,15 +37,51 @@
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam Map<String, Object> param){
        EntityWrapper<BasErrLog> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        if (!Cools.isEmpty(orderByField)){
            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
        } else {
            wrapper.orderBy("create_time", false);
        try{
            Integer wrkNo = null;
            Integer crnNo = null;
            Integer plcNo = null;
            Integer status = null;
            String memo = null;
            Date modiTimeStart = null, modiTimeEnd = null;
            for (Map.Entry<String, Object> entry : param.entrySet()) {
                String val = String.valueOf(entry.getValue());
                if (Cools.isEmpty(val)) {
                    continue;
                }
                if (val.contains(RANGE_TIME_LINK)) {
                    String[] dates = val.split(RANGE_TIME_LINK);
                    modiTimeStart = DateUtils.convert(dates[0]);
                    modiTimeEnd = DateUtils.convert(dates[1]);
                } else if (entry.getKey().equals("wrk_no")) {
                    wrkNo = Integer.parseInt(val);
                } else if (entry.getKey().equals("crn_no")) {
                    crnNo = Integer.parseInt(val);
                } else if (entry.getKey().equals("plc_no")) {
                    plcNo = Integer.parseInt(val);
                } else if (entry.getKey().equals("status")) {
                    status = Integer.parseInt(val);
                } else if (entry.getKey().equals("condition")) {
                    memo = val;
                }
            }
//            EntityWrapper<BasErrLog> wrapper = new EntityWrapper<>();
//            excludeTrash(param);
//            convert(param, wrapper);
//            if (!Cools.isEmpty(orderByField)){
//                wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
//            } else {
//                wrapper.orderBy("CREATE_TIME", false);
//            }
            List<BasErrLog> basErrLogList = basErrLogService.selectBasErrLogList(wrkNo,crnNo,plcNo,status,memo,modiTimeStart,modiTimeEnd,curr,limit);
            Page<BasErrLog> page = new Page<BasErrLog>(curr, limit).setRecords(basErrLogList);
            page.setTotal(basErrLogService.selectBasErrLogListTotal(wrkNo,crnNo,plcNo,status,memo,modiTimeStart,modiTimeEnd));
            return R.ok(page);
        } catch (Exception e) {
            return R.error("查询失败,请检查参数:"+e.getMessage());
        }
        return R.ok(basErrLogService.selectPage(new Page<>(curr, limit), wrapper));
    }
    private void convert(Map<String, Object> map, EntityWrapper wrapper){