自动化立体仓库 - WMS系统
1
ZY
2025-03-31 9ed4cb53a2c643b879f993537f5a2793fba56ba1
src/main/java/com/zy/system/controller/OperateLogController.java
@@ -3,20 +3,21 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.zy.system.entity.OperateLog;
import com.zy.system.service.OperateLogService;
import com.core.annotations.ManagerAuth;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.controller.AbstractBaseController;
import com.zy.asrs.entity.AgvWrkMast;
import com.zy.common.web.BaseController;
import com.zy.system.entity.OperateLog;
import com.zy.system.service.OperateLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@RestController
public class OperateLogController extends AbstractBaseController {
public class OperateLogController extends BaseController {
    @Autowired
    private OperateLogService operateLogService;
@@ -33,22 +34,25 @@
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam(required = false)String condition,
                  @RequestParam Map<String, Object> param){
        excludeTrash(param);
        EntityWrapper<OperateLog> wrapper = new EntityWrapper<>();
        convert(param, wrapper);
        allLike(OperateLog.class, param.keySet(), wrapper, condition);
        wrapper.orderBy("id", false);
        return R.ok(operateLogService.selectPage(new Page<>(curr, limit), wrapper));
    }
    private void convert(Map<String, Object> map, EntityWrapper wrapper){
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
        for (Map.Entry<String, Object> entry : map.entrySet()){
            if (entry.getKey().endsWith(">")) {
                wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
            } else if (entry.getKey().endsWith("<")) {
                wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
            String val = String.valueOf(entry.getValue());
            if (val.contains(RANGE_TIME_LINK)){
                String[] dates = val.split(RANGE_TIME_LINK);
                wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
                wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
            } else {
                wrapper.like(entry.getKey(), String.valueOf(entry.getValue()));
                wrapper.like(entry.getKey(), val);
            }
        }
    }
@@ -57,7 +61,7 @@
    @ManagerAuth
    public R edit(OperateLog operateLog) {
        if (Cools.isEmpty(operateLog)){
            return R.error();
            return R.error("参数缺失");
        }
        if (null == operateLog.getId()){
            operateLogService.insert(operateLog);
@@ -78,7 +82,7 @@
    @ManagerAuth
    public R update(OperateLog operateLog){
        if (Cools.isEmpty(operateLog) || null==operateLog.getId()){
            return R.error();
            return R.error("参数缺失");
        }
        operateLogService.updateById(operateLog);
        return R.ok();
@@ -88,7 +92,7 @@
    @ManagerAuth
    public R delete(Integer[] ids){
        if (Cools.isEmpty(ids)){
            return R.error();
            return R.error("参数缺失");
        }
        operateLogService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();