Commit e1366ee4 authored by dqjdda's avatar dqjdda
Browse files

菜单修改

parent cad0c08c
...@@ -42,14 +42,14 @@ import java.util.Map; ...@@ -42,14 +42,14 @@ import java.util.Map;
public class RedisConfig extends CachingConfigurerSupport { public class RedisConfig extends CachingConfigurerSupport {
/** /**
* 设置 redis 数据默认过期时间,默认1天 * 设置 redis 数据默认过期时间,默认6小时
* 设置@cacheable 序列化方式 * 设置@cacheable 序列化方式
*/ */
@Bean @Bean
public RedisCacheConfiguration redisCacheConfiguration(){ public RedisCacheConfiguration redisCacheConfiguration(){
FastJsonRedisSerializer<Object> fastJsonRedisSerializer = new FastJsonRedisSerializer<>(Object.class); FastJsonRedisSerializer<Object> fastJsonRedisSerializer = new FastJsonRedisSerializer<>(Object.class);
RedisCacheConfiguration configuration = RedisCacheConfiguration.defaultCacheConfig(); RedisCacheConfiguration configuration = RedisCacheConfiguration.defaultCacheConfig();
configuration = configuration.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(fastJsonRedisSerializer)).entryTtl(Duration.ofDays(1)); configuration = configuration.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(fastJsonRedisSerializer)).entryTtl(Duration.ofHours(6));
return configuration; return configuration;
} }
......
...@@ -31,7 +31,7 @@ public class LogController { ...@@ -31,7 +31,7 @@ public class LogController {
@GetMapping @GetMapping
@ApiOperation("日志查询") @ApiOperation("日志查询")
@PreAuthorize("hasAnyRole('ADMIN')") @PreAuthorize("hasAnyRole('admin')")
public ResponseEntity getLogs(LogQueryCriteria criteria, Pageable pageable){ public ResponseEntity getLogs(LogQueryCriteria criteria, Pageable pageable){
criteria.setLogType("INFO"); criteria.setLogType("INFO");
return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK); return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK);
...@@ -47,7 +47,7 @@ public class LogController { ...@@ -47,7 +47,7 @@ public class LogController {
@GetMapping(value = "/error") @GetMapping(value = "/error")
@ApiOperation("错误日志查询") @ApiOperation("错误日志查询")
@PreAuthorize("hasAnyRole('ADMIN')") @PreAuthorize("hasAnyRole('admin')")
public ResponseEntity getErrorLogs(LogQueryCriteria criteria, Pageable pageable){ public ResponseEntity getErrorLogs(LogQueryCriteria criteria, Pageable pageable){
criteria.setLogType("ERROR"); criteria.setLogType("ERROR");
return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK); return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK);
...@@ -55,7 +55,7 @@ public class LogController { ...@@ -55,7 +55,7 @@ public class LogController {
@GetMapping(value = "/error/{id}") @GetMapping(value = "/error/{id}")
@ApiOperation("日志异常详情查询") @ApiOperation("日志异常详情查询")
@PreAuthorize("hasAnyRole('ADMIN')") @PreAuthorize("hasAnyRole('admin')")
public ResponseEntity getErrorLogs(@PathVariable Long id){ public ResponseEntity getErrorLogs(@PathVariable Long id){
return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK); return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK);
} }
......
...@@ -29,7 +29,7 @@ public class RedisController { ...@@ -29,7 +29,7 @@ public class RedisController {
@Log("查询Redis缓存") @Log("查询Redis缓存")
@GetMapping @GetMapping
@ApiOperation("查询Redis缓存") @ApiOperation("查询Redis缓存")
@PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_SELECT')") @PreAuthorize("hasAnyRole('admin','REDIS_ALL','REDIS_SELECT')")
public ResponseEntity getRedis(String key, Pageable pageable){ public ResponseEntity getRedis(String key, Pageable pageable){
return new ResponseEntity<>(redisService.findByKey(key,pageable), HttpStatus.OK); return new ResponseEntity<>(redisService.findByKey(key,pageable), HttpStatus.OK);
} }
...@@ -37,7 +37,7 @@ public class RedisController { ...@@ -37,7 +37,7 @@ public class RedisController {
@Log("删除Redis缓存") @Log("删除Redis缓存")
@DeleteMapping @DeleteMapping
@ApiOperation("删除Redis缓存") @ApiOperation("删除Redis缓存")
@PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_DELETE')") @PreAuthorize("hasAnyRole('admin','REDIS_ALL','REDIS_DELETE')")
public ResponseEntity delete(@RequestBody RedisVo resources){ public ResponseEntity delete(@RequestBody RedisVo resources){
redisService.delete(resources.getKey()); redisService.delete(resources.getKey());
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
...@@ -46,7 +46,7 @@ public class RedisController { ...@@ -46,7 +46,7 @@ public class RedisController {
@Log("清空Redis缓存") @Log("清空Redis缓存")
@DeleteMapping(value = "/all") @DeleteMapping(value = "/all")
@ApiOperation("清空Redis缓存") @ApiOperation("清空Redis缓存")
@PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_DELETE')") @PreAuthorize("hasAnyRole('admin','REDIS_ALL','REDIS_DELETE')")
public ResponseEntity deleteAll(){ public ResponseEntity deleteAll(){
redisService.deleteAll(); redisService.deleteAll();
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
......
...@@ -36,14 +36,14 @@ public class QuartzJobController { ...@@ -36,14 +36,14 @@ public class QuartzJobController {
@Log("查询定时任务") @Log("查询定时任务")
@ApiOperation("查询定时任务") @ApiOperation("查询定时任务")
@GetMapping @GetMapping
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_SELECT')") @PreAuthorize("hasAnyRole('admin','JOB_ALL','JOB_SELECT')")
public ResponseEntity getJobs(JobQueryCriteria criteria, Pageable pageable){ public ResponseEntity getJobs(JobQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(quartzJobService.queryAll(criteria,pageable), HttpStatus.OK); return new ResponseEntity<>(quartzJobService.queryAll(criteria,pageable), HttpStatus.OK);
} }
@ApiOperation("查询任务执行日志") @ApiOperation("查询任务执行日志")
@GetMapping(value = "/logs") @GetMapping(value = "/logs")
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_SELECT')") @PreAuthorize("hasAnyRole('admin','JOB_ALL','JOB_SELECT')")
public ResponseEntity getJobLogs(JobQueryCriteria criteria, Pageable pageable){ public ResponseEntity getJobLogs(JobQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(quartzJobService.queryAllLog(criteria,pageable), HttpStatus.OK); return new ResponseEntity<>(quartzJobService.queryAllLog(criteria,pageable), HttpStatus.OK);
} }
...@@ -51,7 +51,7 @@ public class QuartzJobController { ...@@ -51,7 +51,7 @@ public class QuartzJobController {
@Log("新增定时任务") @Log("新增定时任务")
@ApiOperation("新增定时任务") @ApiOperation("新增定时任务")
@PostMapping @PostMapping
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_CREATE')") @PreAuthorize("hasAnyRole('admin','JOB_ALL','JOB_CREATE')")
public ResponseEntity create(@Validated @RequestBody QuartzJob resources){ public ResponseEntity create(@Validated @RequestBody QuartzJob resources){
if (resources.getId() != null) { if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
...@@ -62,7 +62,7 @@ public class QuartzJobController { ...@@ -62,7 +62,7 @@ public class QuartzJobController {
@Log("修改定时任务") @Log("修改定时任务")
@ApiOperation("修改定时任务") @ApiOperation("修改定时任务")
@PutMapping @PutMapping
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')") @PreAuthorize("hasAnyRole('admin','JOB_ALL','JOB_EDIT')")
public ResponseEntity update(@Validated(QuartzJob.Update.class) @RequestBody QuartzJob resources){ public ResponseEntity update(@Validated(QuartzJob.Update.class) @RequestBody QuartzJob resources){
quartzJobService.update(resources); quartzJobService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -71,7 +71,7 @@ public class QuartzJobController { ...@@ -71,7 +71,7 @@ public class QuartzJobController {
@Log("更改定时任务状态") @Log("更改定时任务状态")
@ApiOperation("更改定时任务状态") @ApiOperation("更改定时任务状态")
@PutMapping(value = "/{id}") @PutMapping(value = "/{id}")
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')") @PreAuthorize("hasAnyRole('admin','JOB_ALL','JOB_EDIT')")
public ResponseEntity updateIsPause(@PathVariable Long id){ public ResponseEntity updateIsPause(@PathVariable Long id){
quartzJobService.updateIsPause(quartzJobService.findById(id)); quartzJobService.updateIsPause(quartzJobService.findById(id));
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -80,7 +80,7 @@ public class QuartzJobController { ...@@ -80,7 +80,7 @@ public class QuartzJobController {
@Log("执行定时任务") @Log("执行定时任务")
@ApiOperation("执行定时任务") @ApiOperation("执行定时任务")
@PutMapping(value = "/exec/{id}") @PutMapping(value = "/exec/{id}")
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')") @PreAuthorize("hasAnyRole('admin','JOB_ALL','JOB_EDIT')")
public ResponseEntity execution(@PathVariable Long id){ public ResponseEntity execution(@PathVariable Long id){
quartzJobService.execution(quartzJobService.findById(id)); quartzJobService.execution(quartzJobService.findById(id));
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -89,7 +89,7 @@ public class QuartzJobController { ...@@ -89,7 +89,7 @@ public class QuartzJobController {
@Log("删除定时任务") @Log("删除定时任务")
@ApiOperation("删除定时任务") @ApiOperation("删除定时任务")
@DeleteMapping(value = "/{id}") @DeleteMapping(value = "/{id}")
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_DELETE')") @PreAuthorize("hasAnyRole('admin','JOB_ALL','JOB_DELETE')")
public ResponseEntity delete(@PathVariable Long id){ public ResponseEntity delete(@PathVariable Long id){
quartzJobService.delete(quartzJobService.findById(id)); quartzJobService.delete(quartzJobService.findById(id));
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
......
...@@ -30,15 +30,21 @@ public class Menu{ ...@@ -30,15 +30,21 @@ public class Menu{
private String name; private String name;
@Column(unique = true) @Column(unique = true)
@NotNull private Long sort = 999L;
private Long sort;
@NotBlank
@Column(name = "path") @Column(name = "path")
private String path; private String path;
private String component; private String component;
// 类型
@Column(name = "type")
private Integer type;
// 权限
@Column(name = "permission")
private String permission;
@Column(unique = true,name = "component_name") @Column(unique = true,name = "component_name")
private String componentName; private String componentName;
......
...@@ -42,6 +42,10 @@ public class Role{ ...@@ -42,6 +42,10 @@ public class Role{
@Column @Column
private String remark; private String remark;
// 权限
@Column(name = "permission")
private String permission;
@JsonIgnore @JsonIgnore
@ManyToMany(mappedBy = "roles") @ManyToMany(mappedBy = "roles")
private Set<User> users; private Set<User> users;
......
...@@ -18,5 +18,5 @@ public interface MenuRepository extends JpaRepository<Menu, Long>, JpaSpecificat ...@@ -18,5 +18,5 @@ public interface MenuRepository extends JpaRepository<Menu, Long>, JpaSpecificat
List<Menu> findByPid(long pid); List<Menu> findByPid(long pid);
LinkedHashSet<Menu> findByRoles_IdOrderBySortAsc(Long id); LinkedHashSet<Menu> findByRoles_IdAndTypeIsNotInOrderBySortAsc(Long id, Integer type);
} }
...@@ -40,7 +40,7 @@ public class DeptController { ...@@ -40,7 +40,7 @@ public class DeptController {
@Log("查询部门") @Log("查询部门")
@ApiOperation("查询部门") @ApiOperation("查询部门")
@GetMapping @GetMapping
@PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_SELECT','DEPT_ALL','DEPT_SELECT')") @PreAuthorize("hasAnyRole('admin','user:all','user:select','DEPT_ALL','DEPT_SELECT')")
public ResponseEntity getDepts(DeptQueryCriteria criteria){ public ResponseEntity getDepts(DeptQueryCriteria criteria){
// 数据权限 // 数据权限
criteria.setIds(dataScope.getDeptIds()); criteria.setIds(dataScope.getDeptIds());
...@@ -51,7 +51,7 @@ public class DeptController { ...@@ -51,7 +51,7 @@ public class DeptController {
@Log("新增部门") @Log("新增部门")
@ApiOperation("新增部门") @ApiOperation("新增部门")
@PostMapping @PostMapping
@PreAuthorize("hasAnyRole('ADMIN','DEPT_ALL','DEPT_CREATE')") @PreAuthorize("hasAnyRole('admin','DEPT_ALL','DEPT_CREATE')")
public ResponseEntity create(@Validated @RequestBody Dept resources){ public ResponseEntity create(@Validated @RequestBody Dept resources){
if (resources.getId() != null) { if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
...@@ -62,7 +62,7 @@ public class DeptController { ...@@ -62,7 +62,7 @@ public class DeptController {
@Log("修改部门") @Log("修改部门")
@ApiOperation("修改部门") @ApiOperation("修改部门")
@PutMapping @PutMapping
@PreAuthorize("hasAnyRole('ADMIN','DEPT_ALL','DEPT_EDIT')") @PreAuthorize("hasAnyRole('admin','DEPT_ALL','DEPT_EDIT')")
public ResponseEntity update(@Validated(Dept.Update.class) @RequestBody Dept resources){ public ResponseEntity update(@Validated(Dept.Update.class) @RequestBody Dept resources){
deptService.update(resources); deptService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -71,7 +71,7 @@ public class DeptController { ...@@ -71,7 +71,7 @@ public class DeptController {
@Log("删除部门") @Log("删除部门")
@ApiOperation("删除部门") @ApiOperation("删除部门")
@DeleteMapping(value = "/{id}") @DeleteMapping(value = "/{id}")
@PreAuthorize("hasAnyRole('ADMIN','DEPT_ALL','DEPT_DELETE')") @PreAuthorize("hasAnyRole('admin','DEPT_ALL','DEPT_DELETE')")
public ResponseEntity delete(@PathVariable Long id){ public ResponseEntity delete(@PathVariable Long id){
try { try {
deptService.delete(id); deptService.delete(id);
......
...@@ -34,7 +34,7 @@ public class DictController { ...@@ -34,7 +34,7 @@ public class DictController {
@Log("查询字典") @Log("查询字典")
@ApiOperation("查询字典") @ApiOperation("查询字典")
@GetMapping @GetMapping
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_SELECT')") @PreAuthorize("hasAnyRole('admin','DICT_ALL','DICT_SELECT')")
public ResponseEntity getDicts(DictQueryCriteria resources, Pageable pageable){ public ResponseEntity getDicts(DictQueryCriteria resources, Pageable pageable){
return new ResponseEntity<>(dictService.queryAll(resources,pageable),HttpStatus.OK); return new ResponseEntity<>(dictService.queryAll(resources,pageable),HttpStatus.OK);
} }
...@@ -42,7 +42,7 @@ public class DictController { ...@@ -42,7 +42,7 @@ public class DictController {
@Log("新增字典") @Log("新增字典")
@ApiOperation("新增字典") @ApiOperation("新增字典")
@PostMapping @PostMapping
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_CREATE')") @PreAuthorize("hasAnyRole('admin','DICT_ALL','DICT_CREATE')")
public ResponseEntity create(@Validated @RequestBody Dict resources){ public ResponseEntity create(@Validated @RequestBody Dict resources){
if (resources.getId() != null) { if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
...@@ -53,7 +53,7 @@ public class DictController { ...@@ -53,7 +53,7 @@ public class DictController {
@Log("修改字典") @Log("修改字典")
@ApiOperation("修改字典") @ApiOperation("修改字典")
@PutMapping @PutMapping
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_EDIT')") @PreAuthorize("hasAnyRole('admin','DICT_ALL','DICT_EDIT')")
public ResponseEntity update(@Validated(Dict.Update.class) @RequestBody Dict resources){ public ResponseEntity update(@Validated(Dict.Update.class) @RequestBody Dict resources){
dictService.update(resources); dictService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -62,7 +62,7 @@ public class DictController { ...@@ -62,7 +62,7 @@ public class DictController {
@Log("删除字典") @Log("删除字典")
@ApiOperation("删除字典") @ApiOperation("删除字典")
@DeleteMapping(value = "/{id}") @DeleteMapping(value = "/{id}")
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_DELETE')") @PreAuthorize("hasAnyRole('admin','DICT_ALL','DICT_DELETE')")
public ResponseEntity delete(@PathVariable Long id){ public ResponseEntity delete(@PathVariable Long id){
dictService.delete(id); dictService.delete(id);
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
......
...@@ -60,7 +60,7 @@ public class DictDetailController { ...@@ -60,7 +60,7 @@ public class DictDetailController {
@Log("新增字典详情") @Log("新增字典详情")
@ApiOperation("新增字典详情") @ApiOperation("新增字典详情")
@PostMapping @PostMapping
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_CREATE')") @PreAuthorize("hasAnyRole('admin','DICT_ALL','DICT_CREATE')")
public ResponseEntity create(@Validated @RequestBody DictDetail resources){ public ResponseEntity create(@Validated @RequestBody DictDetail resources){
if (resources.getId() != null) { if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
...@@ -71,7 +71,7 @@ public class DictDetailController { ...@@ -71,7 +71,7 @@ public class DictDetailController {
@Log("修改字典详情") @Log("修改字典详情")
@ApiOperation("修改字典详情") @ApiOperation("修改字典详情")
@PutMapping @PutMapping
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_EDIT')") @PreAuthorize("hasAnyRole('admin','DICT_ALL','DICT_EDIT')")
public ResponseEntity update(@Validated(DictDetail.Update.class) @RequestBody DictDetail resources){ public ResponseEntity update(@Validated(DictDetail.Update.class) @RequestBody DictDetail resources){
dictDetailService.update(resources); dictDetailService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -80,7 +80,7 @@ public class DictDetailController { ...@@ -80,7 +80,7 @@ public class DictDetailController {
@Log("删除字典详情") @Log("删除字典详情")
@ApiOperation("删除字典详情") @ApiOperation("删除字典详情")
@DeleteMapping(value = "/{id}") @DeleteMapping(value = "/{id}")
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_DELETE')") @PreAuthorize("hasAnyRole('admin','DICT_ALL','DICT_DELETE')")
public ResponseEntity delete(@PathVariable Long id){ public ResponseEntity delete(@PathVariable Long id){
dictDetailService.delete(id); dictDetailService.delete(id);
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
......
...@@ -39,7 +39,7 @@ public class JobController { ...@@ -39,7 +39,7 @@ public class JobController {
@Log("查询岗位") @Log("查询岗位")
@ApiOperation("查询岗位") @ApiOperation("查询岗位")
@GetMapping @GetMapping
@PreAuthorize("hasAnyRole('ADMIN','USERJOB_ALL','USERJOB_SELECT','USER_ALL','USER_SELECT')") @PreAuthorize("hasAnyRole('admin','USERJOB_ALL','USERJOB_SELECT','user:all','user:select')")
public ResponseEntity getJobs(JobQueryCriteria criteria, public ResponseEntity getJobs(JobQueryCriteria criteria,
Pageable pageable){ Pageable pageable){
// 数据权限 // 数据权限
...@@ -50,7 +50,7 @@ public class JobController { ...@@ -50,7 +50,7 @@ public class JobController {
@Log("新增岗位") @Log("新增岗位")
@ApiOperation("新增岗位") @ApiOperation("新增岗位")
@PostMapping @PostMapping
@PreAuthorize("hasAnyRole('ADMIN','USERJOB_ALL','USERJOB_CREATE')") @PreAuthorize("hasAnyRole('admin','USERJOB_ALL','USERJOB_CREATE')")
public ResponseEntity create(@Validated @RequestBody Job resources){ public ResponseEntity create(@Validated @RequestBody Job resources){
if (resources.getId() != null) { if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
...@@ -61,7 +61,7 @@ public class JobController { ...@@ -61,7 +61,7 @@ public class JobController {
@Log("修改岗位") @Log("修改岗位")
@ApiOperation("修改岗位") @ApiOperation("修改岗位")
@PutMapping @PutMapping
@PreAuthorize("hasAnyRole('ADMIN','USERJOB_ALL','USERJOB_EDIT')") @PreAuthorize("hasAnyRole('admin','USERJOB_ALL','USERJOB_EDIT')")
public ResponseEntity update(@Validated(Job.Update.class) @RequestBody Job resources){ public ResponseEntity update(@Validated(Job.Update.class) @RequestBody Job resources){
jobService.update(resources); jobService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -70,7 +70,7 @@ public class JobController { ...@@ -70,7 +70,7 @@ public class JobController {
@Log("删除岗位") @Log("删除岗位")
@ApiOperation("删除岗位") @ApiOperation("删除岗位")
@DeleteMapping(value = "/{id}") @DeleteMapping(value = "/{id}")
@PreAuthorize("hasAnyRole('ADMIN','USERJOB_ALL','USERJOB_DELETE')") @PreAuthorize("hasAnyRole('admin','USERJOB_ALL','USERJOB_DELETE')")
public ResponseEntity delete(@PathVariable Long id){ public ResponseEntity delete(@PathVariable Long id){
try { try {
jobService.delete(id); jobService.delete(id);
......
...@@ -45,7 +45,7 @@ public class MenuController { ...@@ -45,7 +45,7 @@ public class MenuController {
this.roleService = roleService; this.roleService = roleService;
} }
@ApiOperation("获取菜单") @ApiOperation("获取前端所需菜单")
@GetMapping(value = "/build") @GetMapping(value = "/build")
public ResponseEntity buildMenus(){ public ResponseEntity buildMenus(){
UserDTO user = userService.findByName(SecurityUtils.getUsername()); UserDTO user = userService.findByName(SecurityUtils.getUsername());
...@@ -56,7 +56,7 @@ public class MenuController { ...@@ -56,7 +56,7 @@ public class MenuController {
@ApiOperation("返回全部的菜单") @ApiOperation("返回全部的菜单")
@GetMapping(value = "/tree") @GetMapping(value = "/tree")
@PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_CREATE','MENU_EDIT','ROLES_SELECT','ROLES_ALL')") @PreAuthorize("hasAnyRole('admin','MENU_ALL','MENU_CREATE','MENU_EDIT','ROLES_SELECT','ROLES_ALL')")
public ResponseEntity getMenuTree(){ public ResponseEntity getMenuTree(){
return new ResponseEntity<>(menuService.getMenuTree(menuService.findByPid(0L)),HttpStatus.OK); return new ResponseEntity<>(menuService.getMenuTree(menuService.findByPid(0L)),HttpStatus.OK);
} }
...@@ -64,7 +64,7 @@ public class MenuController { ...@@ -64,7 +64,7 @@ public class MenuController {
@Log("查询菜单") @Log("查询菜单")
@ApiOperation("查询菜单") @ApiOperation("查询菜单")
@GetMapping @GetMapping
@PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_SELECT')") @PreAuthorize("hasAnyRole('admin','MENU_ALL','MENU_SELECT')")
public ResponseEntity getMenus(MenuQueryCriteria criteria){ public ResponseEntity getMenus(MenuQueryCriteria criteria){
List<MenuDTO> menuDTOList = menuService.queryAll(criteria); List<MenuDTO> menuDTOList = menuService.queryAll(criteria);
return new ResponseEntity<>(menuService.buildTree(menuDTOList),HttpStatus.OK); return new ResponseEntity<>(menuService.buildTree(menuDTOList),HttpStatus.OK);
...@@ -73,7 +73,7 @@ public class MenuController { ...@@ -73,7 +73,7 @@ public class MenuController {
@Log("新增菜单") @Log("新增菜单")
@ApiOperation("新增菜单") @ApiOperation("新增菜单")
@PostMapping @PostMapping
@PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_CREATE')") @PreAuthorize("hasAnyRole('admin','MENU_ALL','MENU_CREATE')")
public ResponseEntity create(@Validated @RequestBody Menu resources){ public ResponseEntity create(@Validated @RequestBody Menu resources){
if (resources.getId() != null) { if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
...@@ -84,7 +84,7 @@ public class MenuController { ...@@ -84,7 +84,7 @@ public class MenuController {
@Log("修改菜单") @Log("修改菜单")
@ApiOperation("修改菜单") @ApiOperation("修改菜单")
@PutMapping @PutMapping
@PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_EDIT')") @PreAuthorize("hasAnyRole('admin','MENU_ALL','MENU_EDIT')")
public ResponseEntity update(@Validated(Menu.Update.class) @RequestBody Menu resources){ public ResponseEntity update(@Validated(Menu.Update.class) @RequestBody Menu resources){
menuService.update(resources); menuService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -93,7 +93,7 @@ public class MenuController { ...@@ -93,7 +93,7 @@ public class MenuController {
@Log("删除菜单") @Log("删除菜单")
@ApiOperation("删除菜单") @ApiOperation("删除菜单")
@DeleteMapping(value = "/{id}") @DeleteMapping(value = "/{id}")
@PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_DELETE')") @PreAuthorize("hasAnyRole('admin','MENU_ALL','MENU_DELETE')")
public ResponseEntity delete(@PathVariable Long id){ public ResponseEntity delete(@PathVariable Long id){
List<Menu> menuList = menuService.findByPid(id); List<Menu> menuList = menuService.findByPid(id);
Set<Menu> menuSet = new HashSet<>(); Set<Menu> menuSet = new HashSet<>();
......
...@@ -40,7 +40,7 @@ public class PermissionController { ...@@ -40,7 +40,7 @@ public class PermissionController {
@ApiOperation("返回全部的权限,新增角色时下拉选择") @ApiOperation("返回全部的权限,新增角色时下拉选择")
@GetMapping(value = "/tree") @GetMapping(value = "/tree")
@PreAuthorize("hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_CREATE','PERMISSION_EDIT','ROLES_SELECT','ROLES_ALL')") @PreAuthorize("hasAnyRole('admin','PERMISSION_ALL','PERMISSION_CREATE','PERMISSION_EDIT','ROLES_SELECT','ROLES_ALL')")
public ResponseEntity getTree(){ public ResponseEntity getTree(){
return new ResponseEntity<>(permissionService.getPermissionTree(permissionService.findByPid(0L)),HttpStatus.OK); return new ResponseEntity<>(permissionService.getPermissionTree(permissionService.findByPid(0L)),HttpStatus.OK);
} }
...@@ -48,7 +48,7 @@ public class PermissionController { ...@@ -48,7 +48,7 @@ public class PermissionController {
@Log("查询权限") @Log("查询权限")
@ApiOperation("查询权限") @ApiOperation("查询权限")
@GetMapping @GetMapping
@PreAuthorize("hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_SELECT')") @PreAuthorize("hasAnyRole('admin','PERMISSION_ALL','PERMISSION_SELECT')")
public ResponseEntity getPermissions(PermissionQueryCriteria criteria){ public ResponseEntity getPermissions(PermissionQueryCriteria criteria){
List<PermissionDTO> permissionDTOS = permissionService.queryAll(criteria); List<PermissionDTO> permissionDTOS = permissionService.queryAll(criteria);
return new ResponseEntity<>(permissionService.buildTree(permissionDTOS),HttpStatus.OK); return new ResponseEntity<>(permissionService.buildTree(permissionDTOS),HttpStatus.OK);
...@@ -57,7 +57,7 @@ public class PermissionController { ...@@ -57,7 +57,7 @@ public class PermissionController {
@Log("新增权限") @Log("新增权限")
@ApiOperation("新增权限") @ApiOperation("新增权限")
@PostMapping @PostMapping
@PreAuthorize("hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_CREATE')") @PreAuthorize("hasAnyRole('admin','PERMISSION_ALL','PERMISSION_CREATE')")
public ResponseEntity create(@Validated @RequestBody Permission resources){ public ResponseEntity create(@Validated @RequestBody Permission resources){
if (resources.getId() != null) { if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
...@@ -68,7 +68,7 @@ public class PermissionController { ...@@ -68,7 +68,7 @@ public class PermissionController {
@Log("修改权限") @Log("修改权限")
@ApiOperation("修改权限") @ApiOperation("修改权限")
@PutMapping @PutMapping
@PreAuthorize("hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_EDIT')") @PreAuthorize("hasAnyRole('admin','PERMISSION_ALL','PERMISSION_EDIT')")
public ResponseEntity update(@Validated(Permission.Update.class) @RequestBody Permission resources){ public ResponseEntity update(@Validated(Permission.Update.class) @RequestBody Permission resources){
permissionService.update(resources); permissionService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -77,7 +77,7 @@ public class PermissionController { ...@@ -77,7 +77,7 @@ public class PermissionController {
@Log("删除权限") @Log("删除权限")
@ApiOperation("删除权限") @ApiOperation("删除权限")
@DeleteMapping(value = "/{id}") @DeleteMapping(value = "/{id}")
@PreAuthorize("hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_DELETE')") @PreAuthorize("hasAnyRole('admin','PERMISSION_ALL','PERMISSION_DELETE')")
public ResponseEntity delete(@PathVariable Long id){ public ResponseEntity delete(@PathVariable Long id){
List<Permission> permissions = permissionService.findByPid(id); List<Permission> permissions = permissionService.findByPid(id);
Set<Permission> permissionSet = new HashSet<>(); Set<Permission> permissionSet = new HashSet<>();
......
...@@ -42,14 +42,14 @@ public class RoleController { ...@@ -42,14 +42,14 @@ public class RoleController {
@ApiOperation("获取单个role") @ApiOperation("获取单个role")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_SELECT')") @PreAuthorize("hasAnyRole('admin','ROLES_ALL','ROLES_SELECT')")
public ResponseEntity getRoles(@PathVariable Long id){ public ResponseEntity getRoles(@PathVariable Long id){
return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK); return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK);
} }
@ApiOperation("返回全部的角色") @ApiOperation("返回全部的角色")
@GetMapping(value = "/all") @GetMapping(value = "/all")
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','USER_ALL','USER_CREATE','USER_EDIT')") @PreAuthorize("hasAnyRole('admin','ROLES_ALL','user:all','user:add','user:edit')")
public ResponseEntity getAll(@PageableDefault(value = 2000, sort = {"level"}, direction = Sort.Direction.ASC) Pageable pageable){ public ResponseEntity getAll(@PageableDefault(value = 2000, sort = {"level"}, direction = Sort.Direction.ASC) Pageable pageable){
return new ResponseEntity<>(roleService.queryAll(pageable),HttpStatus.OK); return new ResponseEntity<>(roleService.queryAll(pageable),HttpStatus.OK);
} }
...@@ -57,7 +57,7 @@ public class RoleController { ...@@ -57,7 +57,7 @@ public class RoleController {
@Log("查询角色") @Log("查询角色")
@ApiOperation("查询角色") @ApiOperation("查询角色")
@GetMapping @GetMapping
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_SELECT')") @PreAuthorize("hasAnyRole('admin','ROLES_ALL','ROLES_SELECT')")
public ResponseEntity getRoles(RoleQueryCriteria criteria, Pageable pageable){ public ResponseEntity getRoles(RoleQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(roleService.queryAll(criteria,pageable),HttpStatus.OK); return new ResponseEntity<>(roleService.queryAll(criteria,pageable),HttpStatus.OK);
} }
...@@ -72,7 +72,7 @@ public class RoleController { ...@@ -72,7 +72,7 @@ public class RoleController {
@Log("新增角色") @Log("新增角色")
@ApiOperation("新增角色") @ApiOperation("新增角色")
@PostMapping @PostMapping
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_CREATE')") @PreAuthorize("hasAnyRole('admin','ROLES_ALL','ROLES_CREATE')")
public ResponseEntity create(@Validated @RequestBody Role resources){ public ResponseEntity create(@Validated @RequestBody Role resources){
if (resources.getId() != null) { if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
...@@ -83,7 +83,7 @@ public class RoleController { ...@@ -83,7 +83,7 @@ public class RoleController {
@Log("修改角色") @Log("修改角色")
@ApiOperation("修改角色") @ApiOperation("修改角色")
@PutMapping @PutMapping
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_EDIT')") @PreAuthorize("hasAnyRole('admin','ROLES_ALL','ROLES_EDIT')")
public ResponseEntity update(@Validated(Role.Update.class) @RequestBody Role resources){ public ResponseEntity update(@Validated(Role.Update.class) @RequestBody Role resources){
roleService.update(resources); roleService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -92,7 +92,7 @@ public class RoleController { ...@@ -92,7 +92,7 @@ public class RoleController {
@Log("修改角色权限") @Log("修改角色权限")
@ApiOperation("修改角色权限") @ApiOperation("修改角色权限")
@PutMapping(value = "/permission") @PutMapping(value = "/permission")
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_EDIT')") @PreAuthorize("hasAnyRole('admin','ROLES_ALL','ROLES_EDIT')")
public ResponseEntity updatePermission(@RequestBody Role resources){ public ResponseEntity updatePermission(@RequestBody Role resources){
roleService.updatePermission(resources,roleService.findById(resources.getId())); roleService.updatePermission(resources,roleService.findById(resources.getId()));
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -101,7 +101,7 @@ public class RoleController { ...@@ -101,7 +101,7 @@ public class RoleController {
@Log("修改角色菜单") @Log("修改角色菜单")
@ApiOperation("修改角色菜单") @ApiOperation("修改角色菜单")
@PutMapping(value = "/menu") @PutMapping(value = "/menu")
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_EDIT')") @PreAuthorize("hasAnyRole('admin','ROLES_ALL','ROLES_EDIT')")
public ResponseEntity updateMenu(@RequestBody Role resources){ public ResponseEntity updateMenu(@RequestBody Role resources){
roleService.updateMenu(resources,roleService.findById(resources.getId())); roleService.updateMenu(resources,roleService.findById(resources.getId()));
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -110,7 +110,7 @@ public class RoleController { ...@@ -110,7 +110,7 @@ public class RoleController {
@Log("删除角色") @Log("删除角色")
@ApiOperation("删除角色") @ApiOperation("删除角色")
@DeleteMapping(value = "/{id}") @DeleteMapping(value = "/{id}")
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','ROLES_DELETE')") @PreAuthorize("hasAnyRole('admin','ROLES_ALL','ROLES_DELETE')")
public ResponseEntity delete(@PathVariable Long id){ public ResponseEntity delete(@PathVariable Long id){
try { try {
roleService.delete(id); roleService.delete(id);
......
...@@ -60,7 +60,7 @@ public class UserController { ...@@ -60,7 +60,7 @@ public class UserController {
@Log("导出用户数据") @Log("导出用户数据")
@ApiOperation("导出用户数据") @ApiOperation("导出用户数据")
@GetMapping(value = "/download") @GetMapping(value = "/download")
@PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_SELECT')") @PreAuthorize("hasAnyRole('admin','user:all','user:select')")
public void update(HttpServletResponse response, UserQueryCriteria criteria) throws IOException { public void update(HttpServletResponse response, UserQueryCriteria criteria) throws IOException {
userService.download(userService.queryAll(criteria), response); userService.download(userService.queryAll(criteria), response);
} }
...@@ -68,7 +68,7 @@ public class UserController { ...@@ -68,7 +68,7 @@ public class UserController {
@Log("查询用户") @Log("查询用户")
@ApiOperation("查询用户") @ApiOperation("查询用户")
@GetMapping @GetMapping
@PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_SELECT')") @PreAuthorize("hasAnyRole('admin','user:all','user:select')")
public ResponseEntity getUsers(UserQueryCriteria criteria, Pageable pageable){ public ResponseEntity getUsers(UserQueryCriteria criteria, Pageable pageable){
Set<Long> deptSet = new HashSet<>(); Set<Long> deptSet = new HashSet<>();
Set<Long> result = new HashSet<>(); Set<Long> result = new HashSet<>();
...@@ -105,7 +105,7 @@ public class UserController { ...@@ -105,7 +105,7 @@ public class UserController {
@Log("新增用户") @Log("新增用户")
@ApiOperation("新增用户") @ApiOperation("新增用户")
@PostMapping @PostMapping
@PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_CREATE')") @PreAuthorize("hasAnyRole('admin','user:all','user:add')")
public ResponseEntity create(@Validated @RequestBody User resources){ public ResponseEntity create(@Validated @RequestBody User resources){
checkLevel(resources); checkLevel(resources);
return new ResponseEntity<>(userService.create(resources),HttpStatus.CREATED); return new ResponseEntity<>(userService.create(resources),HttpStatus.CREATED);
...@@ -114,7 +114,7 @@ public class UserController { ...@@ -114,7 +114,7 @@ public class UserController {
@Log("修改用户") @Log("修改用户")
@ApiOperation("修改用户") @ApiOperation("修改用户")
@PutMapping @PutMapping
@PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_EDIT')") @PreAuthorize("hasAnyRole('admin','user:all','user:edit')")
public ResponseEntity update(@Validated(User.Update.class) @RequestBody User resources){ public ResponseEntity update(@Validated(User.Update.class) @RequestBody User resources){
checkLevel(resources); checkLevel(resources);
userService.update(resources); userService.update(resources);
...@@ -124,7 +124,7 @@ public class UserController { ...@@ -124,7 +124,7 @@ public class UserController {
@Log("删除用户") @Log("删除用户")
@ApiOperation("删除用户") @ApiOperation("删除用户")
@DeleteMapping(value = "/{id}") @DeleteMapping(value = "/{id}")
@PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_DELETE')") @PreAuthorize("hasAnyRole('admin','user:all','user:del')")
public ResponseEntity delete(@PathVariable Long id){ public ResponseEntity delete(@PathVariable Long id){
Integer currentLevel = Collections.min(roleService.findByUsers_Id(SecurityUtils.getUserId()).stream().map(RoleSmallDTO::getLevel).collect(Collectors.toList())); Integer currentLevel = Collections.min(roleService.findByUsers_Id(SecurityUtils.getUserId()).stream().map(RoleSmallDTO::getLevel).collect(Collectors.toList()));
Integer optLevel = Collections.min(roleService.findByUsers_Id(id).stream().map(RoleSmallDTO::getLevel).collect(Collectors.toList())); Integer optLevel = Collections.min(roleService.findByUsers_Id(id).stream().map(RoleSmallDTO::getLevel).collect(Collectors.toList()));
......
...@@ -16,6 +16,10 @@ public class MenuDTO{ ...@@ -16,6 +16,10 @@ public class MenuDTO{
private Long id; private Long id;
private Integer type;
private String permission;
private String name; private String name;
private Long sort; private Long sort;
......
...@@ -24,6 +24,8 @@ public class RoleDTO{ ...@@ -24,6 +24,8 @@ public class RoleDTO{
private String remark; private String remark;
private String permission;
private Set<PermissionDTO> permissions; private Set<PermissionDTO> permissions;
private Set<MenuDTO> menus; private Set<MenuDTO> menus;
......
...@@ -47,8 +47,8 @@ public class MenuServiceImpl implements MenuService { ...@@ -47,8 +47,8 @@ public class MenuServiceImpl implements MenuService {
@Override @Override
@Cacheable @Cacheable
public List<MenuDTO> queryAll(MenuQueryCriteria criteria){ public List<MenuDTO> queryAll(MenuQueryCriteria criteria){
Sort sort = new Sort(Sort.Direction.DESC,"id"); // Sort sort = new Sort(Sort.Direction.DESC,"id");
return menuMapper.toDto(menuRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),sort)); return menuMapper.toDto(menuRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
} }
@Override @Override
...@@ -63,7 +63,7 @@ public class MenuServiceImpl implements MenuService { ...@@ -63,7 +63,7 @@ public class MenuServiceImpl implements MenuService {
public List<MenuDTO> findByRoles(List<RoleSmallDTO> roles) { public List<MenuDTO> findByRoles(List<RoleSmallDTO> roles) {
Set<Menu> menus = new LinkedHashSet<>(); Set<Menu> menus = new LinkedHashSet<>();
for (RoleSmallDTO role : roles) { for (RoleSmallDTO role : roles) {
List<Menu> menus1 = new ArrayList<>(menuRepository.findByRoles_IdOrderBySortAsc(role.getId())); List<Menu> menus1 = new ArrayList<>(menuRepository.findByRoles_IdAndTypeIsNotInOrderBySortAsc(role.getId(), 2));
menus.addAll(menus1); menus.addAll(menus1);
} }
return menus.stream().map(menuMapper::toDto).collect(Collectors.toList()); return menus.stream().map(menuMapper::toDto).collect(Collectors.toList());
...@@ -124,6 +124,8 @@ public class MenuServiceImpl implements MenuService { ...@@ -124,6 +124,8 @@ public class MenuServiceImpl implements MenuService {
menu.setCache(resources.getCache()); menu.setCache(resources.getCache());
menu.setHidden(resources.getHidden()); menu.setHidden(resources.getHidden());
menu.setComponentName(resources.getComponentName()); menu.setComponentName(resources.getComponentName());
menu.setPermission(resources.getPermission());
menu.setType(resources.getType());
menuRepository.save(menu); menuRepository.save(menu);
} }
......
...@@ -44,8 +44,8 @@ public class PermissionServiceImpl implements PermissionService { ...@@ -44,8 +44,8 @@ public class PermissionServiceImpl implements PermissionService {
@Override @Override
@Cacheable @Cacheable
public List<PermissionDTO> queryAll(PermissionQueryCriteria criteria) { public List<PermissionDTO> queryAll(PermissionQueryCriteria criteria) {
Sort sort = new Sort(Sort.Direction.DESC,"id"); // Sort sort = new Sort(Sort.Direction.DESC,"id");
return permissionMapper.toDto(permissionRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),sort)); return permissionMapper.toDto(permissionRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
} }
@Override @Override
......
...@@ -30,7 +30,7 @@ public class ${className}Controller { ...@@ -30,7 +30,7 @@ public class ${className}Controller {
@GetMapping @GetMapping
@Log("查询${className}") @Log("查询${className}")
@ApiOperation("查询${className}") @ApiOperation("查询${className}")
@PreAuthorize("hasAnyRole('ADMIN','${upperCaseClassName}_ALL','${upperCaseClassName}_SELECT')") @PreAuthorize("hasAnyRole('admin','${upperCaseClassName}_ALL','${upperCaseClassName}_SELECT')")
public ResponseEntity get${className}s(${className}QueryCriteria criteria, Pageable pageable){ public ResponseEntity get${className}s(${className}QueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(${changeClassName}Service.queryAll(criteria,pageable),HttpStatus.OK); return new ResponseEntity<>(${changeClassName}Service.queryAll(criteria,pageable),HttpStatus.OK);
} }
...@@ -38,7 +38,7 @@ public class ${className}Controller { ...@@ -38,7 +38,7 @@ public class ${className}Controller {
@PostMapping @PostMapping
@Log("新增${className}") @Log("新增${className}")
@ApiOperation("新增${className}") @ApiOperation("新增${className}")
@PreAuthorize("hasAnyRole('ADMIN','${upperCaseClassName}_ALL','${upperCaseClassName}_CREATE')") @PreAuthorize("hasAnyRole('admin','${upperCaseClassName}_ALL','${upperCaseClassName}_CREATE')")
public ResponseEntity create(@Validated @RequestBody ${className} resources){ public ResponseEntity create(@Validated @RequestBody ${className} resources){
return new ResponseEntity<>(${changeClassName}Service.create(resources),HttpStatus.CREATED); return new ResponseEntity<>(${changeClassName}Service.create(resources),HttpStatus.CREATED);
} }
...@@ -46,7 +46,7 @@ public class ${className}Controller { ...@@ -46,7 +46,7 @@ public class ${className}Controller {
@PutMapping @PutMapping
@Log("修改${className}") @Log("修改${className}")
@ApiOperation("修改${className}") @ApiOperation("修改${className}")
@PreAuthorize("hasAnyRole('ADMIN','${upperCaseClassName}_ALL','${upperCaseClassName}_EDIT')") @PreAuthorize("hasAnyRole('admin','${upperCaseClassName}_ALL','${upperCaseClassName}_EDIT')")
public ResponseEntity update(@Validated @RequestBody ${className} resources){ public ResponseEntity update(@Validated @RequestBody ${className} resources){
${changeClassName}Service.update(resources); ${changeClassName}Service.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
...@@ -55,7 +55,7 @@ public class ${className}Controller { ...@@ -55,7 +55,7 @@ public class ${className}Controller {
@DeleteMapping(value = "/{${pkChangeColName}}") @DeleteMapping(value = "/{${pkChangeColName}}")
@Log("删除${className}") @Log("删除${className}")
@ApiOperation("删除${className}") @ApiOperation("删除${className}")
@PreAuthorize("hasAnyRole('ADMIN','${upperCaseClassName}_ALL','${upperCaseClassName}_DELETE')") @PreAuthorize("hasAnyRole('admin','${upperCaseClassName}_ALL','${upperCaseClassName}_DELETE')")
public ResponseEntity delete(@PathVariable ${pkColumnType} ${pkChangeColName}){ public ResponseEntity delete(@PathVariable ${pkColumnType} ${pkChangeColName}){
${changeClassName}Service.delete(${pkChangeColName}); ${changeClassName}Service.delete(${pkChangeColName});
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment