⚡ 优化代码, URI 去掉驼峰

This commit is contained in:
冷冷 committed 2018-11-15 20:28:31 +08:00
1 parent d2e197ba6c
commit a994ca43d4
8 files changed
+32 -32

No files matched your search

@@ -76,7 +76,7 @@ public class PigxTokenEndpoint {
*
* @param authHeader Authorization
*/
@GetMapping("/removeToken")
@DeleteMapping("/token")
public R<Boolean> logout(@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authHeader) {
if (StringUtils.hasText(authHeader)) {
String tokenValue = authHeader.replace("Bearer", "").trim();
@@ -97,7 +97,7 @@ public class PigxTokenEndpoint {
* @param from 内部调用标志
* @return
*/
@DeleteMapping("/delToken/{token}")
@DeleteMapping("/token/{token}")
public R<Boolean> delToken(@PathVariable("token") String token, @RequestHeader(required = false) String from) {
if (StrUtil.isBlank(from)) {
return null;
@@ -113,7 +113,7 @@ public class PigxTokenEndpoint {
* @param from 标志
* @return
*/
@PostMapping("/listToken")
@PostMapping("/page")
public Page tokenList(@RequestBody Map<String, Object> params, @RequestHeader(required = false) String from) {
if (StrUtil.isBlank(from)) {
return null;
@@ -40,7 +40,7 @@ public interface RemoteTokenService {
* @param from 内部调用标志
* @return page
*/
@PostMapping("/oauth/listToken")
@PostMapping("/oauth/page")
Page selectPage(@RequestBody Map<String, Object> params, @RequestHeader(SecurityConstants.FROM) String from);
/**
@@ -50,6 +50,6 @@ public interface RemoteTokenService {
* @param from 调用标志
* @return
*/
@DeleteMapping("/oauth/delToken/{token}")
@DeleteMapping("/oauth/token/{token}")
R<Boolean> deleteTokenById(@PathVariable("token") String token, @RequestHeader(SecurityConstants.FROM) String from);
}
@@ -64,6 +64,6 @@ public interface RemoteUserService {
* @param username 用户名
* @return R
*/
@GetMapping("/user/ancestorUsers/{username}")
@GetMapping("/user/ancestor/{username}")
R<List<SysUser>> ancestorUsers(@PathVariable("username") String username);
}
@@ -49,8 +49,8 @@ import java.util.Map;
*/
@RestController
@AllArgsConstructor
@RequestMapping("/dict" )
@Api(value = "dict",description = "字典管理模块")
@RequestMapping("/dict")
@Api(value = "dict", description = "字典管理模块")
public class DictController {
private final SysDictService sysDictService;
@@ -60,7 +60,7 @@ public class DictController {
* @param id ID
* @return 字典信息
*/
@GetMapping("/{id}" )
@GetMapping("/{id}")
public SysDict dict(@PathVariable Integer id) {
return sysDictService.selectById(id);
}
@@ -71,7 +71,7 @@ public class DictController {
* @param params 分页对象
* @return 分页对象
*/
@GetMapping("/dictPage" )
@GetMapping("/page")
public Page dictPage(@RequestParam Map<String, Object> params) {
return sysDictService.selectPage(new Query<>(params), new EntityWrapper<>());
}
@@ -82,8 +82,8 @@ public class DictController {
* @param type 类型
* @return 同类型字典
*/
@GetMapping("/type/{type}" )
@Cacheable(value = "dict_details", key = "#type" )
@GetMapping("/type/{type}")
@Cacheable(value = "dict_details", key = "#type")
public List<SysDict> findDictByType(@PathVariable String type) {
SysDict condition = new SysDict();
condition.setDelFlag(CommonConstant.STATUS_NORMAL);
@@ -97,10 +97,10 @@ public class DictController {
* @param sysDict 字典信息
* @return success、false
*/
@SysLog("添加字典" )
@SysLog("添加字典")
@PostMapping
@CacheEvict(value = "dict_details", key = "#sysDict.type" )
@PreAuthorize("@pms.hasPermission('sys_dict_add')" )
@CacheEvict(value = "dict_details", key = "#sysDict.type")
@PreAuthorize("@pms.hasPermission('sys_dict_add')")
public R<Boolean> dict(@Valid @RequestBody SysDict sysDict) {
return new R<>(sysDictService.insert(sysDict));
}
@@ -112,10 +112,10 @@ public class DictController {
* @param type 类型
* @return R
*/
@SysLog("删除字典" )
@DeleteMapping("/{id}/{type}" )
@CacheEvict(value = "dict_details", key = "#type" )
@PreAuthorize("@pms.hasPermission('sys_dict_del')" )
@SysLog("删除字典")
@DeleteMapping("/{id}/{type}")
@CacheEvict(value = "dict_details", key = "#type")
@PreAuthorize("@pms.hasPermission('sys_dict_del')")
public R<Boolean> deleteDict(@PathVariable Integer id, @PathVariable String type) {
return new R<>(sysDictService.deleteById(id));
}
@@ -127,9 +127,9 @@ public class DictController {
* @return success/false
*/
@PutMapping
@SysLog("修改字典" )
@CacheEvict(value = "dict_details", key = "#sysDict.type" )
@PreAuthorize("@pms.hasPermission('sys_dict_edit')" )
@SysLog("修改字典")
@CacheEvict(value = "dict_details", key = "#sysDict.type")
@PreAuthorize("@pms.hasPermission('sys_dict_edit')")
public R<Boolean> editDict(@Valid @RequestBody SysDict sysDict) {
return new R<>(sysDictService.updateById(sysDict));
}
@@ -57,7 +57,7 @@ public class LogController {
* @param params 分页对象
* @return 分页对象
*/
@GetMapping("/logPage")
@GetMapping("/page")
public Page logPage(@RequestParam Map<String, Object> params) {
return sysLogService.selectPage(new Query<>(params), new EntityWrapper<>());
}
@@ -56,7 +56,7 @@ public class MenuController {
*
* @return 当前用户的树形菜单
*/
@GetMapping(value = "/userMenu")
@GetMapping
public List<MenuTree> userMenu() {
// 获取符合条件得菜单
Set<MenuVO> all = new HashSet<>();
@@ -75,7 +75,7 @@ public class MenuController {
*
* @return 树形菜单
*/
@GetMapping(value = "/allTree")
@GetMapping(value = "/tree")
public List<MenuTree> getTree() {
SysMenu condition = new SysMenu();
condition.setDelFlag(CommonConstant.STATUS_NORMAL);
@@ -88,7 +88,7 @@ public class MenuController {
* @param roleId 角色ID
* @return 属性集合
*/
@GetMapping("/roleTree/{roleId}")
@GetMapping("/tree/{roleId}")
public List<Integer> roleTree(@PathVariable Integer roleId) {
return sysMenuService.findMenuByRoleId(roleId)
.stream()
@@ -95,7 +95,7 @@ public class RoleController {
*
* @return 角色列表
*/
@GetMapping("/roleList")
@GetMapping("/list")
public List<SysRole> roleList() {
return sysRoleService.selectList(new EntityWrapper<>());
@@ -107,7 +107,7 @@ public class RoleController {
* @param params 分页对象
* @return 分页对象
*/
@GetMapping("/rolePage")
@GetMapping("/page")
public Page rolePage(@RequestParam Map<String, Object> params) {
return sysRoleService.selectPage(new Query<>(params), new EntityWrapper<>());
}
@@ -119,7 +119,7 @@ public class RoleController {
* @param menuIds 菜单ID拼成的字符串,每个id之间根据逗号分隔
* @return success、false
*/
@PutMapping("/roleMenuUpd")
@PutMapping("/upd-menu")
@PreAuthorize("@pms.hasPermission('sys_role_perm')")
public R<Boolean> roleMenuUpd(Integer roleId, @RequestParam(value = "menuIds", required = false) String menuIds) {
SysRole sysRole = sysRoleService.selectById(roleId);
@@ -167,7 +167,7 @@ public class UserController {
* @param params 参数集
* @return 用户集合
*/
@GetMapping("/userPage")
@GetMapping("/page")
public Page userPage(@RequestParam Map<String, Object> params) {
return userService.selectWithRolePage(new Query(params));
}
@@ -178,7 +178,7 @@ public class UserController {
* @param userDto userDto
* @return success/false
*/
@PutMapping("/editInfo")
@PutMapping("/edit")
public R<Boolean> editInfo(@Valid @RequestBody UserDTO userDto) {
return userService.updateUserInfo(userDto, SecurityUtils.getUser().getUsername());
}
@@ -187,7 +187,7 @@ public class UserController {
* @param username 用户名称
* @return
*/
@GetMapping("/ancestorUsers/{username}")
@GetMapping("/ancestor/{username}")
public R<List<SysUser>> ancestorUsers(@PathVariable String username) {
return new R<>(userService.ancestorUsers(username));
}