MerchantRoleController.java
4.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package cn.com.glsx.merchants.controller;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.merchants.request.role.*;
import cn.com.glsx.merchants.response.RoleResponse;
import cn.com.glsx.merchants.service.MerchantRoleService;
import cn.com.glsx.merchants.util.Pagination;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* @author zhouhaibao
* @version 1.0
* @description: 角色管理接口
* @date 2021/7/13 10:00
*/
@Slf4j
@Api("角色管理接口")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
public class MerchantRoleController {
@Autowired
private MerchantRoleService roleService;
/**
* 角色管理获取列表接口
*
* @param request
* @return
*/
@ServiceMethod(method = "merchants.api.role.list", needInSession = NeedInSessionType.NO)
@ApiOperation("角色管理获取列表接口")
public RopResponse<List<RoleResponse>> getRoleList(RoleSearchRequest request) {
try {
return RopResponse.success(roleService.getRoleList(request));
} catch (RpcServiceException e) {
log.info("=======MerchantRoleController__invoke__getRoleList__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/**
* 角色管理获取分页数据接口
*
* @param request
* @return
*/
@ServiceMethod(method = "merchants.api.role.page", needInSession = NeedInSessionType.NO)
@ApiOperation("角色管理获取分页数据接口")
public RopResponse<Pagination<RoleResponse>> getRolePage(RoleListSearchRequest request) {
try {
return RopResponse.success(roleService.getRolePage(request));
} catch (RpcServiceException e) {
log.info("=======MerchantRoleController__invoke__getRolePage__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/**
* 根据id获取角色管理接口
*
* @param request
* @return
*/
@ServiceMethod(method = "merchants.api.role.getById", needInSession = NeedInSessionType.NO)
@ApiOperation("根据id获取角色管理接口")
public RopResponse<RoleResponse> getById(RoleSearchRequest request) {
try {
return RopResponse.success(roleService.getById(request.getId()));
} catch (RpcServiceException e) {
log.info("=======MerchantRoleController__invoke__getById__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/**
* 根据id获取角色管理接口
*
* @param request
* @return
*/
@ServiceMethod(method = "merchants.api.role.deleteById", needInSession = NeedInSessionType.NO)
@ApiOperation("根据id获取角色管理接口")
public RopResponse<Boolean> deleteById(RoleDeleteRequest request) {
try {
return RopResponse.success(roleService.delete(request));
} catch (RpcServiceException e) {
log.info("=======MerchantRoleController__invoke__deleteById__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/**
* 角色管理新增接口
*
* @param request
* @return
*/
@ServiceMethod(method = "merchants.api.role.insert", needInSession = NeedInSessionType.NO)
@ApiOperation("角色管理新增接口")
public RopResponse<Boolean> insert(RoleInsertRequest request) {
try {
return RopResponse.success(roleService.insert(request));
} catch (RpcServiceException e) {
log.info("=======MerchantRoleController__invoke__insert__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/**
* 角色管理更新接口
*
* @param request
* @return
*/
@ServiceMethod(method = "merchants.api.role.update", needInSession = NeedInSessionType.NO)
@ApiOperation("角色管理更新接口")
public RopResponse<Boolean> update(RoleUpdateRequest request) {
try {
return RopResponse.success(roleService.update(request));
} catch (RpcServiceException e) {
log.info("=======MerchantRoleController__invoke__update__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
}