xiugai
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csdevice.controller.equipment;
|
package com.njcn.csdevice.controller.equipment;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
||||||
@@ -63,14 +64,10 @@ public class CsLogController extends BaseController {
|
|||||||
@PostMapping("/queryLog")
|
@PostMapping("/queryLog")
|
||||||
@ApiOperation("查询日志")
|
@ApiOperation("查询日志")
|
||||||
@ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true)
|
@ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true)
|
||||||
public HttpResult<List<CsLogsPO>> queryLog(@RequestBody BaseParam baseParam){
|
public HttpResult<IPage<CsLogsPO>> queryLog(@RequestBody BaseParam baseParam){
|
||||||
String username = RequestUtil.getUsername();
|
IPage<CsLogsPO> list = csLogsPOService.queryPage(baseParam);
|
||||||
String userRole = RequestUtil.getUserRole();
|
|
||||||
List<String> strings = JSONArray.parseArray(userRole, String.class);
|
|
||||||
String methodDescribe = getMethodDescribe("queryLog");
|
String methodDescribe = getMethodDescribe("queryLog");
|
||||||
List<CsLogsPO> list = csLogsPOService.lambdaQuery().eq(!strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode()),CsLogsPO::getUserName, username).
|
|
||||||
ge(StringUtils.isNotBlank(baseParam.getSearchBeginTime()),CsLogsPO::getCreateTime,baseParam.getSearchBeginTime()).
|
|
||||||
le(StringUtils.isNotBlank(baseParam.getSearchEndTime()),CsLogsPO::getCreateTime,baseParam.getSearchEndTime()).orderByDesc(CsLogsPO::getCreateTime).list();
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
package com.njcn.csdevice.service;
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.AppProjectVO;
|
||||||
|
import com.njcn.user.enums.AppRoleEnum;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -32,4 +40,18 @@ public class CsLogsPOServiceImpl extends ServiceImpl<CsLogsPOMapper, CsLogsPO> i
|
|||||||
csPO.setUpdateBy(deviceLogDTO.getUserIndex());
|
csPO.setUpdateBy(deviceLogDTO.getUserIndex());
|
||||||
this.save(csPO);
|
this.save(csPO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<CsLogsPO> queryPage(BaseParam baseParam) {
|
||||||
|
Page<CsLogsPO> returnpage = new Page<> (baseParam.getPageNum ( ), baseParam.getPageSize ( ));
|
||||||
|
String username = RequestUtil.getUsername();
|
||||||
|
String userRole = RequestUtil.getUserRole();
|
||||||
|
List<String> strings = JSONArray.parseArray(userRole, String.class);
|
||||||
|
QueryWrapper<CsLogsPO> csLogsPOQueryWrapper = new QueryWrapper<>();
|
||||||
|
csLogsPOQueryWrapper.lambda().eq(!strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode()),CsLogsPO::getUserName, username).
|
||||||
|
ge(StringUtils.isNotBlank(baseParam.getSearchBeginTime()),CsLogsPO::getCreateTime,baseParam.getSearchBeginTime()).
|
||||||
|
le(StringUtils.isNotBlank(baseParam.getSearchEndTime()),CsLogsPO::getCreateTime,baseParam.getSearchEndTime()).orderByDesc(CsLogsPO::getCreateTime);
|
||||||
|
IPage<CsLogsPO> list = this.getBaseMapper().selectPage(returnpage,csLogsPOQueryWrapper);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
/**
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
|
||||||
|
/**
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Date: 2023/8/7 14:02【需求编号】
|
* Date: 2023/8/7 14:02【需求编号】
|
||||||
@@ -15,4 +18,6 @@ public interface CsLogsPOService extends IService<CsLogsPO>{
|
|||||||
|
|
||||||
|
|
||||||
void addLog(DeviceLogDTO deviceLogDTO);
|
void addLog(DeviceLogDTO deviceLogDTO);
|
||||||
|
|
||||||
|
IPage<CsLogsPO> queryPage(BaseParam baseParam);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user