|
|
@@ -1,4 +1,5 @@
|
|
|
package com.izouma.jmrh.web;
|
|
|
+
|
|
|
import com.izouma.jmrh.domain.AuthorityMenu;
|
|
|
import com.izouma.jmrh.repo.MenuRepo;
|
|
|
import com.izouma.jmrh.service.AuthorityMenuService;
|
|
|
@@ -22,33 +23,33 @@ import java.util.Map;
|
|
|
@RequestMapping("/authorityMenu")
|
|
|
@AllArgsConstructor
|
|
|
public class AuthorityMenuController extends BaseController {
|
|
|
+
|
|
|
private AuthorityMenuService authorityMenuService;
|
|
|
- private AuthorityMenuRepo authorityMenuRepo;
|
|
|
- private MenuRepo menuRepo;
|
|
|
+ private AuthorityMenuRepo authorityMenuRepo;
|
|
|
+ private MenuRepo menuRepo;
|
|
|
+
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/save")
|
|
|
public Map save(@RequestBody AuthorityMenu record) {
|
|
|
HashMap<String, Object> rest = new HashMap<>();
|
|
|
- rest.put("success",false);
|
|
|
- if (record!=null){
|
|
|
+ rest.put("success", false);
|
|
|
+ if (record != null) {
|
|
|
AuthorityMenu byAuthorityName = authorityMenuRepo.findByAuthorityName(record.getAuthorityName());
|
|
|
- if (byAuthorityName==null){
|
|
|
- if (authorityMenuRepo.save(record)!=null)
|
|
|
- rest.put("success",true);;
|
|
|
+ if (byAuthorityName == null) {
|
|
|
+ if (authorityMenuRepo.save(record) != null)
|
|
|
+ rest.put("success", true);
|
|
|
+ }
|
|
|
+ if (authorityMenuRepo.updateByAuthorityName(record.getMenuId(), record.getAuthorityName()) > 0) {
|
|
|
+ rest.put("success", true);
|
|
|
}
|
|
|
- if (authorityMenuRepo.updateByAuthorityName(record.getMenuId(),record.getAuthorityName())>0){
|
|
|
- rest.put("success",true);
|
|
|
- }
|
|
|
}
|
|
|
- return rest;
|
|
|
-
|
|
|
+ return rest;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@GetMapping("/all")
|
|
|
public Page<AuthorityMenu> all(PageQuery pageQuery) {
|
|
|
- return authorityMenuRepo.findAll(toSpecification(pageQuery,AuthorityMenu.class), toPageRequest(pageQuery));
|
|
|
+ return authorityMenuRepo.findAll(toSpecification(pageQuery, AuthorityMenu.class), toPageRequest(pageQuery));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/get/{id}")
|