dev:岗位管理代码
parent
b654af6045
commit
d57158fcce
|
|
@ -0,0 +1,59 @@
|
|||
//package com.zcloud.basic.info.facade;
|
||||
//
|
||||
//import cn.hutool.core.bean.BeanUtil;
|
||||
//import com.alibaba.cola.dto.MultiResponse;
|
||||
//import com.alibaba.cola.dto.SingleResponse;
|
||||
//import com.zcloud.basic.info.api.PostServiceI;
|
||||
//import com.zcloud.basic.info.dto.PostListQry;
|
||||
//import com.zcloud.basic.info.dto.clientobject.PostCO;
|
||||
//import com.zcloud.gbscommon.zcloudpost.facade.ZcloudPostFacade;
|
||||
//import com.zcloud.gbscommon.zcloudpost.request.ZcloudPostQry;
|
||||
//import com.zcloud.gbscommon.zcloudpost.response.ZcloudPostCO;
|
||||
//import org.apache.dubbo.config.annotation.DubboService;
|
||||
//import org.springframework.beans.BeanUtils;
|
||||
//
|
||||
//import javax.annotation.Resource;
|
||||
//import java.util.List;
|
||||
//import java.util.Objects;
|
||||
//
|
||||
///**
|
||||
// * @author SondonYong
|
||||
// * @description 岗位管理对其他领域dubbo接口实现
|
||||
// * @date 2025/11/1/周六 15:28
|
||||
// */
|
||||
//@DubboService
|
||||
//public class ZcloudPostFacadeImpl implements ZcloudPostFacade {
|
||||
//
|
||||
// @Resource
|
||||
// private PostServiceI postService;
|
||||
//
|
||||
// public SingleResponse<ZcloudPostCO> listByPostId(ZcloudPostQry qry){
|
||||
// if(Objects.isNull(qry) || Objects.isNull(qry.getPostId())){
|
||||
// return null;
|
||||
// }
|
||||
// SingleResponse<PostCO> postCO = postService.getInfoById(qry.getPostId());
|
||||
// if(Objects.isNull(postCO) || Objects.isNull(postCO.getData())){
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// ZcloudPostCO zcloudPostCO = new ZcloudPostCO();
|
||||
// BeanUtils.copyProperties(postCO.getData(), zcloudPostCO);
|
||||
//
|
||||
// return SingleResponse.of(zcloudPostCO);
|
||||
// }
|
||||
//
|
||||
// public MultiResponse<ZcloudPostCO> listByPostIds(ZcloudPostQry qry){
|
||||
//
|
||||
// PostListQry postListQry = new PostListQry();
|
||||
// BeanUtils.copyProperties(qry, postListQry);
|
||||
// MultiResponse<PostCO> list = postService.list(postListQry);
|
||||
//
|
||||
// if(Objects.isNull(list) || Objects.isNull(list.getData())){
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// List<ZcloudPostCO> zcloudPostCOList = BeanUtil.copyToList(list.getData(), ZcloudPostCO.class);
|
||||
//
|
||||
// return MultiResponse.of(zcloudPostCOList);
|
||||
// }
|
||||
//}
|
||||
|
|
@ -2,10 +2,7 @@ package com.zcloud.basic.info.web;
|
|||
|
||||
|
||||
import com.zcloud.basic.info.api.PostServiceI;
|
||||
import com.zcloud.basic.info.dto.PostAddCmd;
|
||||
import com.zcloud.basic.info.dto.PostPageQry;
|
||||
import com.zcloud.basic.info.dto.PostRemoveCmd;
|
||||
import com.zcloud.basic.info.dto.PostUpdateCmd;
|
||||
import com.zcloud.basic.info.dto.*;
|
||||
import com.zcloud.basic.info.dto.clientobject.PostCO;
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
|
|
@ -49,8 +46,8 @@ public class PostController {
|
|||
|
||||
@ApiOperation("所有数据")
|
||||
@GetMapping("/listAll")
|
||||
public MultiResponse<PostCO> listAll() {
|
||||
return MultiResponse.of(new ArrayList<PostCO>());
|
||||
public MultiResponse<PostCO> listAll(@RequestBody PostListQry qry) {
|
||||
return postService.list(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("详情")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.zcloud.basic.info.command;
|
||||
|
||||
import com.zcloud.basic.info.domain.gateway.PostDepartmentGateway;
|
||||
import com.zcloud.basic.info.domain.gateway.PostGateway;
|
||||
import com.zcloud.basic.info.domain.model.PostDepartmentE;
|
||||
import com.zcloud.basic.info.domain.model.PostE;
|
||||
import com.zcloud.basic.info.dto.PostAddCmd;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
|
|
@ -9,6 +11,9 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
|
|
@ -20,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
@AllArgsConstructor
|
||||
public class PostAddExe {
|
||||
private final PostGateway postGateway;
|
||||
private final PostDepartmentGateway postDepartmentGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(PostAddCmd cmd) {
|
||||
|
|
@ -27,7 +33,18 @@ public class PostAddExe {
|
|||
BeanUtils.copyProperties(cmd, postE);
|
||||
boolean res = false;
|
||||
try {
|
||||
res = postGateway.add(postE);
|
||||
// 新增岗位
|
||||
Long postId = postGateway.add(postE);
|
||||
if(Objects.nonNull(postId) && postId > 0) {
|
||||
res = true;
|
||||
}
|
||||
|
||||
// 岗位部门关联
|
||||
if(res && cmd.getSupervisionFlag() == 1) {
|
||||
List<PostDepartmentE> postDepartmentEList = postE.addDepartmentIds(postId, cmd.getDepartmentIds());
|
||||
res = postDepartmentGateway.addList(postDepartmentEList);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
package com.zcloud.basic.info.command;
|
||||
|
||||
import com.zcloud.basic.info.domain.gateway.PostDepartmentGateway;
|
||||
import com.zcloud.basic.info.domain.model.PostDepartmentE;
|
||||
import com.zcloud.basic.info.dto.PostDepartmentAddCmd;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class PostDepartmentAddExe {
|
||||
private final PostDepartmentGateway postDepartmentGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(PostDepartmentAddCmd cmd) {
|
||||
PostDepartmentE postDepartmentE = new PostDepartmentE();
|
||||
BeanUtils.copyProperties(cmd, postDepartmentE);
|
||||
boolean res = false;
|
||||
try {
|
||||
res = postDepartmentGateway.add(postDepartmentE);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.zcloud.basic.info.command;
|
||||
|
||||
import com.zcloud.basic.info.domain.gateway.PostDepartmentGateway;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class PostDepartmentRemoveExe {
|
||||
private final PostDepartmentGateway postDepartmentGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
boolean res = postDepartmentGateway.deletedPostDepartmentById(id);
|
||||
if(!res){
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
boolean res = postDepartmentGateway.deletedPostDepartmentByIds(ids);
|
||||
if(!res){
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.zcloud.basic.info.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.basic.info.domain.gateway.PostDepartmentGateway;
|
||||
import com.zcloud.basic.info.domain.model.PostDepartmentE;
|
||||
import com.zcloud.basic.info.dto.PostDepartmentUpdateCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class PostDepartmentUpdateExe {
|
||||
private final PostDepartmentGateway postDepartmentGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(PostDepartmentUpdateCmd postDepartmentUpdateCmd) {
|
||||
PostDepartmentE postDepartmentE = new PostDepartmentE();
|
||||
BeanUtils.copyProperties(postDepartmentUpdateCmd, postDepartmentE);
|
||||
boolean res = postDepartmentGateway.update(postDepartmentE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.basic.info.command;
|
||||
|
||||
import com.zcloud.basic.info.domain.gateway.PostDepartmentGateway;
|
||||
import com.zcloud.basic.info.domain.gateway.PostGateway;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -17,10 +18,12 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
@AllArgsConstructor
|
||||
public class PostRemoveExe {
|
||||
private final PostGateway postGateway;
|
||||
private final PostDepartmentGateway postDepartmentGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
boolean res = postGateway.deletedPostById(id);
|
||||
postDepartmentGateway.deletedPostDepartment(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
|
|
@ -30,6 +33,7 @@ public class PostRemoveExe {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
boolean res = postGateway.deletedPostByIds(ids);
|
||||
postDepartmentGateway.deletedPostDepartment(ids);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.zcloud.basic.info.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.basic.info.domain.gateway.PostDepartmentGateway;
|
||||
import com.zcloud.basic.info.domain.gateway.PostGateway;
|
||||
import com.zcloud.basic.info.domain.model.PostDepartmentE;
|
||||
import com.zcloud.basic.info.domain.model.PostE;
|
||||
import com.zcloud.basic.info.dto.PostUpdateCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -9,6 +11,8 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
|
|
@ -20,12 +24,21 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
@AllArgsConstructor
|
||||
public class PostUpdateExe {
|
||||
private final PostGateway postGateway;
|
||||
private final PostDepartmentGateway postDepartmentGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(PostUpdateCmd postUpdateCmd) {
|
||||
PostE postE = new PostE();
|
||||
BeanUtils.copyProperties(postUpdateCmd, postE);
|
||||
boolean res = postGateway.update(postE);
|
||||
|
||||
// 岗位关联部门
|
||||
if(res && postUpdateCmd.getSupervisionFlag() == 1){
|
||||
postDepartmentGateway.deletedPostDepartment(postE.getId());
|
||||
List<PostDepartmentE> postDepartmentEList = postE.addDepartmentIds(postE.getId(), postUpdateCmd.getDepartmentIds());
|
||||
res = postDepartmentGateway.addList(postDepartmentEList);
|
||||
}
|
||||
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.zcloud.basic.info.command.convertor;
|
||||
|
||||
import com.zcloud.basic.info.dto.clientobject.PostDepartmentCO;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDepartmentDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface PostDepartmentCoConvertor {
|
||||
/**
|
||||
* @param postDepartmentDOs
|
||||
* @return
|
||||
*/
|
||||
List<PostDepartmentCO> converDOsToCOs(List<PostDepartmentDO> postDepartmentDOs);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.zcloud.basic.info.command.query;
|
||||
|
||||
import com.zcloud.basic.info.command.convertor.PostDepartmentCoConvertor;
|
||||
import com.zcloud.basic.info.dto.PostDepartmentPageQry;
|
||||
import com.zcloud.basic.info.dto.clientobject.PostDepartmentCO;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDepartmentDO;
|
||||
import com.zcloud.basic.info.persistence.repository.PostDepartmentRepository;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class PostDepartmentQueryExe {
|
||||
private final PostDepartmentRepository postDepartmentRepository;
|
||||
private final PostDepartmentCoConvertor postDepartmentCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param postDepartmentPageQry
|
||||
* @return
|
||||
*/
|
||||
public PageResponse<PostDepartmentCO> execute(PostDepartmentPageQry postDepartmentPageQry) {
|
||||
Map<String,Object> params = PageQueryHelper.toHashMap(postDepartmentPageQry);
|
||||
PageResponse<PostDepartmentDO> pageResponse = postDepartmentRepository.listPage(params);
|
||||
List<PostDepartmentCO> examCenterCOS = postDepartmentCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
public SingleResponse<PostDepartmentCO> execute(Long id) {
|
||||
SingleResponse<PostDepartmentDO> postDepartmentDO = postDepartmentRepository.getInfoById(id);
|
||||
SingleResponse<PostDepartmentCO> postDepartmentCO = new SingleResponse<>();
|
||||
BeanUtils.copyProperties(postDepartmentDO, postDepartmentCO);
|
||||
return postDepartmentCO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,9 +1,17 @@
|
|||
package com.zcloud.basic.info.command.query;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.zcloud.basic.info.command.convertor.PostCoConvertor;
|
||||
import com.zcloud.basic.info.command.convertor.PostDepartmentCoConvertor;
|
||||
import com.zcloud.basic.info.dto.PostDepartmentPageQry;
|
||||
import com.zcloud.basic.info.dto.PostListQry;
|
||||
import com.zcloud.basic.info.dto.PostPageQry;
|
||||
import com.zcloud.basic.info.dto.clientobject.PostCO;
|
||||
import com.zcloud.basic.info.dto.clientobject.PostDepartmentCO;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDO;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDepartmentDO;
|
||||
import com.zcloud.basic.info.persistence.repository.PostDepartmentRepository;
|
||||
import com.zcloud.basic.info.persistence.repository.PostRepository;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
|
|
@ -12,8 +20,10 @@ import lombok.AllArgsConstructor;
|
|||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -26,7 +36,9 @@ import java.util.Map;
|
|||
@AllArgsConstructor
|
||||
public class PostQueryExe {
|
||||
private final PostRepository postRepository;
|
||||
private final PostDepartmentRepository postDepartmentRepository;
|
||||
private final PostCoConvertor postCoConvertor;
|
||||
private final PostDepartmentCoConvertor postDepartmentCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
|
|
@ -41,10 +53,54 @@ public class PostQueryExe {
|
|||
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
public MultiResponse<PostCO> execute(PostListQry qry) {
|
||||
|
||||
// 岗位集合
|
||||
MultiResponse<PostDO> postMRDO = postRepository.list(qry.getPostIds());
|
||||
// 岗位部门集合
|
||||
List<PostDepartmentDO> postDepartmentDOList = postDepartmentRepository.list(qry.getPostIds());
|
||||
|
||||
// Map<岗位id, List<岗位部门对象>>
|
||||
Map<Long, List<PostDepartmentCO>> postDepartmentMap = new HashMap<>();
|
||||
if(CollUtil.isNotEmpty(postDepartmentDOList)) {
|
||||
List<PostDepartmentCO> postDepartmentCOList = postDepartmentCoConvertor.converDOsToCOs(postDepartmentDOList);
|
||||
postDepartmentMap = postDepartmentCOList.stream().collect(Collectors.groupingBy(PostDepartmentCO::getPostId));
|
||||
}
|
||||
|
||||
// 赋值
|
||||
List<PostDO> postDOList = postMRDO.getData();
|
||||
List<PostCO> postCOList = postCoConvertor.converDOsToCOs(postDOList);
|
||||
if(CollUtil.isNotEmpty(postCOList)) {
|
||||
for (PostCO postCO : postCOList) {
|
||||
if(CollUtil.isNotEmpty(postDepartmentMap) && CollUtil.isNotEmpty(postDepartmentMap.get(postCO.getId()))) {
|
||||
postCO.setDepartmentList(postDepartmentMap.get(postCO.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MultiResponse<PostCO> postCOResponse = new MultiResponse<>();
|
||||
postCOResponse.setData(postCOList);
|
||||
|
||||
return postCOResponse;
|
||||
}
|
||||
|
||||
public SingleResponse<PostCO> execute(Long id) {
|
||||
SingleResponse<PostDO> postDO = postRepository.getInfoById(id);
|
||||
SingleResponse<PostCO> postCO = new SingleResponse<>();
|
||||
BeanUtils.copyProperties(postDO, postCO);
|
||||
PostCO co = new PostCO();
|
||||
BeanUtils.copyProperties(postDO.getData(), co);
|
||||
postCO.setData(co);
|
||||
|
||||
// 岗位-部门权限关联代码
|
||||
if(co.getSupervisionFlag() == 1){
|
||||
PostDepartmentPageQry qry = new PostDepartmentPageQry();
|
||||
qry.setEqPostId(id);
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
||||
List<PostDepartmentDO> postDepartmentDOS = postDepartmentRepository.list(params);
|
||||
List<PostDepartmentCO> postDepartmentCOS = postDepartmentCoConvertor.converDOsToCOs(postDepartmentDOS);
|
||||
postCO.getData().setDepartmentList(postDepartmentCOS);
|
||||
}
|
||||
|
||||
return postCO;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
package com.zcloud.basic.info.service;
|
||||
|
||||
import com.zcloud.basic.info.api.PostDepartmentServiceI;
|
||||
import com.zcloud.basic.info.command.PostDepartmentAddExe;
|
||||
import com.zcloud.basic.info.command.PostDepartmentRemoveExe;
|
||||
import com.zcloud.basic.info.command.PostDepartmentUpdateExe;
|
||||
import com.zcloud.basic.info.command.query.PostDepartmentQueryExe;
|
||||
import com.zcloud.basic.info.dto.PostDepartmentAddCmd;
|
||||
import com.zcloud.basic.info.dto.PostDepartmentPageQry;
|
||||
import com.zcloud.basic.info.dto.PostDepartmentUpdateCmd;
|
||||
import com.zcloud.basic.info.dto.clientobject.PostDepartmentCO;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* web-app
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class PostDepartmentServiceImpl implements PostDepartmentServiceI {
|
||||
private final PostDepartmentAddExe postDepartmentAddExe;
|
||||
private final PostDepartmentUpdateExe postDepartmentUpdateExe;
|
||||
private final PostDepartmentRemoveExe postDepartmentRemoveExe;
|
||||
private final PostDepartmentQueryExe postDepartmentQueryExe;
|
||||
|
||||
@Override
|
||||
public PageResponse<PostDepartmentCO> listPage(PostDepartmentPageQry qry){
|
||||
|
||||
return postDepartmentQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<PostDepartmentCO> getInfoById(Long id){
|
||||
|
||||
return postDepartmentQueryExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse add(PostDepartmentAddCmd cmd) {
|
||||
|
||||
postDepartmentAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(PostDepartmentUpdateCmd postDepartmentUpdateCmd) {
|
||||
postDepartmentUpdateExe.execute(postDepartmentUpdateCmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
postDepartmentRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBatch(Long[] ids) {
|
||||
postDepartmentRemoveExe.execute(ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
package com.zcloud.basic.info.service;
|
||||
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.zcloud.basic.info.api.PostServiceI;
|
||||
import com.zcloud.basic.info.command.PostAddExe;
|
||||
import com.zcloud.basic.info.command.PostRemoveExe;
|
||||
import com.zcloud.basic.info.command.PostUpdateExe;
|
||||
import com.zcloud.basic.info.command.query.PostQueryExe;
|
||||
import com.zcloud.basic.info.dto.PostAddCmd;
|
||||
import com.zcloud.basic.info.dto.PostListQry;
|
||||
import com.zcloud.basic.info.dto.PostPageQry;
|
||||
import com.zcloud.basic.info.dto.PostUpdateCmd;
|
||||
import com.zcloud.basic.info.dto.clientobject.PostCO;
|
||||
|
|
@ -35,6 +37,12 @@ public class PostServiceImpl implements PostServiceI {
|
|||
return postQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiResponse<PostCO> list(PostListQry qry) {
|
||||
return postQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SingleResponse<PostCO> getInfoById(Long id) {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.zcloud.basic.info.api;
|
||||
|
||||
import com.zcloud.basic.info.dto.PostDepartmentAddCmd;
|
||||
import com.zcloud.basic.info.dto.PostDepartmentPageQry;
|
||||
import com.zcloud.basic.info.dto.PostDepartmentUpdateCmd;
|
||||
import com.zcloud.basic.info.dto.clientobject.PostDepartmentCO;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
public interface PostDepartmentServiceI {
|
||||
PageResponse<PostDepartmentCO> listPage(PostDepartmentPageQry qry);
|
||||
|
||||
SingleResponse<PostDepartmentCO> getInfoById(Long id);
|
||||
|
||||
SingleResponse<PostDepartmentCO> add(PostDepartmentAddCmd cmd);
|
||||
|
||||
void edit(PostDepartmentUpdateCmd cmd);
|
||||
|
||||
void remove(Long id);
|
||||
|
||||
void removeBatch(Long[] ids);
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package com.zcloud.basic.info.api;
|
||||
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.zcloud.basic.info.dto.PostAddCmd;
|
||||
import com.zcloud.basic.info.dto.PostListQry;
|
||||
import com.zcloud.basic.info.dto.PostPageQry;
|
||||
import com.zcloud.basic.info.dto.PostUpdateCmd;
|
||||
import com.zcloud.basic.info.dto.clientobject.PostCO;
|
||||
|
|
@ -17,6 +19,8 @@ import com.alibaba.cola.dto.SingleResponse;
|
|||
public interface PostServiceI {
|
||||
PageResponse<PostCO> listPage(PostPageQry qry);
|
||||
|
||||
MultiResponse<PostCO> list(PostListQry qry);
|
||||
|
||||
SingleResponse<PostCO> getInfoById(Long id);
|
||||
|
||||
SingleResponse<PostCO> add(PostAddCmd cmd);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,10 @@ public class PostAddCmd extends Command {
|
|||
private String corpinfoName;
|
||||
|
||||
@ApiModelProperty(value = "是否监管岗位 1-是, 2-不是", name = "supervisionFlag", required = true)
|
||||
@NotNull(message = "是否监管岗位 1-是, 2-不是不能为空")
|
||||
@NotNull(message = "是否监管岗位 1-是, 2-不是,不能为空")
|
||||
private Integer supervisionFlag;
|
||||
|
||||
@ApiModelProperty(value = "岗位 部门权限", name = "departmentIds")
|
||||
private Long[] departmentIds;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.zcloud.basic.info.dto;
|
||||
|
||||
import com.alibaba.cola.dto.Command;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PostDepartmentAddCmd extends Command {
|
||||
@ApiModelProperty(value = "岗位id", name = "postId", required = true)
|
||||
@NotNull(message = "岗位id不能为空")
|
||||
private Long postId;
|
||||
|
||||
@ApiModelProperty(value = "部门id", name = "departmentId", required = true)
|
||||
@NotNull(message = "部门id不能为空")
|
||||
private Long departmentId;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.zcloud.basic.info.dto;
|
||||
|
||||
import com.alibaba.cola.dto.PageQuery;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web-client
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Data
|
||||
public class PostDepartmentPageQry extends PageQuery {
|
||||
|
||||
/**
|
||||
* 查询条件操作前缀,支持以下几种数据库查询操作:
|
||||
* - `like`: 模糊匹配查询,对应SQL的LIKE操作符
|
||||
* - `eq`: 等值查询,对应SQL的=操作符
|
||||
* - `gt`: 大于比较查询
|
||||
* - `lt`: 小于比较查询
|
||||
* - `ge`: 大于等于比较查询
|
||||
* - `le`: 小于等于比较查询
|
||||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||
*/
|
||||
private Long eqPostId;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.zcloud.basic.info.dto;
|
||||
|
||||
import com.alibaba.cola.dto.Command;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PostDepartmentRemoveCmd extends Command {
|
||||
|
||||
@ApiModelProperty(value = "主键", name = "ids", required = true)
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long[] ids;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.zcloud.basic.info.dto;
|
||||
|
||||
import com.alibaba.cola.dto.Command;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PostDepartmentUpdateCmd extends Command {
|
||||
@ApiModelProperty(value = "主键", name = "id", required = true)
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "业务主键id", name = "postDepartmentId", required = true)
|
||||
@NotEmpty(message = "业务主键id不能为空")
|
||||
private String postDepartmentId;
|
||||
@ApiModelProperty(value = "岗位id", name = "postId", required = true)
|
||||
@NotNull(message = "岗位id不能为空")
|
||||
private Long postId;
|
||||
@ApiModelProperty(value = "部门id", name = "departmentId", required = true)
|
||||
@NotNull(message = "部门id不能为空")
|
||||
private Long departmentId;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.zcloud.basic.info.dto;
|
||||
|
||||
import com.alibaba.cola.dto.PageQuery;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* web-client
|
||||
*
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:24:04
|
||||
*/
|
||||
@Data
|
||||
public class PostListQry {
|
||||
|
||||
/**
|
||||
* 查询条件操作前缀,支持以下几种数据库查询操作:
|
||||
* - `like`: 模糊匹配查询,对应SQL的LIKE操作符
|
||||
* - `eq`: 等值查询,对应SQL的=操作符
|
||||
* - `gt`: 大于比较查询
|
||||
* - `lt`: 小于比较查询
|
||||
* - `ge`: 大于等于比较查询
|
||||
* - `le`: 小于等于比较查询
|
||||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||
*/
|
||||
|
||||
// 主键id集合
|
||||
private Long[] postIds;
|
||||
}
|
||||
|
||||
|
|
@ -23,6 +23,12 @@ public class PostPageQry extends PageQuery {
|
|||
* - `le`: 小于等于比较查询
|
||||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||
*/
|
||||
private String likePostId;
|
||||
// 部门id
|
||||
private Long eqDepartmentId;
|
||||
// 企业id
|
||||
private Long eqCorpinfoId;
|
||||
// 岗位名称
|
||||
private String likePostName;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,10 @@ public class PostUpdateCmd extends Command {
|
|||
@NotEmpty(message = "企业名称不能为空")
|
||||
private String corpinfoName;
|
||||
@ApiModelProperty(value = "是否监管岗位 1-是, 2-不是", name = "supervisionFlag", required = true)
|
||||
@NotNull(message = "是否监管岗位 1-是, 2-不是不能为空")
|
||||
@NotNull(message = "是否监管岗位 1-是, 2-不是,不能为空")
|
||||
private Integer supervisionFlag;
|
||||
|
||||
@ApiModelProperty(value = "岗位 部门权限", name = "departmentIds")
|
||||
private Long[] departmentIds;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -46,6 +47,10 @@ public class PostCO extends ClientObject {
|
|||
//是否监管岗位 1-是, 2-不是
|
||||
@ApiModelProperty(value = "是否监管岗位 1-是, 2-不是")
|
||||
private Integer supervisionFlag;
|
||||
|
||||
@ApiModelProperty(value = "监管部门数据权限-部门列表")
|
||||
private List<PostDepartmentCO> departmentList;
|
||||
|
||||
//乐观锁
|
||||
@ApiModelProperty(value = "乐观锁")
|
||||
private Integer version;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.zcloud.basic.info.dto.clientobject;
|
||||
|
||||
import com.alibaba.cola.dto.ClientObject;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web-client
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Data
|
||||
public class PostDepartmentCO extends ClientObject {
|
||||
private Long id;
|
||||
//业务主键id
|
||||
@ApiModelProperty(value = "业务主键id")
|
||||
private String postDepartmentId;
|
||||
//岗位id
|
||||
@ApiModelProperty(value = "岗位id")
|
||||
private Long postId;
|
||||
//部门id
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private Long departmentId;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.zcloud.basic.info.domain.gateway;
|
||||
|
||||
import com.zcloud.basic.info.domain.model.PostDepartmentE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-domain
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
public interface PostDepartmentGateway {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Boolean add(PostDepartmentE postDepartmentE) ;
|
||||
|
||||
Boolean addList(List<PostDepartmentE> postDepartmentEList) ;
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
Boolean update(PostDepartmentE postDepartmentE);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
Boolean deletedPostDepartmentById(Long id);
|
||||
Boolean deletedPostDepartment(Long postId);
|
||||
Boolean deletedPostDepartment(Long[] postIds);
|
||||
Boolean deletedPostDepartmentByIds(Long[] id);
|
||||
}
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ public interface PostGateway {
|
|||
/**
|
||||
* 新增
|
||||
*/
|
||||
Boolean add(PostE postE);
|
||||
Long add(PostE postE);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.zcloud.basic.info.domain.model;
|
||||
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* web-domain
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Data
|
||||
public class PostDepartmentE extends BaseE {
|
||||
private Long id;
|
||||
//业务主键id
|
||||
private String postDepartmentId;
|
||||
//岗位id
|
||||
private Long postId;
|
||||
//部门id
|
||||
private Long departmentId;
|
||||
}
|
||||
|
||||
|
|
@ -1,9 +1,13 @@
|
|||
package com.zcloud.basic.info.domain.model;
|
||||
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* web-domain
|
||||
|
|
@ -33,5 +37,22 @@ public class PostE extends BaseE {
|
|||
private String corpinfoName;
|
||||
//是否监管岗位 1-是, 2-不是
|
||||
private Integer supervisionFlag;
|
||||
|
||||
// 添加关联部门行为
|
||||
public List<PostDepartmentE> addDepartmentIds(Long postId, Long[] departmentIds) {
|
||||
if(Objects.isNull(departmentIds) || departmentIds.length == 0){
|
||||
// 没有部门id集合, 可能是没有给部门权限
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<PostDepartmentE> postDepartmentEList = new ArrayList<>();
|
||||
for (Long departmentId : departmentIds) {
|
||||
PostDepartmentE e = new PostDepartmentE();
|
||||
e.setPostDepartmentId(UuidUtil.get32UUID());
|
||||
e.setPostId(postId);
|
||||
e.setDepartmentId(departmentId);
|
||||
postDepartmentEList.add(e);
|
||||
}
|
||||
return postDepartmentEList;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
package com.zcloud.basic.info.gatewayimpl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zcloud.basic.info.domain.gateway.PostDepartmentGateway;
|
||||
import com.zcloud.basic.info.domain.model.PostDepartmentE;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDepartmentDO;
|
||||
import com.zcloud.basic.info.persistence.repository.PostDepartmentRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class PostDepartmentGatewayImpl implements PostDepartmentGateway {
|
||||
private final PostDepartmentRepository postDepartmentRepository;
|
||||
|
||||
@Override
|
||||
public Boolean add(PostDepartmentE postDepartmentE) {
|
||||
PostDepartmentDO d = new PostDepartmentDO();
|
||||
BeanUtils.copyProperties(postDepartmentE, d);
|
||||
postDepartmentRepository.save(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean addList(List<PostDepartmentE> postDepartmentEList) {
|
||||
if(CollUtil.isEmpty(postDepartmentEList)){
|
||||
return true;
|
||||
}
|
||||
List<PostDepartmentDO> postDepartmentDOS = BeanUtil.copyToList(postDepartmentEList, PostDepartmentDO.class);
|
||||
postDepartmentRepository.saveBatch(postDepartmentDOS);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update(PostDepartmentE postDepartmentE) {
|
||||
PostDepartmentDO d = new PostDepartmentDO();
|
||||
BeanUtils.copyProperties(postDepartmentE, d);
|
||||
postDepartmentRepository.updateById(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deletedPostDepartmentById(Long id) {
|
||||
return postDepartmentRepository.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deletedPostDepartment(Long postId) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("post_id", postId);
|
||||
return postDepartmentRepository.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deletedPostDepartment(Long[] postIds) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.in("post_id", Arrays.asList(postIds));
|
||||
return postDepartmentRepository.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deletedPostDepartmentByIds(Long[] ids) {
|
||||
return postDepartmentRepository.removeByIds(Arrays.asList(ids));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4,10 +4,13 @@ import com.zcloud.basic.info.domain.gateway.PostGateway;
|
|||
import com.zcloud.basic.info.domain.model.PostE;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDO;
|
||||
import com.zcloud.basic.info.persistence.repository.PostRepository;
|
||||
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
|
|
@ -22,11 +25,14 @@ public class PostGatewayImpl implements PostGateway {
|
|||
private final PostRepository postRepository;
|
||||
|
||||
@Override
|
||||
public Boolean add(PostE postE) {
|
||||
public Long add(PostE postE) {
|
||||
PostDO d = new PostDO();
|
||||
BeanUtils.copyProperties(postE, d);
|
||||
if(StringUtils.isEmpty(d.getPostId())){
|
||||
d.setPostId(UuidUtil.get32UUID());
|
||||
}
|
||||
postRepository.save(d);
|
||||
return true;
|
||||
return d.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -44,7 +50,7 @@ public class PostGatewayImpl implements PostGateway {
|
|||
|
||||
@Override
|
||||
public Boolean deletedPostByIds(Long[] ids) {
|
||||
return postRepository.removeByIds(Collections.singletonList(ids));
|
||||
return postRepository.removeByIds(Arrays.asList(ids));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.zcloud.basic.info.persistence.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.jjb.saas.framework.repository.basedo.BaseDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Data
|
||||
@TableName("post_department")
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PostDepartmentDO extends BaseDO {
|
||||
//业务主键id
|
||||
@ApiModelProperty(value = "业务主键id")
|
||||
private String postDepartmentId;
|
||||
//岗位id
|
||||
@ApiModelProperty(value = "岗位id")
|
||||
private Long postId;
|
||||
//部门id
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private Long departmentId;
|
||||
|
||||
public PostDepartmentDO(String postDepartmentId) {
|
||||
this.postDepartmentId = postDepartmentId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.zcloud.basic.info.persistence.mapper;
|
||||
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDepartmentDO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Mapper
|
||||
public interface PostDepartmentMapper extends BaseMapper<PostDepartmentDO> {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.zcloud.basic.info.persistence.repository;
|
||||
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDepartmentDO;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.jjb.saas.framework.repository.repo.BaseRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
public interface PostDepartmentRepository extends BaseRepository<PostDepartmentDO> {
|
||||
|
||||
PageResponse<PostDepartmentDO> listPage(Map<String,Object> params);
|
||||
|
||||
List<PostDepartmentDO> list(Map<String,Object> params);
|
||||
|
||||
List<PostDepartmentDO> list(Long[] postIds);
|
||||
|
||||
SingleResponse<PostDepartmentDO> getInfoById(Long id);
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.basic.info.persistence.repository;
|
||||
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDO;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
|
|
@ -17,6 +18,8 @@ public interface PostRepository extends BaseRepository<PostDO> {
|
|||
|
||||
PageResponse<PostDO> listPage(Map<String, Object> params);
|
||||
|
||||
MultiResponse<PostDO> list(Long[] ids);
|
||||
|
||||
SingleResponse<PostDO> getInfoById(Long id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
package com.zcloud.basic.info.persistence.repository.impl;
|
||||
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDepartmentDO;
|
||||
import com.zcloud.basic.info.persistence.mapper.PostDepartmentMapper;
|
||||
import com.zcloud.basic.info.persistence.repository.PostDepartmentRepository;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.gbscommon.utils.Query;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:53:11
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PostDepartmentRepositoryImpl extends BaseRepositoryImpl<PostDepartmentMapper, PostDepartmentDO> implements PostDepartmentRepository {
|
||||
private final PostDepartmentMapper postDepartmentMapper;
|
||||
|
||||
@Override
|
||||
public PageResponse<PostDepartmentDO> listPage(Map<String,Object> params) {
|
||||
IPage<PostDepartmentDO> iPage = new Query<PostDepartmentDO>().getPage(params);
|
||||
QueryWrapper<PostDepartmentDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
IPage<PostDepartmentDO> result = postDepartmentMapper.selectPage(iPage, queryWrapper);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PostDepartmentDO> list(Map<String, Object> params) {
|
||||
QueryWrapper<PostDepartmentDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
List<PostDepartmentDO> postDepartmentDOS = postDepartmentMapper.selectList(queryWrapper);
|
||||
return postDepartmentDOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PostDepartmentDO> list(Long[] postIds) {
|
||||
QueryWrapper<PostDepartmentDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("post_id", postIds);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
List<PostDepartmentDO> postDepartmentDOS = postDepartmentMapper.selectList(queryWrapper);
|
||||
return postDepartmentDOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<PostDepartmentDO> getInfoById(Long id) {
|
||||
return SingleResponse.of(postDepartmentMapper.selectById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.basic.info.persistence.repository.impl;
|
||||
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDO;
|
||||
import com.zcloud.basic.info.persistence.mapper.PostMapper;
|
||||
|
|
@ -14,6 +15,7 @@ import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -37,6 +39,15 @@ public class PostRepositoryImpl extends BaseRepositoryImpl<PostMapper, PostDO> i
|
|||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiResponse<PostDO> list(Long[] ids) {
|
||||
QueryWrapper<PostDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("id", ids);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
List<PostDO> postDOS = postMapper.selectList(queryWrapper);
|
||||
return MultiResponse.of(postDOS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<PostDO> getInfoById(Long id) {
|
||||
return SingleResponse.of(postMapper.selectById(id));
|
||||
|
|
|
|||
Loading…
Reference in New Issue