|
|
@@ -7,12 +7,17 @@ import com.dk.common.response.ResponseCodeEnum;
|
|
|
import com.dk.common.response.ResponseResultUtil;
|
|
|
import com.dk.common.response.ResponseResultVO;
|
|
|
import com.dk.mdm.infrastructure.convert.mst.StaffConvert;
|
|
|
+import com.dk.mdm.model.pojo.mst.Role;
|
|
|
+import com.dk.mdm.model.pojo.mst.RoleFun;
|
|
|
import com.dk.mdm.model.pojo.mst.Staff;
|
|
|
import com.dk.mdm.mapper.mst.StaffMapper;
|
|
|
import com.dk.common.service.BaseService;
|
|
|
import com.dk.common.mapper.BaseMapper;
|
|
|
+import com.dk.mdm.model.pojo.mst.StaffRight;
|
|
|
import com.dk.mdm.model.query.core.StaffQuery;
|
|
|
+import com.dk.mdm.model.query.mst.RoleQuery;
|
|
|
import com.dk.mdm.model.response.mst.StaffResponse;
|
|
|
+import com.dk.mdm.model.vo.mst.RoleVo;
|
|
|
import com.dk.mdm.model.vo.mst.StaffVO;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -23,105 +28,129 @@ import java.util.List;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
/**
|
|
|
- * @desc : 员工API接口
|
|
|
* @author : 姜永辉
|
|
|
- * @date : 2023/1/4 9:25
|
|
|
+ * @desc : 员工API接口
|
|
|
+ * @date : 2023/1/4 9:25
|
|
|
*/
|
|
|
@Service
|
|
|
public class StaffService extends BaseService<Staff> {
|
|
|
|
|
|
- @Override
|
|
|
- public BaseMapper<Staff> getRepository() {
|
|
|
- return staffMapper;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @desc : 重写主键
|
|
|
- * @author : 姜永辉
|
|
|
- * @date : 2023/1/9 10:39
|
|
|
- */
|
|
|
- @Override
|
|
|
- public String getPrimaryKey() {
|
|
|
- return "staff_id";
|
|
|
- }
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private StaffMapper staffMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private StaffConvert staffConvert;
|
|
|
-
|
|
|
- /**
|
|
|
- * @desc : 条件查询
|
|
|
- * @author : 姜永辉
|
|
|
- * @date : 2023/1/9 10:40
|
|
|
- */
|
|
|
- @Pagination
|
|
|
- public ResponseResultVO<PageList<StaffResponse>> selectByCond(StaffQuery staffQuery) {
|
|
|
- return super.mergeListWithCount(staffQuery, staffMapper.selectByCond(staffQuery),
|
|
|
- staffMapper.countByCond(staffQuery));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @desc : 保存方法
|
|
|
- * @author : 姜永辉
|
|
|
- * @date : 2023/1/9 10:49
|
|
|
- */
|
|
|
- @Transactional(
|
|
|
- rollbackFor = {Exception.class}
|
|
|
- )
|
|
|
- public ResponseResultVO<?> insert(StaffVO staffVO) {
|
|
|
- // 转化实体
|
|
|
- Staff staff = staffConvert.convertToPo(staffVO);
|
|
|
-
|
|
|
- return super.insert(staff);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @desc : 编辑方法
|
|
|
- * @author : 姜永辉
|
|
|
- * @date : 2023/1/9 10:49
|
|
|
- */
|
|
|
- @Transactional(
|
|
|
- rollbackFor = {Exception.class}
|
|
|
- )
|
|
|
- public ResponseResultVO<Boolean> update(StaffVO staffVO) {
|
|
|
- // 转化实体
|
|
|
- Staff staff = staffConvert.convertToPo(staffVO);
|
|
|
- return ResponseResultUtil.success(super.update(staff,new UpdateWrapper<Staff>().lambda().eq(Staff::getStaffId,
|
|
|
- UUID.fromString(staff.getStaffId())))) ;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @desc : 员工离职
|
|
|
- * @author : 姜永辉
|
|
|
- * @date : 2023/2/13 13:45
|
|
|
- */
|
|
|
- @Transactional(
|
|
|
- rollbackFor = {Exception.class}
|
|
|
- )
|
|
|
- public ResponseResultVO<Boolean> dimission(StaffVO staffVO) {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return ResponseResultUtil.success();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @desc : 导入员工
|
|
|
- * @author : 姜永辉
|
|
|
- * @date : 2023/3/1 14:40
|
|
|
- */
|
|
|
- @Transactional(
|
|
|
- rollbackFor = {Exception.class}
|
|
|
- )
|
|
|
- public ResponseResultVO<Boolean> importStaffList(List<StaffVO> list) {
|
|
|
- if (CollectionUtils.isEmpty(list) || list.size() == 0) {
|
|
|
- return ResponseResultUtil.error(ResponseCodeEnum.INSERT_FAIL);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- return ResponseResultUtil.success();
|
|
|
- }
|
|
|
+ @Override
|
|
|
+ public BaseMapper<Staff> getRepository() {
|
|
|
+ return staffMapper;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 重写主键
|
|
|
+ * @author : 姜永辉
|
|
|
+ * @date : 2023/1/9 10:39
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String getPrimaryKey() {
|
|
|
+ return "staff_id";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StaffMapper staffMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StaffConvert staffConvert;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StaffRightService staffRightService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 条件查询
|
|
|
+ * @author : 姜永辉
|
|
|
+ * @date : 2023/1/9 10:40
|
|
|
+ */
|
|
|
+ @Pagination
|
|
|
+ public ResponseResultVO<PageList<StaffResponse>> selectByCond(StaffQuery staffQuery) {
|
|
|
+ return super.mergeListWithCount(staffQuery, staffMapper.selectByCond(staffQuery),
|
|
|
+ staffMapper.countByCond(staffQuery));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 保存方法
|
|
|
+ * @author : 姜永辉
|
|
|
+ * @date : 2023/1/9 10:49
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<?> insert(StaffVO staffVO) {
|
|
|
+ // 转化实体
|
|
|
+ Staff staff = staffConvert.convertToPo(staffVO);
|
|
|
+
|
|
|
+ return super.insert(staff);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 编辑方法
|
|
|
+ * @author : 姜永辉
|
|
|
+ * @date : 2023/1/9 10:49
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<Boolean> update(StaffVO staffVO) {
|
|
|
+ // 转化实体
|
|
|
+ Staff staff = staffConvert.convertToPo(staffVO);
|
|
|
+ return ResponseResultUtil.success(super.update(staff, new UpdateWrapper<Staff>().lambda().eq(Staff::getStaffId,
|
|
|
+ UUID.fromString(staff.getStaffId()))));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 保存权限方法
|
|
|
+ * @author : 姜永辉
|
|
|
+ * @date : 2023/1/9 10:49
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<?> saveStaffRight(StaffVO staffVO) {
|
|
|
+ // 转化实体
|
|
|
+ Staff staff = staffConvert.convertToPo(staffVO);
|
|
|
+ staffRightService.delete(staffVO.getStaffId());
|
|
|
+ for (StaffRight staffRight : staffVO.getStaffRightList()) {
|
|
|
+ staffRight.setStaffId(staff.getStaffId());
|
|
|
+ staffRight.setRightType(1);
|
|
|
+ staffRight.setCpId(staff.getCpId());
|
|
|
+ }
|
|
|
+ staffRightService.saveStaffRight(staffVO.getStaffRightList());
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 员工离职
|
|
|
+ * @author : 姜永辉
|
|
|
+ * @date : 2023/2/13 13:45
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<Boolean> dimission(StaffVO staffVO) {
|
|
|
+
|
|
|
+
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 导入员工
|
|
|
+ * @author : 姜永辉
|
|
|
+ * @date : 2023/3/1 14:40
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<Boolean> importStaffList(List<StaffVO> list) {
|
|
|
+ if (CollectionUtils.isEmpty(list) || list.size() == 0) {
|
|
|
+ return ResponseResultUtil.error(ResponseCodeEnum.INSERT_FAIL);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
|
|
|
}
|