StaffController.java
5.49 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
136
137
138
139
140
141
142
143
144
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.merchant.MerchantSaveRequest;
import cn.com.glsx.merchants.request.merchant.MerchantSearchResquest;
import cn.com.glsx.merchants.request.staff.*;
import cn.com.glsx.merchants.response.MerchantRopResponse;
import cn.com.glsx.merchants.response.StaffResponse;
import cn.com.glsx.merchants.service.StaffService;
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: TODO
* @date 2021/7/22 13:45
*/
@Slf4j
@Api("员工接口")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
public class StaffController {
@Autowired
private StaffService staffService;
/**
* 保存员工
*
* @param staffSaveRequest 入参
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.merchant.saveStaff", needInSession = NeedInSessionType.NO)
@ApiOperation("保存员工")
public RopResponse<Boolean> saveStaff(StaffSaveRequest staffSaveRequest) {
try {
staffService.saveStaff(staffSaveRequest);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======StaffController__invoke__saveStaff__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 更新员工
*
* @param staffUpdateRequest 入参
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.merchant.updateStaff", needInSession = NeedInSessionType.NO)
@ApiOperation("更新员工")
public RopResponse<Boolean> updateStaff(StaffUpdateRequest staffUpdateRequest) {
try {
staffService.updateStaff(staffUpdateRequest);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======StaffController__invoke__updateStaff__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 删除员工
*
* @param staffDeleteRequest 入参
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.merchant.deleteStaff", needInSession = NeedInSessionType.NO)
@ApiOperation("删除员工")
public RopResponse<Boolean> deleteStaff(StaffDeleteRequest staffDeleteRequest) {
try {
staffService.deleteStaff(staffDeleteRequest);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======StaffController__invoke__deleteStaff__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 查询员工详情
*
* @param staffSearchRequest 入参
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.merchant.staffSearchRequest", needInSession = NeedInSessionType.NO)
@ApiOperation("查询员工详情")
public RopResponse<StaffResponse> findMerchantStaffDetail(StaffSearchRequest staffSearchRequest) {
try {
StaffResponse staffResponse=staffService.findMerchantStaffDetail(staffSearchRequest);
return RopResponse.success(staffResponse);
} catch (RpcServiceException e) {
log.info("=======StaffController__invoke__findMerchantStaffDetail__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 查询员工列表
*
* @param staffListRequest 入参
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.merchant.findMerchantStaffList", needInSession = NeedInSessionType.NO)
@ApiOperation("查询员工列表")
public RopResponse<List<StaffResponse>> findMerchantStaffList(StaffListRequest staffListRequest) {
try {
List<StaffResponse> staffResponse=staffService.findMerchantStaffList(staffListRequest);
return RopResponse.success(staffResponse);
} catch (RpcServiceException e) {
log.info("=======StaffController__invoke__findMerchantStaffList__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 查询员工分页列表
*
* @param staffPageRequest 入参
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.menu.findStaffByPage", needInSession = NeedInSessionType.NO)
@ApiOperation("查询员工分页列表")
public RopResponse<Pagination<StaffResponse>> findStaffByPage(StaffPageRequest staffPageRequest) {
try {
Pagination<StaffResponse> list = staffService.findStaffByPage(staffPageRequest);
return RopResponse.success(list);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__findStaffByPage__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
}