init:岗位管理代码初始化
parent
94f8bf8b46
commit
20b24c3c74
|
|
@ -0,0 +1,85 @@
|
|||
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.clientobject.PostCO;
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* web-adapter
|
||||
*
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:24:04
|
||||
*/
|
||||
@Api(tags = "岗位表")
|
||||
@RequestMapping("/${application.gateway}/post")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class PostController {
|
||||
private final PostServiceI postService;
|
||||
|
||||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<PostCO> add(@Validated @RequestBody PostAddCmd cmd) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
return postService.add(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("分页")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<PostCO> page(@RequestBody PostPageQry qry) {
|
||||
return postService.listPage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("所有数据")
|
||||
@GetMapping("/listAll")
|
||||
public MultiResponse<PostCO> listAll() {
|
||||
return MultiResponse.of(new ArrayList<PostCO>());
|
||||
}
|
||||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/getInfoById")
|
||||
public SingleResponse<PostCO> getInfoById(@RequestParam(value = "id") String id) {
|
||||
Long idLong = Long.parseLong(id);
|
||||
return SingleResponse.of(new PostCO());
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@PutMapping("/remove")
|
||||
public Response remove(@RequestParam(value = "id") String id) {
|
||||
Long idLong = Long.parseLong(id);
|
||||
postService.remove(idLong);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("删除多个")
|
||||
@PutMapping("/removeBatch")
|
||||
public Response removeBatch(@Validated @RequestBody PostRemoveCmd cmd) {
|
||||
postService.removeBatch(cmd.getIds());
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping("/edit")
|
||||
public SingleResponse edit(@Validated @RequestBody PostUpdateCmd postUpdateCmd) {
|
||||
postService.edit(postUpdateCmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.zcloud.basic.info.command;
|
||||
|
||||
import com.zcloud.basic.info.domain.gateway.PostGateway;
|
||||
import com.zcloud.basic.info.domain.model.PostE;
|
||||
import com.zcloud.basic.info.dto.PostAddCmd;
|
||||
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:24:04
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class PostAddExe {
|
||||
private final PostGateway postGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(PostAddCmd cmd) {
|
||||
PostE postE = new PostE();
|
||||
BeanUtils.copyProperties(cmd, postE);
|
||||
boolean res = false;
|
||||
try {
|
||||
res = postGateway.add(postE);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.zcloud.basic.info.command;
|
||||
|
||||
import com.zcloud.basic.info.domain.gateway.PostGateway;
|
||||
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:24:04
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class PostRemoveExe {
|
||||
private final PostGateway postGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
boolean res = postGateway.deletedPostById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
boolean res = postGateway.deletedPostByIds(ids);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.zcloud.basic.info.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.basic.info.domain.gateway.PostGateway;
|
||||
import com.zcloud.basic.info.domain.model.PostE;
|
||||
import com.zcloud.basic.info.dto.PostUpdateCmd;
|
||||
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:24:05
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class PostUpdateExe {
|
||||
private final PostGateway postGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(PostUpdateCmd postUpdateCmd) {
|
||||
PostE postE = new PostE();
|
||||
BeanUtils.copyProperties(postUpdateCmd, postE);
|
||||
boolean res = postGateway.update(postE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.zcloud.basic.info.command.convertor;
|
||||
|
||||
import com.zcloud.basic.info.dto.clientobject.PostCO;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:24:04
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface PostCoConvertor {
|
||||
/**
|
||||
* @param postDOs
|
||||
* @return
|
||||
*/
|
||||
List<PostCO> converDOsToCOs(List<PostDO> postDOs);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.zcloud.basic.info.command.query;
|
||||
|
||||
import com.zcloud.basic.info.command.convertor.PostCoConvertor;
|
||||
import com.zcloud.basic.info.dto.PostPageQry;
|
||||
import com.zcloud.basic.info.dto.clientobject.PostCO;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDO;
|
||||
import com.zcloud.basic.info.persistence.repository.PostRepository;
|
||||
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:24:04
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class PostQueryExe {
|
||||
private final PostRepository postRepository;
|
||||
private final PostCoConvertor postCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param postPageQry
|
||||
* @return
|
||||
*/
|
||||
public PageResponse<PostCO> execute(PostPageQry postPageQry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(postPageQry);
|
||||
PageResponse<PostDO> pageResponse = postRepository.listPage(params);
|
||||
List<PostCO> examCenterCOS = postCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
public SingleResponse<PostCO> execute(Long id) {
|
||||
SingleResponse<PostDO> postDO = postRepository.getInfoById(id);
|
||||
SingleResponse<PostCO> postCO = new SingleResponse<>();
|
||||
BeanUtils.copyProperties(postDO, postCO);
|
||||
return postCO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.zcloud.basic.info.service;
|
||||
|
||||
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.PostPageQry;
|
||||
import com.zcloud.basic.info.dto.PostUpdateCmd;
|
||||
import com.zcloud.basic.info.dto.clientobject.PostCO;
|
||||
|
||||
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:24:04
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class PostServiceImpl implements PostServiceI {
|
||||
private final PostAddExe postAddExe;
|
||||
private final PostUpdateExe postUpdateExe;
|
||||
private final PostRemoveExe postRemoveExe;
|
||||
private final PostQueryExe postQueryExe;
|
||||
|
||||
@Override
|
||||
public PageResponse<PostCO> listPage(PostPageQry qry) {
|
||||
|
||||
return postQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<PostCO> getInfoById(Long id) {
|
||||
|
||||
return postQueryExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse add(PostAddCmd cmd) {
|
||||
|
||||
postAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(PostUpdateCmd postUpdateCmd) {
|
||||
postUpdateExe.execute(postUpdateCmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
postRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBatch(Long[] ids) {
|
||||
postRemoveExe.execute(ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.zcloud.basic.info.api;
|
||||
|
||||
import com.zcloud.basic.info.dto.PostAddCmd;
|
||||
import com.zcloud.basic.info.dto.PostPageQry;
|
||||
import com.zcloud.basic.info.dto.PostUpdateCmd;
|
||||
import com.zcloud.basic.info.dto.clientobject.PostCO;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
*
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:24:04
|
||||
*/
|
||||
public interface PostServiceI {
|
||||
PageResponse<PostCO> listPage(PostPageQry qry);
|
||||
|
||||
SingleResponse<PostCO> getInfoById(Long id);
|
||||
|
||||
SingleResponse<PostCO> add(PostAddCmd cmd);
|
||||
|
||||
void edit(PostUpdateCmd cmd);
|
||||
|
||||
void remove(Long id);
|
||||
|
||||
void removeBatch(Long[] ids);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
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:24:03
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PostAddCmd extends Command {
|
||||
@ApiModelProperty(value = "部门id", name = "departmentId", required = true)
|
||||
@NotNull(message = "部门id不能为空")
|
||||
private Long departmentId;
|
||||
|
||||
@ApiModelProperty(value = "部门名称", name = "departmentName", required = true)
|
||||
@NotEmpty(message = "部门名称不能为空")
|
||||
private String departmentName;
|
||||
|
||||
@ApiModelProperty(value = "岗位名称", name = "postName", required = true)
|
||||
@NotEmpty(message = "岗位名称不能为空")
|
||||
private String postName;
|
||||
|
||||
@ApiModelProperty(value = "岗位职责", name = "postDuty", required = true)
|
||||
@NotEmpty(message = "岗位职责不能为空")
|
||||
private String postDuty;
|
||||
|
||||
@ApiModelProperty(value = "状态 1-启用, 2-禁用", name = "status", required = true)
|
||||
@NotNull(message = "状态 1-启用, 2-禁用不能为空")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
|
||||
@NotNull(message = "企业id不能为空")
|
||||
private Long corpinfoId;
|
||||
|
||||
@ApiModelProperty(value = "企业名称", name = "corpinfoName", required = true)
|
||||
@NotEmpty(message = "企业名称不能为空")
|
||||
private String corpinfoName;
|
||||
|
||||
@ApiModelProperty(value = "是否监管岗位 1-是, 2-不是", name = "supervisionFlag", required = true)
|
||||
@NotNull(message = "是否监管岗位 1-是, 2-不是不能为空")
|
||||
private Integer supervisionFlag;
|
||||
}
|
||||
|
||||
|
|
@ -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:24:04
|
||||
*/
|
||||
@Data
|
||||
public class PostPageQry extends PageQuery {
|
||||
|
||||
/**
|
||||
* 查询条件操作前缀,支持以下几种数据库查询操作:
|
||||
* - `like`: 模糊匹配查询,对应SQL的LIKE操作符
|
||||
* - `eq`: 等值查询,对应SQL的=操作符
|
||||
* - `gt`: 大于比较查询
|
||||
* - `lt`: 小于比较查询
|
||||
* - `ge`: 大于等于比较查询
|
||||
* - `le`: 小于等于比较查询
|
||||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||
*/
|
||||
private String likePostId;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
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:31:01
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PostRemoveCmd extends Command {
|
||||
|
||||
@ApiModelProperty(value = "主键", name = "ids", required = true)
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long[] ids;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
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:24:05
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PostUpdateCmd extends Command {
|
||||
@ApiModelProperty(value = "主键", name = "id", required = true)
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "业务主键id", name = "postId", required = true)
|
||||
@NotEmpty(message = "业务主键id不能为空")
|
||||
private String postId;
|
||||
@ApiModelProperty(value = "部门id", name = "departmentId", required = true)
|
||||
@NotNull(message = "部门id不能为空")
|
||||
private Long departmentId;
|
||||
@ApiModelProperty(value = "部门名称", name = "departmentName", required = true)
|
||||
@NotEmpty(message = "部门名称不能为空")
|
||||
private String departmentName;
|
||||
@ApiModelProperty(value = "岗位名称", name = "postName", required = true)
|
||||
@NotEmpty(message = "岗位名称不能为空")
|
||||
private String postName;
|
||||
@ApiModelProperty(value = "岗位职责", name = "postDuty", required = true)
|
||||
@NotEmpty(message = "岗位职责不能为空")
|
||||
private String postDuty;
|
||||
@ApiModelProperty(value = "状态 1-启用, 2-禁用", name = "status", required = true)
|
||||
@NotNull(message = "状态 1-启用, 2-禁用不能为空")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
|
||||
@NotNull(message = "企业id不能为空")
|
||||
private Long corpinfoId;
|
||||
@ApiModelProperty(value = "企业名称", name = "corpinfoName", required = true)
|
||||
@NotEmpty(message = "企业名称不能为空")
|
||||
private String corpinfoName;
|
||||
@ApiModelProperty(value = "是否监管岗位 1-是, 2-不是", name = "supervisionFlag", required = true)
|
||||
@NotNull(message = "是否监管岗位 1-是, 2-不是不能为空")
|
||||
private Integer supervisionFlag;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package com.zcloud.basic.info.dto.clientobject;
|
||||
|
||||
import com.alibaba.cola.dto.ClientObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* web-client
|
||||
*
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:24:04
|
||||
*/
|
||||
@Data
|
||||
public class PostCO extends ClientObject {
|
||||
//主键
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Long id;
|
||||
//业务主键id
|
||||
@ApiModelProperty(value = "业务主键id")
|
||||
private String postId;
|
||||
//部门id
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private Long departmentId;
|
||||
//部门名称
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
private String departmentName;
|
||||
//岗位名称
|
||||
@ApiModelProperty(value = "岗位名称")
|
||||
private String postName;
|
||||
//岗位职责
|
||||
@ApiModelProperty(value = "岗位职责")
|
||||
private String postDuty;
|
||||
//状态 1-启用, 2-禁用
|
||||
@ApiModelProperty(value = "状态 1-启用, 2-禁用")
|
||||
private Integer status;
|
||||
//企业id
|
||||
@ApiModelProperty(value = "企业id")
|
||||
private Long corpinfoId;
|
||||
//企业名称
|
||||
@ApiModelProperty(value = "企业名称")
|
||||
private String corpinfoName;
|
||||
//是否监管岗位 1-是, 2-不是
|
||||
@ApiModelProperty(value = "是否监管岗位 1-是, 2-不是")
|
||||
private Integer supervisionFlag;
|
||||
//乐观锁
|
||||
@ApiModelProperty(value = "乐观锁")
|
||||
private Integer version;
|
||||
//创建人
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private Long createId;
|
||||
//创建人姓名
|
||||
@ApiModelProperty(value = "创建人姓名")
|
||||
private String createName;
|
||||
//创建时间
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDateTime createTime;
|
||||
//更新人
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private Long updateId;
|
||||
//修改人名称
|
||||
@ApiModelProperty(value = "修改人名称")
|
||||
private String updateName;
|
||||
//更新时间
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDateTime updateTime;
|
||||
//描述
|
||||
@ApiModelProperty(value = "描述")
|
||||
private String remarks;
|
||||
//是否删除
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private String deleteEnum;
|
||||
//租户id
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Long tenantId;
|
||||
//机构id
|
||||
@ApiModelProperty(value = "机构id")
|
||||
private Long orgId;
|
||||
//环境
|
||||
@ApiModelProperty(value = "环境")
|
||||
private String env;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.zcloud.basic.info.domain.gateway;
|
||||
|
||||
import com.zcloud.basic.info.domain.model.PostE;
|
||||
|
||||
/**
|
||||
* web-domain
|
||||
*
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:24:04
|
||||
*/
|
||||
public interface PostGateway {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Boolean add(PostE postE);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
Boolean update(PostE postE);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
Boolean deletedPostById(Long id);
|
||||
|
||||
Boolean deletedPostByIds(Long[] id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.zcloud.basic.info.domain.model;
|
||||
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* web-domain
|
||||
*
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:24:04
|
||||
*/
|
||||
@Data
|
||||
public class PostE extends BaseE {
|
||||
//主键
|
||||
private Long id;
|
||||
//业务主键id
|
||||
private String postId;
|
||||
//部门id
|
||||
private Long departmentId;
|
||||
//部门名称
|
||||
private String departmentName;
|
||||
//岗位名称
|
||||
private String postName;
|
||||
//岗位职责
|
||||
private String postDuty;
|
||||
//状态 1-启用, 2-禁用
|
||||
private Integer status;
|
||||
//企业id
|
||||
private Long corpinfoId;
|
||||
//企业名称
|
||||
private String corpinfoName;
|
||||
//是否监管岗位 1-是, 2-不是
|
||||
private Integer supervisionFlag;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.zcloud.basic.info.gatewayimpl;
|
||||
|
||||
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 lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
*
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:24:04
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class PostGatewayImpl implements PostGateway {
|
||||
private final PostRepository postRepository;
|
||||
|
||||
@Override
|
||||
public Boolean add(PostE postE) {
|
||||
PostDO d = new PostDO();
|
||||
BeanUtils.copyProperties(postE, d);
|
||||
postRepository.save(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update(PostE postE) {
|
||||
PostDO d = new PostDO();
|
||||
BeanUtils.copyProperties(postE, d);
|
||||
postRepository.updateById(d);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deletedPostById(Long id) {
|
||||
return postRepository.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deletedPostByIds(Long[] ids) {
|
||||
return postRepository.removeByIds(Collections.singletonList(ids));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
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:24:04
|
||||
*/
|
||||
@Data
|
||||
@TableName("post")
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PostDO extends BaseDO {
|
||||
//业务主键id
|
||||
@ApiModelProperty(value = "业务主键id")
|
||||
private String postId;
|
||||
//部门id
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private Long departmentId;
|
||||
//部门名称
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
private String departmentName;
|
||||
//岗位名称
|
||||
@ApiModelProperty(value = "岗位名称")
|
||||
private String postName;
|
||||
//岗位职责
|
||||
@ApiModelProperty(value = "岗位职责")
|
||||
private String postDuty;
|
||||
//状态 1-启用, 2-禁用
|
||||
@ApiModelProperty(value = "状态 1-启用, 2-禁用")
|
||||
private Integer status;
|
||||
//企业id
|
||||
@ApiModelProperty(value = "企业id")
|
||||
private Long corpinfoId;
|
||||
//企业名称
|
||||
@ApiModelProperty(value = "企业名称")
|
||||
private String corpinfoName;
|
||||
//是否监管岗位 1-是, 2-不是
|
||||
@ApiModelProperty(value = "是否监管岗位 1-是, 2-不是")
|
||||
private Integer supervisionFlag;
|
||||
|
||||
public PostDO(String postId) {
|
||||
this.postId = postId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.zcloud.basic.info.persistence.mapper;
|
||||
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
*
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:24:04
|
||||
*/
|
||||
@Mapper
|
||||
public interface PostMapper extends BaseMapper<PostDO> {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.zcloud.basic.info.persistence.repository;
|
||||
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDO;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.jjb.saas.framework.repository.repo.BaseRepository;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
*
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:24:04
|
||||
*/
|
||||
public interface PostRepository extends BaseRepository<PostDO> {
|
||||
|
||||
PageResponse<PostDO> listPage(Map<String, Object> params);
|
||||
|
||||
SingleResponse<PostDO> getInfoById(Long id);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.zcloud.basic.info.persistence.repository.impl;
|
||||
|
||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.zcloud.basic.info.persistence.dataobject.PostDO;
|
||||
import com.zcloud.basic.info.persistence.mapper.PostMapper;
|
||||
import com.zcloud.basic.info.persistence.repository.PostRepository;
|
||||
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.Map;
|
||||
|
||||
/**
|
||||
* web-infrastructure
|
||||
*
|
||||
* @Author SondonYong
|
||||
* @Date 2025-10-31 17:24:04
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PostRepositoryImpl extends BaseRepositoryImpl<PostMapper, PostDO> implements PostRepository {
|
||||
private final PostMapper postMapper;
|
||||
|
||||
@Override
|
||||
public PageResponse<PostDO> listPage(Map<String, Object> params) {
|
||||
IPage<PostDO> iPage = new Query<PostDO>().getPage(params);
|
||||
QueryWrapper<PostDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
IPage<PostDO> result = postMapper.selectPage(iPage, queryWrapper);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<PostDO> getInfoById(Long id) {
|
||||
return SingleResponse.of(postMapper.selectById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.zcloud.basic.info.persistence.mapper.PostMapper">
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue