whyclxw
2025-03-25 a7fef2846505b08e0711345b17902e7381612d23
src/main/java/com/whyc/service/OperationLogService.java
@@ -9,8 +9,10 @@
import com.whyc.mapper.OperationLogMapper;
import com.whyc.pojo.db_user.OperationLog;
import com.whyc.pojo.db_user.UserInf;
import com.whyc.util.ActionUtil;
import com.whyc.util.HttpUtil;
import com.whyc.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -21,6 +23,13 @@
    @Resource
    private OperationLogMapper mapper;
    @Autowired(required = false)
    private AreaInfService areaInfService;
    @Autowired(required = false)
    private AreaUserService areaUserService;
    public void record(Integer type1, Integer type2, String msg, String detail) {
@@ -80,10 +89,15 @@
    public Response getPage(OperationLog param) {
        Integer pageNum = param.getPageNum();
        Integer pageSize = param.getPageSize();
        PageHelper.startPage(pageNum,pageSize);
        QueryWrapper<OperationLog> query = Wrappers.query();
        if(param.getUserName() != null){
            query.eq("user_name",param.getUserName());
        }
        UserInf uinf= ActionUtil.getUser();
        List areaList=areaInfService.getAllAreaUser(uinf.getUid(),uinf.getUrole());
        List<String> unameList=areaUserService.getUserNameByAreaIds(areaList);
        if(unameList != null){
            query.in("user_name",unameList);
        }
        if(param.getType1() != null){
            query.eq("type1",param.getType1());
@@ -98,6 +112,7 @@
            query.le("create_time", param.getEndTime());
        }
        query.orderByDesc("id");
        PageHelper.startPage(pageNum,pageSize);
        List<OperationLog> operationLogs = mapper.selectList(query);
        injectTypeName(operationLogs);
        PageInfo<OperationLog> pageInfo = new PageInfo<>(operationLogs);