♻️ Refactoring code.wrapper result of controller with R except activiti project
This commit is contained in:
1 parent
fa01371f09
commit
7c614bc5bf
19 files changed
+91
-105
No files matched your search
@@ -120,7 +120,7 @@ public class PigxTokenEndpoint {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/page")
|
||||
public Page tokenList(@RequestBody Map<String, Object> params, @RequestHeader(required = false) String from) {
|
||||
public R<Page> tokenList(@RequestBody Map<String, Object> params, @RequestHeader(required = false) String from) {
|
||||
if (StrUtil.isBlank(from)) {
|
||||
return null;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ public class PigxTokenEndpoint {
|
||||
Page result = new Page(MapUtil.getInt(params, "page"), MapUtil.getInt(params, "limit"));
|
||||
result.setRecords(list);
|
||||
result.setTotal(redisTemplate.keys(PIGX_OAUTH_ACCESS + "*").size());
|
||||
return result;
|
||||
return new R<>(result);
|
||||
}
|
||||
|
||||
private boolean extractToken(Map<String, String> map, Object principal) {
|
||||
|
||||
@@ -22,6 +22,7 @@ package com.pig4cloud.pigx.common.core.util;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -32,6 +33,7 @@ import java.io.Serializable;
|
||||
* @author lengleng
|
||||
*/
|
||||
@ToString
|
||||
@Accessors(chain=true)
|
||||
public class R<T> implements Serializable {
|
||||
private static final int SUCCESS = 0;
|
||||
private static final int FAIL = 1;
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ public interface RemoteTokenService {
|
||||
* @return page
|
||||
*/
|
||||
@PostMapping("/oauth/page")
|
||||
Page selectPage(@RequestBody Map<String, Object> params, @RequestHeader(SecurityConstants.FROM) String from);
|
||||
R<Page> selectPage(@RequestBody Map<String, Object> params, @RequestHeader(SecurityConstants.FROM) String from);
|
||||
|
||||
/**
|
||||
* 删除token
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public class RemoteTokenServiceFallbackImpl implements RemoteTokenService {
|
||||
* @return page
|
||||
*/
|
||||
@Override
|
||||
public Page selectPage(Map<String, Object> params, String from) {
|
||||
public R<Page> selectPage(Map<String, Object> params, String from) {
|
||||
log.error("调用认证中心查询token 失败", cause);
|
||||
return null;
|
||||
}
|
||||
|
||||
+6
-7
@@ -56,8 +56,8 @@ public class DeptController {
|
||||
* @return SysDept
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public SysDept get(@PathVariable Integer id) {
|
||||
return sysDeptService.selectById(id);
|
||||
public R<SysDept> get(@PathVariable Integer id) {
|
||||
return new R<>(sysDeptService.selectById(id));
|
||||
}
|
||||
|
||||
|
||||
@@ -67,9 +67,8 @@ public class DeptController {
|
||||
* @return 树形菜单
|
||||
*/
|
||||
@GetMapping(value = "/tree")
|
||||
public List<DeptTree> getTree() {
|
||||
SysDept condition = new SysDept();
|
||||
return sysDeptService.selectListTree(new EntityWrapper<>(condition));
|
||||
public R<List<DeptTree>> getTree() {
|
||||
return new R<>(sysDeptService.selectListTree(new EntityWrapper<>()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,8 +106,8 @@ public class DeptController {
|
||||
@SysLog("编辑部门")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_dept_edit')")
|
||||
public Boolean edit(@Valid @RequestBody SysDept sysDept) {
|
||||
public R<Boolean> edit(@Valid @RequestBody SysDept sysDept) {
|
||||
sysDept.setUpdateTime(LocalDateTime.now());
|
||||
return sysDeptService.updateDeptById(sysDept);
|
||||
return new R<>(sysDeptService.updateDeptById(sysDept));
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -60,8 +60,8 @@ public class DictController {
|
||||
* @return 字典信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public SysDict dict(@PathVariable Integer id) {
|
||||
return sysDictService.selectById(id);
|
||||
public R<SysDict> dict(@PathVariable Integer id) {
|
||||
return new R<>(sysDictService.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,8 +71,8 @@ public class DictController {
|
||||
* @return 分页对象
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Page dictPage(@RequestParam Map<String, Object> params) {
|
||||
return sysDictService.selectPage(new Query<>(params), new EntityWrapper<>());
|
||||
public R<Page> dictPage(@RequestParam Map<String, Object> params) {
|
||||
return new R<>(sysDictService.selectPage(new Query<>(params), new EntityWrapper<>()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,10 +83,10 @@ public class DictController {
|
||||
*/
|
||||
@GetMapping("/type/{type}")
|
||||
@Cacheable(value = "dict_details", key = "#type")
|
||||
public List<SysDict> findDictByType(@PathVariable String type) {
|
||||
public R<List<SysDict>> findDictByType(@PathVariable String type) {
|
||||
SysDict condition = new SysDict();
|
||||
condition.setType(type);
|
||||
return sysDictService.selectList(new EntityWrapper<>(condition));
|
||||
return new R<>(sysDictService.selectList(new EntityWrapper<>(condition)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -58,8 +58,8 @@ public class LogController {
|
||||
* @return 分页对象
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Page logPage(@RequestParam Map<String, Object> params) {
|
||||
return sysLogService.selectPage(new Query<>(params), new EntityWrapper<>());
|
||||
public R<Page> logPage(@RequestParam Map<String, Object> params) {
|
||||
return new R<>(sysLogService.selectPage(new Query<>(params), new EntityWrapper<>()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+7
-7
@@ -58,8 +58,8 @@ public class MenuController {
|
||||
* @return 当前用户的树形菜单
|
||||
*/
|
||||
@GetMapping
|
||||
public List<MenuTree> userMenu() {
|
||||
// 获取符合条件得菜单
|
||||
public R<List<MenuTree>> userMenu() {
|
||||
// 获取符合条件的菜单
|
||||
Set<MenuVO> all = new HashSet<>();
|
||||
SecurityUtils.getRoles()
|
||||
.forEach(roleId -> all.addAll(sysMenuService.findMenuByRoleId(roleId)));
|
||||
@@ -68,7 +68,7 @@ public class MenuController {
|
||||
.map(MenuTree::new)
|
||||
.sorted(Comparator.comparingInt(MenuTree::getSort))
|
||||
.collect(Collectors.toList());
|
||||
return TreeUtil.bulid(menuTreeList, -1);
|
||||
return new R<>(TreeUtil.bulid(menuTreeList, -1));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,8 +77,8 @@ public class MenuController {
|
||||
* @return 树形菜单
|
||||
*/
|
||||
@GetMapping(value = "/tree")
|
||||
public List<MenuTree> getTree() {
|
||||
return TreeUtil.bulidTree(sysMenuService.selectList(new EntityWrapper<>()), -1);
|
||||
public R<List<MenuTree>> getTree() {
|
||||
return new R<>(TreeUtil.bulidTree(sysMenuService.selectList(new EntityWrapper<>()), -1));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,8 +102,8 @@ public class MenuController {
|
||||
* @return 菜单详细信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public SysMenu menu(@PathVariable Integer id) {
|
||||
return sysMenuService.selectById(id);
|
||||
public R<SysMenu> menu(@PathVariable Integer id) {
|
||||
return new R<>(sysMenuService.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-4
@@ -56,8 +56,8 @@ public class OauthClientDetailsController {
|
||||
* @return SysOauthClientDetails
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public SysOauthClientDetails get(@PathVariable Integer id) {
|
||||
return sysOauthClientDetailsService.selectById(id);
|
||||
public R<SysOauthClientDetails> get(@PathVariable Integer id) {
|
||||
return new R<>(sysOauthClientDetailsService.selectById(id));
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ public class OauthClientDetailsController {
|
||||
* @return 分页对象
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Page page(@RequestParam Map<String, Object> params) {
|
||||
return sysOauthClientDetailsService.selectPage(new Query<>(params), new EntityWrapper<>());
|
||||
public R<Page> page(@RequestParam Map<String, Object> params) {
|
||||
return new R<>(sysOauthClientDetailsService.selectPage(new Query<>(params), new EntityWrapper<>()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-7
@@ -54,8 +54,8 @@ public class RoleController {
|
||||
* @return 角色信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public SysRole role(@PathVariable Integer id) {
|
||||
return sysRoleService.selectById(id);
|
||||
public R<SysRole> role(@PathVariable Integer id) {
|
||||
return new R<>(sysRoleService.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,9 +103,8 @@ public class RoleController {
|
||||
* @return 角色列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public List<SysRole> roleList() {
|
||||
return sysRoleService.selectList(new EntityWrapper<>());
|
||||
|
||||
public R<List<SysRole>> roleList() {
|
||||
return new R<>(sysRoleService.selectList(new EntityWrapper<>()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,8 +114,8 @@ public class RoleController {
|
||||
* @return 分页对象
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Page rolePage(@RequestParam Map<String, Object> params) {
|
||||
return sysRoleService.selectPage(new Query<>(params), new EntityWrapper<>());
|
||||
public R<Page> rolePage(@RequestParam Map<String, Object> params) {
|
||||
return new R<>(sysRoleService.selectPage(new Query<>(params), new EntityWrapper<>()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-5
@@ -56,8 +56,8 @@ public class SysSocialDetailsController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Page page(@RequestParam Map<String, Object> params) {
|
||||
return sysSocialDetailsService.selectPage(new Query<>(params), new EntityWrapper<>());
|
||||
public R<Page> page(@RequestParam Map<String, Object> params) {
|
||||
return new R<>(sysSocialDetailsService.selectPage(new Query<>(params), new EntityWrapper<>()));
|
||||
}
|
||||
|
||||
|
||||
@@ -68,9 +68,8 @@ public class SysSocialDetailsController {
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R info(@PathVariable("id") Integer id) {
|
||||
SysSocialDetails sysSocialDetails = sysSocialDetailsService.selectById(id);
|
||||
return new R<>(sysSocialDetails);
|
||||
public R<SysSocialDetails> info(@PathVariable("id") Integer id) {
|
||||
return new R<>(sysSocialDetailsService.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class TokenController {
|
||||
* @return token集合
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Page token(@RequestParam Map<String, Object> params) {
|
||||
public R<Page> token(@RequestParam Map<String, Object> params) {
|
||||
return remoteTokenService.selectPage(params, SecurityConstants.FROM_IN);
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -91,8 +91,8 @@ public class UserController {
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public UserVO user(@PathVariable Integer id) {
|
||||
return userService.selectUserVoById(id);
|
||||
public R<UserVO> user(@PathVariable Integer id) {
|
||||
return new R<>(userService.selectUserVoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,8 +169,8 @@ public class UserController {
|
||||
* @return 用户集合
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Page userPage(@RequestParam Map<String, Object> params) {
|
||||
return userService.selectWithRolePage(new Query(params));
|
||||
public R<Page> userPage(@RequestParam Map<String, Object> params) {
|
||||
return new R<>(userService.selectWithRolePage(new Query(params)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.pig4cloud.pigx.codegen.entity.GenConfig;
|
||||
import com.pig4cloud.pigx.codegen.service.SysGeneratorService;
|
||||
import com.pig4cloud.pigx.common.core.util.Query;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -48,10 +49,9 @@ public class SysGeneratorController {
|
||||
* @return 数据库表
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Page list(@RequestParam Map<String, Object> params) {
|
||||
public R<Page> list(@RequestParam Map<String, Object> params) {
|
||||
Query query = new Query(params);
|
||||
query.setRecords(sysGeneratorService.queryPage(query));
|
||||
return query;
|
||||
return new R<>(query.setRecords(sysGeneratorService.queryPage(query)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ${package}.${moduleName}.controller;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
@@ -19,9 +20,9 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${pathName}")
|
||||
@AllArgsConstructor
|
||||
public class ${className}Controller {
|
||||
@Autowired
|
||||
private ${className}Service ${classname}Service;
|
||||
private final ${className}Service ${classname}Service;
|
||||
|
||||
|
||||
/**
|
||||
@@ -30,8 +31,8 @@ public class ${className}Controller {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Page page(@RequestParam Map<String, Object> params) {
|
||||
return ${classname}Service.selectPage(new Query<>(params), new EntityWrapper<>());
|
||||
public R<Page> page(@RequestParam Map<String, Object> params) {
|
||||
return new R<>(${classname}Service.selectPage(new Query<>(params), new EntityWrapper<>()));
|
||||
}
|
||||
|
||||
|
||||
@@ -41,9 +42,8 @@ public class ${className}Controller {
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/{${pk.lowerAttrName}}")
|
||||
public R info(@PathVariable("${pk.lowerAttrName}") ${pk.attrType} ${pk.lowerAttrName}){
|
||||
${className} ${classname} = ${classname}Service.selectById(${pk.lowerAttrName});
|
||||
return new R<>(${classname});
|
||||
public R get${className}ById(@PathVariable("${pk.lowerAttrName}") ${pk.attrType} ${pk.lowerAttrName}){
|
||||
return new R<>(${classname}Service.selectById(${pk.lowerAttrName}));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ public class ${className}Controller {
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping
|
||||
public R save(@RequestBody ${className} ${classname}){
|
||||
public R save${className}(@RequestBody ${className} ${classname}){
|
||||
return new R<>(${classname}Service.insert(${classname}));
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ${className}Controller {
|
||||
* @return R
|
||||
*/
|
||||
@PutMapping
|
||||
public R update(@RequestBody ${className} ${classname}){
|
||||
public R update${className}(@RequestBody ${className} ${classname}){
|
||||
${classname}Service.updateById(${classname});
|
||||
return new R<>(Boolean.TRUE);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class ${className}Controller {
|
||||
* @return R
|
||||
*/
|
||||
@DeleteMapping("/{${pk.lowerAttrName}}")
|
||||
public R delete(@PathVariable ${pk.attrType} ${pk.lowerAttrName}){
|
||||
public R delete${className}ById(@PathVariable ${pk.attrType} ${pk.lowerAttrName}){
|
||||
return new R<>(${classname}Service.deleteById(${pk.lowerAttrName}));
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ export function fetchList(query) {
|
||||
|
||||
export function addObj(obj) {
|
||||
return request({
|
||||
url: '/${moduleName}/${pathName}/',
|
||||
url: '/${moduleName}/${pathName}',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
@@ -49,7 +49,7 @@ export function delObj(id) {
|
||||
|
||||
export function putObj(obj) {
|
||||
return request({
|
||||
url: '/${moduleName}/${pathName}/',
|
||||
url: '/${moduleName}/${pathName}',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
|
||||
+15
-21
@@ -23,7 +23,7 @@ import com.pig4cloud.pigx.common.core.util.Query;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.daemon.entity.ExecutionLog;
|
||||
import com.pig4cloud.pigx.daemon.service.ExecutionLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -35,9 +35,10 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/executionlog")
|
||||
@AllArgsConstructor
|
||||
public class ExecutionLogController {
|
||||
@Autowired
|
||||
private ExecutionLogService executionLogService;
|
||||
|
||||
private final ExecutionLogService executionLogService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -47,8 +48,8 @@ public class ExecutionLogController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Page page(@RequestParam Map<String, Object> params) {
|
||||
return executionLogService.selectPage(new Query<>(params), new EntityWrapper<>());
|
||||
public R<Page> page(@RequestParam Map<String, Object> params) {
|
||||
return new R<>(executionLogService.selectPage(new Query<>(params), new EntityWrapper<>()));
|
||||
}
|
||||
|
||||
|
||||
@@ -59,10 +60,8 @@ public class ExecutionLogController {
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R info(@PathVariable("id") String id) {
|
||||
ExecutionLog executionLog = executionLogService.selectById(id);
|
||||
|
||||
return new R<>(executionLog);
|
||||
public R<ExecutionLog> info(@PathVariable("id") String id) {
|
||||
return new R<>(executionLogService.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,11 +70,9 @@ public class ExecutionLogController {
|
||||
* @param executionLog
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public R save(@RequestBody ExecutionLog executionLog) {
|
||||
executionLogService.insert(executionLog);
|
||||
|
||||
return new R<>(Boolean.TRUE);
|
||||
@PostMapping
|
||||
public R<Boolean> save(@RequestBody ExecutionLog executionLog) {
|
||||
return new R<>(executionLogService.insert(executionLog));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,11 +81,9 @@ public class ExecutionLogController {
|
||||
* @param executionLog
|
||||
* @return R
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public R update(@RequestBody ExecutionLog executionLog) {
|
||||
executionLogService.updateById(executionLog);
|
||||
|
||||
return new R<>(Boolean.TRUE);
|
||||
@PutMapping
|
||||
public R<Boolean> update(@RequestBody ExecutionLog executionLog) {
|
||||
return new R<>(executionLogService.updateById(executionLog));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,8 +93,7 @@ public class ExecutionLogController {
|
||||
* @return R
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public R delete(@PathVariable String id) {
|
||||
|
||||
public R<Boolean> delete(@PathVariable String id) {
|
||||
return new R<>(executionLogService.deleteById(id));
|
||||
}
|
||||
|
||||
|
||||
+14
-21
@@ -23,7 +23,7 @@ import com.pig4cloud.pigx.common.core.util.Query;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.daemon.entity.StatusTraceLog;
|
||||
import com.pig4cloud.pigx.daemon.service.StatusTraceLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -34,11 +34,10 @@ import java.util.Map;
|
||||
* @date 2018-08-03 22:15:45
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/statustracelog")
|
||||
public class StatusTraceLogController {
|
||||
@Autowired
|
||||
private StatusTraceLogService statusTraceLogService;
|
||||
|
||||
private final StatusTraceLogService statusTraceLogService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
@@ -47,8 +46,8 @@ public class StatusTraceLogController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Page page(@RequestParam Map<String, Object> params) {
|
||||
return statusTraceLogService.selectPage(new Query<>(params), new EntityWrapper<>());
|
||||
public R<Page> page(@RequestParam Map<String, Object> params) {
|
||||
return new R<>(statusTraceLogService.selectPage(new Query<>(params), new EntityWrapper<>()));
|
||||
}
|
||||
|
||||
|
||||
@@ -59,10 +58,8 @@ public class StatusTraceLogController {
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R info(@PathVariable("id") String id) {
|
||||
StatusTraceLog statusTraceLog = statusTraceLogService.selectById(id);
|
||||
|
||||
return new R<>(statusTraceLog);
|
||||
public R<StatusTraceLog> info(@PathVariable("id") String id) {
|
||||
return new R<>(statusTraceLogService.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,11 +68,9 @@ public class StatusTraceLogController {
|
||||
* @param statusTraceLog
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public R save(@RequestBody StatusTraceLog statusTraceLog) {
|
||||
statusTraceLogService.insert(statusTraceLog);
|
||||
|
||||
return new R<>(Boolean.TRUE);
|
||||
@PostMapping
|
||||
public R<Boolean> save(@RequestBody StatusTraceLog statusTraceLog) {
|
||||
return new R<>(statusTraceLogService.insert(statusTraceLog));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,11 +79,9 @@ public class StatusTraceLogController {
|
||||
* @param statusTraceLog
|
||||
* @return R
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public R update(@RequestBody StatusTraceLog statusTraceLog) {
|
||||
statusTraceLogService.updateById(statusTraceLog);
|
||||
|
||||
return new R<>(Boolean.TRUE);
|
||||
@PutMapping
|
||||
public R<Boolean> update(@RequestBody StatusTraceLog statusTraceLog) {
|
||||
return new R<>(statusTraceLogService.updateById(statusTraceLog));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +91,7 @@ public class StatusTraceLogController {
|
||||
* @return R
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public R delete(@PathVariable("id") String id) {
|
||||
public R<Boolean> delete(@PathVariable("id") String id) {
|
||||
return new R<>(statusTraceLogService.deleteById(id));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
public class DemoController {
|
||||
@GetMapping("/")
|
||||
@GetMapping("/user")
|
||||
public Authentication user(Authentication authentication) {
|
||||
return authentication;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user