mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 04:39:00 +08:00
🔊 Adding logs. add method log @SysLog
This commit is contained in:
1 parent
c77668bd0a
commit
fa01371f09
17 files changed
+86
-45
No files matched your search
+14
-10
@@ -20,9 +20,12 @@ package com.pig4cloud.pigx.gateway.filter;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstant;
|
||||
import com.pig4cloud.pigx.common.core.exception.CheckedException;
|
||||
import com.pig4cloud.pigx.common.core.exception.ValidateCodeException;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.gateway.config.FilterIgnorePropertiesConfig;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -34,6 +37,7 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
import org.springframework.stereotype.Component;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -48,6 +52,7 @@ import java.io.IOException;
|
||||
public class ValidateCodeGatewayFilter extends AbstractGatewayFilterFactory {
|
||||
static final String OAUTH_TOKEN_URL = "/oauth/token";
|
||||
private static final String BASIC_ = "Basic ";
|
||||
private final ObjectMapper objectMapper;
|
||||
private final RedisTemplate redisTemplate;
|
||||
private final FilterIgnorePropertiesConfig filterIgnorePropertiesConfig;
|
||||
|
||||
@@ -120,19 +125,18 @@ public class ValidateCodeGatewayFilter extends AbstractGatewayFilterFactory {
|
||||
if (filterIgnorePropertiesConfig.getClients().contains(clientInfos[0])) {
|
||||
return chain.filter(exchange);
|
||||
}
|
||||
|
||||
//校验验证码
|
||||
checkCode(request);
|
||||
} catch (Exception e) {
|
||||
ServerHttpResponse response = exchange.getResponse();
|
||||
response.setStatusCode(HttpStatus.PRECONDITION_REQUIRED);
|
||||
return response.setComplete();
|
||||
}
|
||||
|
||||
//校验验证码合法性
|
||||
try {
|
||||
checkCode(request);
|
||||
} catch (ValidateCodeException e) {
|
||||
ServerHttpResponse response = exchange.getResponse();
|
||||
response.setStatusCode(HttpStatus.PRECONDITION_REQUIRED);
|
||||
return response.setComplete();
|
||||
try {
|
||||
return response.writeWith(Mono.just(response.bufferFactory()
|
||||
.wrap(objectMapper.writeValueAsBytes(new R<>(e)))));
|
||||
} catch (JsonProcessingException e1) {
|
||||
log.error("对象输出异常", e1);
|
||||
}
|
||||
}
|
||||
|
||||
return chain.filter(exchange);
|
||||
|
||||
+4
@@ -24,6 +24,7 @@ import com.pig4cloud.pigx.admin.api.dto.DeptTree;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysDept;
|
||||
import com.pig4cloud.pigx.admin.service.SysDeptService;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -77,6 +78,7 @@ public class DeptController {
|
||||
* @param sysDept 实体
|
||||
* @return success/false
|
||||
*/
|
||||
@SysLog("添加部门")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_dept_add')")
|
||||
public R<Boolean> add(@Valid @RequestBody SysDept sysDept) {
|
||||
@@ -89,6 +91,7 @@ public class DeptController {
|
||||
* @param id ID
|
||||
* @return success/false
|
||||
*/
|
||||
@SysLog("删除部门")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_dept_del')")
|
||||
public R<Boolean> delete(@PathVariable Integer id) {
|
||||
@@ -101,6 +104,7 @@ public class DeptController {
|
||||
* @param sysDept 实体
|
||||
* @return success/false
|
||||
*/
|
||||
@SysLog("编辑部门")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_dept_edit')")
|
||||
public Boolean edit(@Valid @RequestBody SysDept sysDept) {
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class LogController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID
|
||||
* 删除日志
|
||||
*
|
||||
* @param id ID
|
||||
* @return success/false
|
||||
|
||||
+10
-1
@@ -27,6 +27,7 @@ import com.pig4cloud.pigx.admin.api.vo.TreeUtil;
|
||||
import com.pig4cloud.pigx.admin.service.SysMenuService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstant;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -111,6 +112,7 @@ public class MenuController {
|
||||
* @param sysMenu 菜单信息
|
||||
* @return success/false
|
||||
*/
|
||||
@SysLog("新增菜单")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_menu_add')")
|
||||
public R<Boolean> menu(@Valid @RequestBody SysMenu sysMenu) {
|
||||
@@ -122,14 +124,21 @@ public class MenuController {
|
||||
*
|
||||
* @param id 菜单ID
|
||||
* @return success/false
|
||||
* TODO 级联删除下级节点
|
||||
*/
|
||||
@SysLog("删除菜单")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_menu_del')")
|
||||
public R<Boolean> menuDel(@PathVariable Integer id) {
|
||||
return new R<>(sysMenuService.deleteMenu(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新菜单
|
||||
*
|
||||
* @param sysMenu
|
||||
* @return
|
||||
*/
|
||||
@SysLog("更新菜单")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_menu_edit')")
|
||||
public R<Boolean> menuUpdate(@Valid @RequestBody SysMenu sysMenu) {
|
||||
|
||||
+7
-7
@@ -19,11 +19,13 @@ package com.pig4cloud.pigx.admin.controller;
|
||||
|
||||
import com.pig4cloud.pigx.admin.service.MobileService;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@@ -34,14 +36,12 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/mobile")
|
||||
@Api(value = "mobile",description = "手机管理模块")
|
||||
@Api(value = "mobile", description = "手机管理模块")
|
||||
public class MobileController {
|
||||
private final MobileService mobileService;
|
||||
|
||||
@ResponseBody
|
||||
@SysLog("发送验证码")
|
||||
@GetMapping("/{mobile}")
|
||||
@ApiOperation(value = "发送手机验证码", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "mobile", value = "手机号", paramType = "path", type = "string", required = true)
|
||||
public R<Boolean> code(@PathVariable String mobile) {
|
||||
return mobileService.sendSmsCode(mobile);
|
||||
}
|
||||
|
||||
+5
-1
@@ -25,6 +25,7 @@ import com.pig4cloud.pigx.admin.api.entity.SysOauthClientDetails;
|
||||
import com.pig4cloud.pigx.admin.service.SysOauthClientDetailsService;
|
||||
import com.pig4cloud.pigx.common.core.util.Query;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -44,7 +45,7 @@ import java.util.Map;
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/client")
|
||||
@Api(value = "client",description = "客户端管理模块")
|
||||
@Api(value = "client", description = "客户端管理模块")
|
||||
public class OauthClientDetailsController {
|
||||
private final SysOauthClientDetailsService sysOauthClientDetailsService;
|
||||
|
||||
@@ -77,6 +78,7 @@ public class OauthClientDetailsController {
|
||||
* @param sysOauthClientDetails 实体
|
||||
* @return success/false
|
||||
*/
|
||||
@SysLog("添加终端")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_client_add')")
|
||||
public R<Boolean> add(@Valid @RequestBody SysOauthClientDetails sysOauthClientDetails) {
|
||||
@@ -89,6 +91,7 @@ public class OauthClientDetailsController {
|
||||
* @param id ID
|
||||
* @return success/false
|
||||
*/
|
||||
@SysLog("删除终端")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_client_del')")
|
||||
public R<Boolean> delete(@PathVariable String id) {
|
||||
@@ -101,6 +104,7 @@ public class OauthClientDetailsController {
|
||||
* @param sysOauthClientDetails 实体
|
||||
* @return success/false
|
||||
*/
|
||||
@SysLog("编辑终端")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_client_edit')")
|
||||
public R<Boolean> edit(@Valid @RequestBody SysOauthClientDetails sysOauthClientDetails) {
|
||||
|
||||
+12
-1
@@ -26,6 +26,7 @@ import com.pig4cloud.pigx.admin.service.SysRoleMenuService;
|
||||
import com.pig4cloud.pigx.admin.service.SysRoleService;
|
||||
import com.pig4cloud.pigx.common.core.util.Query;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -41,7 +42,7 @@ import java.util.Map;
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/role")
|
||||
@Api(value = "role",description = "角色管理模块")
|
||||
@Api(value = "role", description = "角色管理模块")
|
||||
public class RoleController {
|
||||
private final SysRoleService sysRoleService;
|
||||
private final SysRoleMenuService sysRoleMenuService;
|
||||
@@ -63,6 +64,7 @@ public class RoleController {
|
||||
* @param sysRole 角色信息
|
||||
* @return success、false
|
||||
*/
|
||||
@SysLog("添加角色")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_role_add')")
|
||||
public R<Boolean> role(@RequestBody SysRole sysRole) {
|
||||
@@ -75,12 +77,20 @@ public class RoleController {
|
||||
* @param sysRole 角色信息
|
||||
* @return success/false
|
||||
*/
|
||||
@SysLog("修改角色")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_role_edit')")
|
||||
public R<Boolean> roleUpdate(@RequestBody SysRole sysRole) {
|
||||
return new R<>(sysRoleService.updateById(sysRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@SysLog("删除角色")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_role_del')")
|
||||
public R<Boolean> roleDel(@PathVariable Integer id) {
|
||||
@@ -116,6 +126,7 @@ public class RoleController {
|
||||
* @param menuIds 菜单ID拼成的字符串,每个id之间根据逗号分隔
|
||||
* @return success、false
|
||||
*/
|
||||
@SysLog("更新角色菜单")
|
||||
@PutMapping("/upd-menu")
|
||||
@PreAuthorize("@pms.hasPermission('sys_role_perm')")
|
||||
public R<Boolean> roleMenuUpd(Integer roleId, @RequestParam(value = "menuIds", required = false) String menuIds) {
|
||||
|
||||
+2
@@ -20,6 +20,7 @@ package com.pig4cloud.pigx.admin.controller;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import com.pig4cloud.pigx.admin.service.SysRouteConfService;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -55,6 +56,7 @@ public class SysRouteConfController {
|
||||
* @param routes 路由定义
|
||||
* @return
|
||||
*/
|
||||
@SysLog("修改路由")
|
||||
@PutMapping
|
||||
public R edit(@RequestBody JSONArray routes) {
|
||||
return new R(sysRouteConfService.editRoutes(routes));
|
||||
|
||||
+5
-1
@@ -25,6 +25,7 @@ import com.pig4cloud.pigx.admin.service.SysSocialDetailsService;
|
||||
import com.pig4cloud.pigx.admin.service.SysUserService;
|
||||
import com.pig4cloud.pigx.common.core.util.Query;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -42,7 +43,7 @@ import java.util.Map;
|
||||
@RestController
|
||||
@RequestMapping("/social")
|
||||
@AllArgsConstructor
|
||||
@Api(value = "social",description = "三方账号管理模块")
|
||||
@Api(value = "social", description = "三方账号管理模块")
|
||||
public class SysSocialDetailsController {
|
||||
private final SysUserService sysUserService;
|
||||
private final SysSocialDetailsService sysSocialDetailsService;
|
||||
@@ -78,6 +79,7 @@ public class SysSocialDetailsController {
|
||||
* @param sysSocialDetails
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("保存三方信息")
|
||||
@PostMapping
|
||||
public R save(@Valid @RequestBody SysSocialDetails sysSocialDetails) {
|
||||
sysSocialDetailsService.insert(sysSocialDetails);
|
||||
@@ -90,6 +92,7 @@ public class SysSocialDetailsController {
|
||||
* @param sysSocialDetails
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("修改三方信息")
|
||||
@PutMapping
|
||||
public R update(@Valid @RequestBody SysSocialDetails sysSocialDetails) {
|
||||
sysSocialDetailsService.updateById(sysSocialDetails);
|
||||
@@ -102,6 +105,7 @@ public class SysSocialDetailsController {
|
||||
* @param id
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("删除三方信息")
|
||||
@DeleteMapping("/{id}")
|
||||
public R delete(@PathVariable Integer id) {
|
||||
return new R<>(sysSocialDetailsService.deleteById(id));
|
||||
|
||||
+3
-1
@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.pig4cloud.pigx.admin.api.feign.RemoteTokenService;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -36,7 +37,7 @@ import java.util.Map;
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/token")
|
||||
@Api(value = "token",description = "令牌管理模块")
|
||||
@Api(value = "token", description = "令牌管理模块")
|
||||
public class TokenController {
|
||||
private final RemoteTokenService remoteTokenService;
|
||||
|
||||
@@ -57,6 +58,7 @@ public class TokenController {
|
||||
* @param id ID
|
||||
* @return success/false
|
||||
*/
|
||||
@SysLog("删除用户token")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_token_del')")
|
||||
public R<Boolean> delete(@PathVariable String id) {
|
||||
|
||||
+2
@@ -154,6 +154,7 @@ public class UserController {
|
||||
* @param userDto 用户信息
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("更新用户信息")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_user_edit')")
|
||||
public R<Boolean> userUpdate(@Valid @RequestBody UserDTO userDto) {
|
||||
@@ -178,6 +179,7 @@ public class UserController {
|
||||
* @param userDto userDto
|
||||
* @return success/false
|
||||
*/
|
||||
@SysLog("修改个人信息")
|
||||
@PutMapping("/edit")
|
||||
public R<Boolean> editInfo(@Valid @RequestBody UserDTO userDto) {
|
||||
return userService.updateUserInfo(userDto, SecurityUtils.getUser().getUsername());
|
||||
|
||||
+2
@@ -27,6 +27,7 @@ import com.pig4cloud.pigx.admin.mapper.SysDeptRelationMapper;
|
||||
import com.pig4cloud.pigx.admin.service.SysDeptRelationService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -50,6 +51,7 @@ public class SysDeptRelationServiceImpl extends ServiceImpl<SysDeptRelationMappe
|
||||
* @param sysDept 部门
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertDeptRelation(SysDept sysDept) {
|
||||
//增加部门关系表
|
||||
SysDeptRelation condition = new SysDeptRelation();
|
||||
|
||||
+4
@@ -31,6 +31,7 @@ import com.pig4cloud.pigx.admin.service.SysDeptService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -55,6 +56,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertDept(SysDept dept) {
|
||||
SysDept sysDept = new SysDept();
|
||||
BeanUtils.copyProperties(dept, sysDept);
|
||||
@@ -71,6 +73,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
* @return 成功、失败
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteDeptById(Integer id) {
|
||||
this.deleteById(id);
|
||||
sysDeptRelationService.deleteAllDeptRealtion(id);
|
||||
@@ -84,6 +87,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
* @return 成功、失败
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateDeptById(SysDept sysDept) {
|
||||
//更新部门状态
|
||||
this.updateById(sysDept);
|
||||
|
||||
+2
@@ -31,6 +31,7 @@ import lombok.AllArgsConstructor;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -55,6 +56,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@CacheEvict(value = "menu_details", allEntries = true)
|
||||
public Boolean deleteMenu(Integer id) {
|
||||
// 查询父节点为当前节点的节点
|
||||
|
||||
+2
@@ -29,6 +29,7 @@ import lombok.AllArgsConstructor;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -54,6 +55,7 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@CacheEvict(value = "menu_details", key = "#roleId + '_menu'")
|
||||
public Boolean insertRoleMenus(String role, Integer roleId, String menuIds) {
|
||||
SysRoleMenu condition = new SysRoleMenu();
|
||||
|
||||
+2
@@ -35,6 +35,7 @@ import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.net.URI;
|
||||
@@ -79,6 +80,7 @@ public class SysRouteConfServiceImpl extends ServiceImpl<SysRouteConfMapper, Sys
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Mono<Void> editRoutes(JSONArray routes) {
|
||||
// 清空Redis 缓存
|
||||
Boolean result = redisTemplate.delete(CommonConstant.ROUTE_KEY);
|
||||
|
||||
@@ -23,9 +23,8 @@
|
||||
:data="tableData"
|
||||
:table-loading="tableLoading"
|
||||
:option="tableOption"
|
||||
@current-change="currentChange"
|
||||
@on-load="getList"
|
||||
@refresh-change="refreshChange"
|
||||
@size-change="sizeChange"
|
||||
@row-update="handleUpdate"
|
||||
@row-save="handleSave"
|
||||
@row-del="rowDel">
|
||||
@@ -70,40 +69,28 @@
|
||||
currentPage: 1, // 当前页数
|
||||
pageSize: 20 // 每页显示多少条
|
||||
},
|
||||
listQuery: {
|
||||
page: 1,
|
||||
limit: 20
|
||||
},
|
||||
tableLoading: false,
|
||||
tableOption: tableOption
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
mounted: function() { },
|
||||
computed: {
|
||||
...mapGetters(['permissions'])
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
getList(page, params) {
|
||||
this.tableLoading = true
|
||||
fetchList(this.listQuery).then(response => {
|
||||
fetchList(Object.assign({
|
||||
page: page.currentPage,
|
||||
limit: page.pageSize
|
||||
}, params)).then(response => {
|
||||
this.tableData = response.data.records
|
||||
this.page.total = response.data.total
|
||||
this.tableLoading = false
|
||||
})
|
||||
},
|
||||
currentChange(val) {
|
||||
this.page.currentPage = val
|
||||
this.listQuery.page = val
|
||||
this.getList()
|
||||
},
|
||||
sizeChange(val) {
|
||||
this.page.pageSize = val
|
||||
this.listQuery.limit = val
|
||||
this.getList()
|
||||
},
|
||||
/**
|
||||
* @title 打开新增窗口
|
||||
* @detail 调用crud的handleadd方法即可
|
||||
@@ -154,7 +141,7 @@
|
||||
type: 'success'
|
||||
})
|
||||
done()
|
||||
this.getList()
|
||||
this.getList(this.page)
|
||||
})
|
||||
},
|
||||
/**
|
||||
@@ -172,14 +159,14 @@
|
||||
type: 'success'
|
||||
})
|
||||
done()
|
||||
this.getList()
|
||||
this.getList(this.page)
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 刷新回调
|
||||
*/
|
||||
refreshChange() {
|
||||
this.getList()
|
||||
this.getList(this.page)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user