diff --git a/src/main/java/com/glxp/api/controller/auth/SysMenuController.java b/src/main/java/com/glxp/api/controller/auth/SysMenuController.java index 84f3d489..6fbe78db 100644 --- a/src/main/java/com/glxp/api/controller/auth/SysMenuController.java +++ b/src/main/java/com/glxp/api/controller/auth/SysMenuController.java @@ -1,5 +1,6 @@ package com.glxp.api.controller.auth; +import cn.hutool.core.lang.tree.Tree; import cn.hutool.http.HttpUtil; import com.glxp.api.constant.Constant; import com.glxp.api.controller.BaseController; @@ -61,7 +62,8 @@ public class SysMenuController extends BaseController { public BaseResponse treeselect(SysMenu menu) { AuthAdmin authAdmin = customerService.getUserBean(); List menus = menuService.selectMenuList(menu, authAdmin.getId()); - return ResultVOUtils.success(menuService.buildMenuTreeSelect(menus)); + List> data = menuService.buildMenuTreeSelect(menus); + return ResultVOUtils.success(data); } /** diff --git a/src/main/java/com/glxp/api/controller/monitor/SysLogininforController.java b/src/main/java/com/glxp/api/controller/monitor/SysLogininforController.java new file mode 100644 index 00000000..fcb1763a --- /dev/null +++ b/src/main/java/com/glxp/api/controller/monitor/SysLogininforController.java @@ -0,0 +1,63 @@ +package com.glxp.api.controller.monitor; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import com.github.pagehelper.PageInfo; +import com.glxp.api.annotation.Log; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.constant.BusinessType; +import com.glxp.api.controller.BaseController; +import com.glxp.api.entity.monitor.SysLogininfor; +import com.glxp.api.req.monitor.SysLogininforRequest; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.service.monitor.ISysLogininforService; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; + +/** + * 系统访问记录 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/monitor/logininfor") +public class SysLogininforController extends BaseController { + + private final ISysLogininforService logininforService; + + /** + * 获取系统访问记录列表 + */ + @SaCheckPermission("monitor:logininfor:list") + @GetMapping("/list") + public BaseResponse list(SysLogininforRequest sysLogininforRequest) { + + List selectLogininforList = logininforService.selectLogininforList(sysLogininforRequest); + PageInfo pageInfo; + pageInfo = new PageInfo<>(selectLogininforList); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(selectLogininforList); + return ResultVOUtils.success(pageSimpleResponse); + } + + + /** + * 批量删除登录日志 + * + * @param infoIds 日志ids + */ + @SaCheckPermission("monitor:logininfor:remove") + @Log(title = "登录日志", businessType = BusinessType.DELETE) + @DeleteMapping("/{infoIds}") + public BaseResponse remove(@PathVariable Long[] infoIds) { + int i = logininforService.deleteLogininforByIds(Arrays.asList(infoIds)); + return ResultVOUtils.success("删除成功!"); + } + + +} diff --git a/src/main/java/com/glxp/api/controller/monitor/SysOperlogController.java b/src/main/java/com/glxp/api/controller/monitor/SysOperlogController.java new file mode 100644 index 00000000..54cd1008 --- /dev/null +++ b/src/main/java/com/glxp/api/controller/monitor/SysOperlogController.java @@ -0,0 +1,62 @@ +package com.glxp.api.controller.monitor; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import com.github.pagehelper.PageInfo; +import com.glxp.api.annotation.Log; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.constant.BusinessType; +import com.glxp.api.controller.BaseController; +import com.glxp.api.entity.monitor.SysOperLog; +import com.glxp.api.req.monitor.SysOperLogRequest; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.service.monitor.ISysOperLogService; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 操作日志记录 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/monitor/operlog") +public class SysOperlogController extends BaseController { + + private final ISysOperLogService operLogService; + + /** + * 获取操作日志记录列表 + */ + @SaCheckPermission("monitor:operlog:list") + @GetMapping("/list") + public BaseResponse list(SysOperLogRequest sysOperLogRequest) { + + List selectOperLogList = operLogService.selectOperLogList(sysOperLogRequest); + PageInfo pageInfo; + pageInfo = new PageInfo<>(selectOperLogList); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(selectOperLogList); + return ResultVOUtils.success(pageSimpleResponse); + } + + + /** + * 批量删除操作日志记录 + * + * @param operIds 日志ids + */ + @Log(title = "操作日志", businessType = BusinessType.DELETE) + @SaCheckPermission("monitor:operlog:remove") + @DeleteMapping("/{operIds}") + public BaseResponse remove(@PathVariable Long[] operIds) { + + int i = operLogService.deleteOperLogByIds(operIds); + return ResultVOUtils.success("删除成功!"); + } + +} diff --git a/src/main/java/com/glxp/api/entity/auth/SysMenu.java b/src/main/java/com/glxp/api/entity/auth/SysMenu.java index efe5a75f..db4c96ce 100644 --- a/src/main/java/com/glxp/api/entity/auth/SysMenu.java +++ b/src/main/java/com/glxp/api/entity/auth/SysMenu.java @@ -1,9 +1,11 @@ package com.glxp.api.entity.auth; import lombok.Data; +import lombok.EqualsAndHashCode; @Data +@EqualsAndHashCode(callSuper = true) public class SysMenu extends TreeEntity { /** diff --git a/src/main/java/com/glxp/api/entity/auth/TreeEntity.java b/src/main/java/com/glxp/api/entity/auth/TreeEntity.java index 3f900abf..8fc21f69 100644 --- a/src/main/java/com/glxp/api/entity/auth/TreeEntity.java +++ b/src/main/java/com/glxp/api/entity/auth/TreeEntity.java @@ -2,6 +2,7 @@ package com.glxp.api.entity.auth; import com.glxp.api.entity.BaseEntity; import lombok.Data; +import lombok.EqualsAndHashCode; import java.util.ArrayList; import java.util.List; @@ -11,6 +12,7 @@ import java.util.List; */ @Data +@EqualsAndHashCode(callSuper = true) public class TreeEntity extends BaseEntity { diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 9865bb2f..c79f5a30 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -5,9 +5,9 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://127.0.0.1:3306/udi_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true + jdbc-url: jdbc:mysql://192.168.0.66:3364/udi_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true username: root - password: 123456 + password: Glxp@6066 hikari: connection-timeout: 60000 maximum-pool-size: 60 diff --git a/src/main/resources/mybatis/mapper/auth/SysMenuDao.xml b/src/main/resources/mybatis/mapper/auth/SysMenuDao.xml index a7823d95..8a3f1964 100644 --- a/src/main/resources/mybatis/mapper/auth/SysMenuDao.xml +++ b/src/main/resources/mybatis/mapper/auth/SysMenuDao.xml @@ -112,7 +112,7 @@ and menu_id ]]> #{neMenuId} - order by order_num + order by parent_id, order_num