Showing
11 changed files
with
726 additions
and
0 deletions
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/bo/auditConfig/GetAuditConfigBo.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.bo.auditConfig; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 4 | +import com.lframework.xingyun.basedata.entity.AuditConfig; | |
| 5 | +import com.lframework.starter.common.constants.StringPool; | |
| 6 | +import com.lframework.starter.web.core.bo.BaseBo; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import io.swagger.annotations.ApiModelProperty; | |
| 9 | + | |
| 10 | +import lombok.Data; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * <p> | |
| 14 | + * 审核流配置 GetBo | |
| 15 | + * </p> | |
| 16 | + * | |
| 17 | + */ | |
| 18 | +@Data | |
| 19 | +public class GetAuditConfigBo extends BaseBo<AuditConfig> { | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * ID | |
| 23 | + */ | |
| 24 | + @ApiModelProperty("ID") | |
| 25 | + private String id; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 类型 | |
| 29 | + */ | |
| 30 | + @ApiModelProperty("类型") | |
| 31 | + private String type; | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 开启审核 | |
| 35 | + */ | |
| 36 | + @ApiModelProperty("开启审核") | |
| 37 | + private Boolean enableAudit; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 流程ID | |
| 41 | + */ | |
| 42 | + @ApiModelProperty("流程ID") | |
| 43 | + private String processId; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 流程code | |
| 47 | + */ | |
| 48 | + @ApiModelProperty("流程code") | |
| 49 | + private String processCode; | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 流程名称 | |
| 53 | + */ | |
| 54 | + @ApiModelProperty("流程名称") | |
| 55 | + private String processName; | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 创建人ID | |
| 59 | + */ | |
| 60 | + @ApiModelProperty("创建人ID") | |
| 61 | + private String createById; | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 创建人 | |
| 65 | + */ | |
| 66 | + @ApiModelProperty("创建人") | |
| 67 | + private String createBy; | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * 更新人ID | |
| 71 | + */ | |
| 72 | + @ApiModelProperty("更新人ID") | |
| 73 | + private String updateById; | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * 更新人 | |
| 77 | + */ | |
| 78 | + @ApiModelProperty("更新人") | |
| 79 | + private String updateBy; | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 创建时间 | |
| 83 | + */ | |
| 84 | + @ApiModelProperty("创建时间") | |
| 85 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | |
| 86 | + private LocalDateTime createTime; | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * 更新时间 | |
| 90 | + */ | |
| 91 | + @ApiModelProperty("更新时间") | |
| 92 | + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN) | |
| 93 | + private LocalDateTime updateTime; | |
| 94 | + | |
| 95 | + public GetAuditConfigBo() { | |
| 96 | + | |
| 97 | + } | |
| 98 | + | |
| 99 | + public GetAuditConfigBo(AuditConfig dto) { | |
| 100 | + super(dto); | |
| 101 | + } | |
| 102 | + | |
| 103 | + @Override | |
| 104 | + public BaseBo<AuditConfig> convert(AuditConfig dto) { | |
| 105 | + return super.convert(dto, GetAuditConfigBo::getType); | |
| 106 | + } | |
| 107 | +} | ... | ... | 
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/controller/AuditConfigController.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.controller; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.annotations.security.HasPermission; | |
| 4 | +import com.lframework.starter.web.core.controller.DefaultBaseController; | |
| 5 | +import com.lframework.xingyun.basedata.bo.auditConfig.GetAuditConfigBo; | |
| 6 | +import com.lframework.xingyun.basedata.vo.auditConfig.BatchAuditConfigVo; | |
| 7 | +import com.lframework.xingyun.basedata.vo.auditConfig.QueryAuditConfigVo; | |
| 8 | +import com.lframework.xingyun.basedata.service.auditConfig.AuditConfigService; | |
| 9 | +import com.lframework.xingyun.basedata.vo.auditConfig.CreateAuditConfigVo; | |
| 10 | +import com.lframework.xingyun.basedata.entity.AuditConfig; | |
| 11 | + | |
| 12 | +import javax.annotation.Resource; | |
| 13 | +import javax.validation.constraints.NotBlank; | |
| 14 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | |
| 15 | +import io.swagger.annotations.ApiOperation; | |
| 16 | +import com.lframework.starter.common.utils.CollectionUtil; | |
| 17 | +import io.swagger.annotations.Api; | |
| 18 | +import org.springframework.util.Assert; | |
| 19 | +import org.springframework.web.bind.annotation.DeleteMapping; | |
| 20 | +import com.lframework.starter.web.core.components.resp.InvokeResult; | |
| 21 | +import io.swagger.annotations.ApiImplicitParam; | |
| 22 | +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; | |
| 23 | +import org.springframework.validation.annotation.Validated; | |
| 24 | +import org.springframework.web.bind.annotation.*; | |
| 25 | + | |
| 26 | +import javax.validation.Valid; | |
| 27 | +import java.util.List; | |
| 28 | +import java.util.stream.Collectors; | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * 审核流配置 Controller | |
| 32 | + * | |
| 33 | + */ | |
| 34 | +@Api(tags = "审核流配置") | |
| 35 | +@Validated | |
| 36 | +@RestController | |
| 37 | +@RequestMapping("/baseData/auditConfig") | |
| 38 | +public class AuditConfigController extends DefaultBaseController { | |
| 39 | + | |
| 40 | + | |
| 41 | + @Resource | |
| 42 | + private AuditConfigService auditConfigService; | |
| 43 | + | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 查询列表 | |
| 47 | + */ | |
| 48 | + @ApiOperation("查询列表") | |
| 49 | + @HasPermission({"base-data:auditConfig:query"}) | |
| 50 | + @GetMapping("/query") | |
| 51 | + public InvokeResult<List<GetAuditConfigBo>> query(@Valid QueryAuditConfigVo vo) { | |
| 52 | + List<AuditConfig> dataList = auditConfigService.query(vo); | |
| 53 | + List<GetAuditConfigBo> results = null; | |
| 54 | + if (!CollectionUtil.isEmpty(dataList)) { | |
| 55 | + results = dataList.stream().map(GetAuditConfigBo::new).collect(Collectors.toList()); | |
| 56 | + } | |
| 57 | + return InvokeResultBuilder.success(results); | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * 根据ID查询 | |
| 62 | + */ | |
| 63 | + @ApiOperation("根据ID查询") | |
| 64 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | |
| 65 | + @HasPermission({"base-data:auditConfig:query"}) | |
| 66 | + @GetMapping | |
| 67 | + public InvokeResult<GetAuditConfigBo> get(@NotBlank(message = "id不能为空!") String id) { | |
| 68 | + AuditConfig data = auditConfigService.findById(id); | |
| 69 | + if (data == null) { | |
| 70 | + throw new DefaultClientException("审核流配置不存在!"); | |
| 71 | + } | |
| 72 | + GetAuditConfigBo result = new GetAuditConfigBo(data); | |
| 73 | + | |
| 74 | + return InvokeResultBuilder.success(result); | |
| 75 | + } | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 新增 | |
| 79 | + */ | |
| 80 | + @ApiOperation("新增") | |
| 81 | + @HasPermission({"base-data:auditConfig:add"}) | |
| 82 | + @PostMapping | |
| 83 | + public InvokeResult<Void> create(@Valid @RequestBody BatchAuditConfigVo vo) { | |
| 84 | + Assert.notNull(vo, "voList is empty!"); | |
| 85 | + List<CreateAuditConfigVo> voList = vo.getCreateVoList(); | |
| 86 | + Assert.notEmpty(voList, "voList is empty!"); | |
| 87 | + | |
| 88 | + auditConfigService.batchInsert(voList); | |
| 89 | + return InvokeResultBuilder.success(); | |
| 90 | + } | |
| 91 | + | |
| 92 | + /** | |
| 93 | + * 修改 | |
| 94 | + */ | |
| 95 | + @ApiOperation("修改") | |
| 96 | + @HasPermission({"base-data:auditConfig:modify"}) | |
| 97 | + @PutMapping | |
| 98 | + public InvokeResult<Void> update(@Valid @RequestBody BatchAuditConfigVo vo) { | |
| 99 | + auditConfigService.update(vo.getUpdateVoList()); | |
| 100 | + return InvokeResultBuilder.success(); | |
| 101 | + } | |
| 102 | + | |
| 103 | + /** | |
| 104 | + * 根据ID删除 | |
| 105 | + */ | |
| 106 | + @ApiOperation("根据ID删除") | |
| 107 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | |
| 108 | + @HasPermission({"base-data:auditConfig:delete"}) | |
| 109 | + @DeleteMapping | |
| 110 | + public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) { | |
| 111 | + auditConfigService.deleteById(id); | |
| 112 | + return InvokeResultBuilder.success(); | |
| 113 | + } | |
| 114 | +} | ... | ... | 
| 1 | +package com.lframework.xingyun.basedata.entity; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 4 | +import com.lframework.starter.web.core.dto.BaseDto; | |
| 5 | +import java.time.LocalDateTime; | |
| 6 | +import com.baomidou.mybatisplus.annotation.FieldFill; | |
| 7 | +import com.lframework.starter.web.core.entity.BaseEntity; | |
| 8 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * <p> | |
| 13 | + * 审核流配置 | |
| 14 | + * </p> | |
| 15 | + * | |
| 16 | + */ | |
| 17 | +@Data | |
| 18 | +@TableName("base_data_audit_config") | |
| 19 | +public class AuditConfig extends BaseEntity implements BaseDto { | |
| 20 | + | |
| 21 | + private static final long serialVersionUID = 1L; | |
| 22 | + | |
| 23 | + public static final String CACHE_NAME = "AuditConfig"; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * ID | |
| 27 | + */ | |
| 28 | + private String id; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 类型 | |
| 32 | + */ | |
| 33 | + private String type; | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 开启审核 | |
| 37 | + */ | |
| 38 | + private Boolean enableAudit; | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 流程ID | |
| 42 | + */ | |
| 43 | + private String processId; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 流程code | |
| 47 | + */ | |
| 48 | + private String processCode; | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 流程名称 | |
| 52 | + */ | |
| 53 | + private String processName; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 创建人ID | |
| 57 | + */ | |
| 58 | + @TableField(fill = FieldFill.INSERT) | |
| 59 | + private String createById; | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 创建人 | |
| 63 | + */ | |
| 64 | + @TableField(fill = FieldFill.INSERT) | |
| 65 | + private String createBy; | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 更新人ID | |
| 69 | + */ | |
| 70 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 71 | + private String updateById; | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * 更新人 | |
| 75 | + */ | |
| 76 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 77 | + private String updateBy; | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 创建时间 | |
| 81 | + */ | |
| 82 | + @TableField(fill = FieldFill.INSERT) | |
| 83 | + private LocalDateTime createTime; | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 更新时间 | |
| 87 | + */ | |
| 88 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 89 | + private LocalDateTime updateTime; | |
| 90 | + | |
| 91 | +} | ... | ... | 
| 1 | +package com.lframework.xingyun.basedata.impl.auditConfig; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
| 5 | +import com.github.pagehelper.PageInfo; | |
| 6 | +import com.lframework.xingyun.basedata.entity.AuditConfig; | |
| 7 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | |
| 8 | +import com.lframework.starter.web.core.utils.PageResultUtil; | |
| 9 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 10 | +import com.lframework.starter.web.core.utils.OpLogUtil; | |
| 11 | +import com.lframework.starter.common.utils.StringUtil; | |
| 12 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | |
| 13 | +import com.lframework.starter.web.core.utils.IdUtil; | |
| 14 | +import com.lframework.starter.common.utils.ObjectUtil; | |
| 15 | +import com.lframework.starter.web.core.annotations.oplog.OpLog; | |
| 16 | +import com.lframework.starter.web.core.utils.PageHelperUtil; | |
| 17 | +import com.lframework.starter.common.utils.Assert; | |
| 18 | +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | |
| 19 | +import org.apache.commons.collections4.CollectionUtils; | |
| 20 | +import org.apache.commons.lang3.BooleanUtils; | |
| 21 | +import org.apache.commons.lang3.StringUtils; | |
| 22 | +import org.springframework.transaction.annotation.Transactional; | |
| 23 | +import com.lframework.xingyun.basedata.mappers.AuditConfigMapper; | |
| 24 | +import com.lframework.xingyun.basedata.service.auditConfig.AuditConfigService; | |
| 25 | +import com.lframework.xingyun.basedata.vo.auditConfig.CreateAuditConfigVo; | |
| 26 | +import com.lframework.xingyun.basedata.vo.auditConfig.QueryAuditConfigVo; | |
| 27 | +import com.lframework.xingyun.basedata.vo.auditConfig.UpdateAuditConfigVo; | |
| 28 | +import org.springframework.stereotype.Service; | |
| 29 | + | |
| 30 | +import java.util.ArrayList; | |
| 31 | +import java.util.List; | |
| 32 | + | |
| 33 | +@Service | |
| 34 | +public class AuditConfigServiceImpl extends BaseMpServiceImpl<AuditConfigMapper, AuditConfig> implements AuditConfigService { | |
| 35 | + | |
| 36 | + @Override | |
| 37 | + public PageResult<AuditConfig> query(Integer pageIndex, Integer pageSize, QueryAuditConfigVo vo) { | |
| 38 | + Assert.greaterThanZero(pageIndex); | |
| 39 | + Assert.greaterThanZero(pageSize); | |
| 40 | + | |
| 41 | + PageHelperUtil.startPage(pageIndex, pageSize); | |
| 42 | + List<AuditConfig> dataList = this.query(vo); | |
| 43 | + | |
| 44 | + return PageResultUtil.convert(new PageInfo<>(dataList)); | |
| 45 | + } | |
| 46 | + | |
| 47 | + @Override | |
| 48 | + public List<AuditConfig> query(QueryAuditConfigVo vo) { | |
| 49 | + return getBaseMapper().query(vo); | |
| 50 | + } | |
| 51 | + | |
| 52 | + @Override | |
| 53 | + public AuditConfig findById(String id) { | |
| 54 | + return getBaseMapper().selectById(id); | |
| 55 | + } | |
| 56 | + | |
| 57 | + @OpLog(type = OtherOpLogType.class, name = "新增审核流配置,ID:{}", params = {"#id"}) | |
| 58 | + @Transactional(rollbackFor = Exception.class) | |
| 59 | + @Override | |
| 60 | + public void batchInsert(List<CreateAuditConfigVo> voList) { | |
| 61 | + List<AuditConfig> dataList = new ArrayList<>(); | |
| 62 | + if (CollectionUtils.isEmpty(voList)) { | |
| 63 | + return; | |
| 64 | + } | |
| 65 | + for (CreateAuditConfigVo vo : voList) { | |
| 66 | + AuditConfig data = new AuditConfig(); | |
| 67 | + data.setId(IdUtil.getId()); | |
| 68 | + data.setType(vo.getType()); | |
| 69 | + data.setEnableAudit(vo.getEnableAudit()); | |
| 70 | + if (BooleanUtils.isTrue(vo.getEnableAudit()) && StringUtils.isBlank(vo.getProcessId())) { | |
| 71 | + throw new DefaultClientException("流程ID不能为空!"); | |
| 72 | + } | |
| 73 | + if (!StringUtil.isBlank(vo.getProcessId())) { | |
| 74 | + data.setProcessId(vo.getProcessId()); | |
| 75 | + } | |
| 76 | + dataList.add(data); | |
| 77 | + } | |
| 78 | + getBaseMapper().batchAdd(dataList); | |
| 79 | + } | |
| 80 | + | |
| 81 | + @OpLog(type = OtherOpLogType.class, name = "修改审核流配置,ID:{}", params = {"#id"}) | |
| 82 | + @Transactional(rollbackFor = Exception.class) | |
| 83 | + @Override | |
| 84 | + public void update(UpdateAuditConfigVo vo) { | |
| 85 | + AuditConfig data = getBaseMapper().selectOne( | |
| 86 | + Wrappers.<AuditConfig>query() | |
| 87 | + .eq("id", vo.getId()) | |
| 88 | + .select("id", "type", "enable_audit", "process_id") | |
| 89 | + ); | |
| 90 | + if (ObjectUtil.isNull(data)) { | |
| 91 | + throw new DefaultClientException("审核流配置不存在!"); | |
| 92 | + } | |
| 93 | + if (BooleanUtils.isTrue(vo.getEnableAudit()) && StringUtils.isBlank(vo.getProcessId())) { | |
| 94 | + throw new DefaultClientException("流程ID不能为空!"); | |
| 95 | + } | |
| 96 | + LambdaUpdateWrapper<AuditConfig> updateWrapper = Wrappers.lambdaUpdate(AuditConfig.class) | |
| 97 | + .set(AuditConfig::getEnableAudit, vo.getEnableAudit()) | |
| 98 | + .set(AuditConfig::getProcessId, BooleanUtils.isTrue(vo.getEnableAudit()) ? vo.getProcessId() : null) | |
| 99 | + .eq(AuditConfig::getId, vo.getId()); | |
| 100 | + | |
| 101 | + getBaseMapper().update(updateWrapper); | |
| 102 | + | |
| 103 | + OpLogUtil.setVariable("id", data.getId()); | |
| 104 | + OpLogUtil.setExtra(vo); | |
| 105 | + } | |
| 106 | + | |
| 107 | + @OpLog(type = OtherOpLogType.class, name = "修改审核流配置,ID:{}", params = {"#id"}) | |
| 108 | + @Transactional(rollbackFor = Exception.class) | |
| 109 | + @Override | |
| 110 | + public void update(List<UpdateAuditConfigVo> voList) { | |
| 111 | + if (CollectionUtils.isEmpty(voList)) { | |
| 112 | + return; | |
| 113 | + } | |
| 114 | + // todo 此处后续可能需要优化(批量更新) | |
| 115 | + for (UpdateAuditConfigVo vo : voList) { | |
| 116 | + update(vo); | |
| 117 | + } | |
| 118 | + } | |
| 119 | + | |
| 120 | + @OpLog(type = OtherOpLogType.class, name = "删除审核流配置,ID:{}", params = {"#id"}) | |
| 121 | + @Transactional(rollbackFor = Exception.class) | |
| 122 | + @Override | |
| 123 | + public void deleteById(String id) { | |
| 124 | + getBaseMapper().deleteById(id); | |
| 125 | + } | |
| 126 | +} | ... | ... | 
xingyun-basedata/src/main/java/com/lframework/xingyun/basedata/mappers/AuditConfigMapper.java
0 → 100644
| 1 | +package com.lframework.xingyun.basedata.mappers; | |
| 2 | + | |
| 3 | +import com.lframework.xingyun.basedata.entity.AuditConfig; | |
| 4 | +import com.lframework.starter.web.core.mapper.BaseMapper; | |
| 5 | +import com.lframework.xingyun.basedata.vo.auditConfig.QueryAuditConfigVo; | |
| 6 | +import org.apache.ibatis.annotations.Param; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * <p> | |
| 12 | + * 审核流配置 Mapper 接口 | |
| 13 | + * </p> | |
| 14 | + * | |
| 15 | + */ | |
| 16 | +public interface AuditConfigMapper extends BaseMapper<AuditConfig> { | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 查询列表 | |
| 20 | + * | |
| 21 | + * @param vo 查询条件 | |
| 22 | + * @return List<AuditConfig> | |
| 23 | + */ | |
| 24 | + List<AuditConfig> query(@Param("vo") QueryAuditConfigVo vo); | |
| 25 | + | |
| 26 | + | |
| 27 | + int batchAdd(@Param("list") List<AuditConfig> configList); | |
| 28 | +} | ... | ... | 
| 1 | +package com.lframework.xingyun.basedata.service.auditConfig; | |
| 2 | + | |
| 3 | +import com.lframework.xingyun.basedata.vo.auditConfig.CreateAuditConfigVo; | |
| 4 | +import com.lframework.xingyun.basedata.vo.auditConfig.QueryAuditConfigVo; | |
| 5 | +import com.lframework.xingyun.basedata.vo.auditConfig.UpdateAuditConfigVo; | |
| 6 | +import com.lframework.xingyun.basedata.entity.AuditConfig; | |
| 7 | +import com.lframework.starter.web.core.service.BaseMpService; | |
| 8 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 审核流配置 Service | |
| 13 | + */ | |
| 14 | +public interface AuditConfigService extends BaseMpService<AuditConfig> { | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 查询列表 | |
| 18 | + * | |
| 19 | + * @return PageResult<AuditConfig> | |
| 20 | + */ | |
| 21 | + PageResult<AuditConfig> query(Integer pageIndex, Integer pageSize, QueryAuditConfigVo vo); | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 查询列表 | |
| 25 | + * | |
| 26 | + * @param vo 查询条件 | |
| 27 | + * @return List<AuditConfig> | |
| 28 | + */ | |
| 29 | + List<AuditConfig> query(QueryAuditConfigVo vo); | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 根据ID查询 | |
| 33 | + * | |
| 34 | + * @param id 主键ID | |
| 35 | + * @return AuditConfig | |
| 36 | + */ | |
| 37 | + AuditConfig findById(String id); | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 创建 | |
| 41 | + * | |
| 42 | + * @param voList 数据集 | |
| 43 | + */ | |
| 44 | + void batchInsert(List<CreateAuditConfigVo> voList); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 修改 | |
| 48 | + * | |
| 49 | + * @param vo 数据实体 | |
| 50 | + */ | |
| 51 | + void update(UpdateAuditConfigVo vo); | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 批量修改 | |
| 55 | + * | |
| 56 | + * @param voList 数据集 | |
| 57 | + */ | |
| 58 | + void update(List<UpdateAuditConfigVo> voList); | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * 根据ID删除 | |
| 62 | + * | |
| 63 | + * @param id 主键ID | |
| 64 | + */ | |
| 65 | + void deleteById(String id); | |
| 66 | +} | ... | ... | 
| 1 | +package com.lframework.xingyun.basedata.vo.auditConfig; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import javax.validation.Valid; | |
| 7 | +import java.io.Serializable; | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +@Data | |
| 11 | +public class BatchAuditConfigVo implements BaseVo, Serializable { | |
| 12 | + | |
| 13 | + private static final long serialVersionUID = 1L; | |
| 14 | + | |
| 15 | + @Valid | |
| 16 | + private List<CreateAuditConfigVo> createVoList; | |
| 17 | + | |
| 18 | + @Valid | |
| 19 | + private List<UpdateAuditConfigVo> updateVoList; | |
| 20 | +} | ... | ... | 
| 1 | +package com.lframework.xingyun.basedata.vo.auditConfig; | |
| 2 | + | |
| 3 | +import javax.validation.constraints.NotBlank; | |
| 4 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 5 | +import javax.validation.constraints.NotNull; | |
| 6 | +import io.swagger.annotations.ApiModelProperty; | |
| 7 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | |
| 8 | +import org.hibernate.validator.constraints.Length; | |
| 9 | +import java.io.Serializable; | |
| 10 | +import lombok.Data; | |
| 11 | + | |
| 12 | +@Data | |
| 13 | +public class CreateAuditConfigVo implements BaseVo, Serializable { | |
| 14 | + | |
| 15 | + private static final long serialVersionUID = 1L; | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 类型 | |
| 19 | + */ | |
| 20 | + @ApiModelProperty(value = "类型", required = true) | |
| 21 | + @NotBlank(message = "请选择类型!") | |
| 22 | + private String type; | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 开启审核 | |
| 26 | + */ | |
| 27 | + @ApiModelProperty(value = "开启审核", required = true) | |
| 28 | + @NotNull(message = "请输入开启审核!") | |
| 29 | + @TypeMismatch(message = "开启审核格式有误!") | |
| 30 | + private Boolean enableAudit; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 流程ID | |
| 34 | + */ | |
| 35 | + @ApiModelProperty("流程ID") | |
| 36 | + @Length(message = "流程ID最多允许32个字符!") | |
| 37 | + private String processId; | |
| 38 | +} | ... | ... | 
| 1 | +package com.lframework.xingyun.basedata.vo.auditConfig; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | +import com.lframework.starter.web.core.vo.PageVo; | |
| 5 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 6 | +import io.swagger.annotations.ApiModelProperty; | |
| 7 | + | |
| 8 | +import java.io.Serializable; | |
| 9 | + | |
| 10 | +@Data | |
| 11 | +public class QueryAuditConfigVo extends PageVo implements BaseVo, Serializable { | |
| 12 | + | |
| 13 | + private static final long serialVersionUID = 1L; | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * 类型 | |
| 17 | + */ | |
| 18 | + @ApiModelProperty("类型") | |
| 19 | + private String type; | |
| 20 | + | |
| 21 | +} | ... | ... | 
| 1 | +package com.lframework.xingyun.basedata.vo.auditConfig; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | +import javax.validation.constraints.NotBlank; | |
| 5 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 6 | +import javax.validation.constraints.NotNull; | |
| 7 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | |
| 8 | +import io.swagger.annotations.ApiModelProperty; | |
| 9 | +import org.hibernate.validator.constraints.Length; | |
| 10 | +import java.io.Serializable; | |
| 11 | + | |
| 12 | +@Data | |
| 13 | +public class UpdateAuditConfigVo implements BaseVo, Serializable { | |
| 14 | + | |
| 15 | + private static final long serialVersionUID = 1L; | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * ID | |
| 19 | + */ | |
| 20 | + @ApiModelProperty(value = "ID", required = true) | |
| 21 | + @NotBlank(message = "id不能为空!") | |
| 22 | + private String id; | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 开启审核 | |
| 26 | + */ | |
| 27 | + @ApiModelProperty(value = "开启审核", required = true) | |
| 28 | + @TypeMismatch(message = "开启审核格式有误!") | |
| 29 | + @NotNull(message = "请输入开启审核!") | |
| 30 | + private Boolean enableAudit; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 流程ID | |
| 34 | + */ | |
| 35 | + @ApiModelProperty("流程ID") | |
| 36 | + @Length(message = "流程ID最多允许32个字符!") | |
| 37 | + private String processId; | |
| 38 | +} | ... | ... | 
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.lframework.xingyun.basedata.mappers.AuditConfigMapper"> | |
| 4 | + | |
| 5 | + <resultMap id="AuditConfig" type="com.lframework.xingyun.basedata.entity.AuditConfig"> | |
| 6 | + <id column="id" property="id"/> | |
| 7 | + <result column="type" property="type"/> | |
| 8 | + <result column="enable_audit" property="enableAudit"/> | |
| 9 | + <result column="process_id" property="processId"/> | |
| 10 | + <result column="flow_code" property="processCode"/> | |
| 11 | + <result column="flow_name" property="processName"/> | |
| 12 | + <result column="create_by_id" property="createById"/> | |
| 13 | + <result column="create_by" property="createBy"/> | |
| 14 | + <result column="update_by_id" property="updateById"/> | |
| 15 | + <result column="update_by" property="updateBy"/> | |
| 16 | + <result column="create_time" property="createTime"/> | |
| 17 | + <result column="update_time" property="updateTime"/> | |
| 18 | + </resultMap> | |
| 19 | + | |
| 20 | + <sql id="AuditConfig_sql"> | |
| 21 | + SELECT | |
| 22 | + tb.id, | |
| 23 | + tb.type, | |
| 24 | + tb.enable_audit, | |
| 25 | + tb.process_id, | |
| 26 | + tb.create_by_id, | |
| 27 | + tb.create_by, | |
| 28 | + tb.update_by_id, | |
| 29 | + tb.update_by, | |
| 30 | + tb.create_time, | |
| 31 | + tb.update_time, | |
| 32 | + f.flow_code, | |
| 33 | + f.flow_name | |
| 34 | + FROM base_data_audit_config AS tb | |
| 35 | + LEFT JOIN flow_definition f ON tb.process_id = f.id | |
| 36 | + </sql> | |
| 37 | + | |
| 38 | + <select id="query" resultMap="AuditConfig"> | |
| 39 | + <include refid="AuditConfig_sql"/> | |
| 40 | + <where> | |
| 41 | + <if test="vo.type != null"> | |
| 42 | + AND tb.type = #{vo.type} | |
| 43 | + </if> | |
| 44 | + </where> | |
| 45 | + </select> | |
| 46 | + | |
| 47 | + <insert id="batchAdd"> | |
| 48 | + INSERT INTO base_data_audit_config ( | |
| 49 | + id, | |
| 50 | + type, | |
| 51 | + enable_audit, | |
| 52 | + process_id, | |
| 53 | + create_by_id, | |
| 54 | + create_by, | |
| 55 | + update_by_id, | |
| 56 | + update_by, | |
| 57 | + create_time, | |
| 58 | + update_time | |
| 59 | + ) VALUES | |
| 60 | + <foreach collection="list" item="item" separator=","> | |
| 61 | + ( | |
| 62 | + #{item.id}, | |
| 63 | + #{item.type}, | |
| 64 | + #{item.enableAudit}, | |
| 65 | + #{item.processId}, | |
| 66 | + #{item.createById}, | |
| 67 | + #{item.createBy}, | |
| 68 | + #{item.updateById}, | |
| 69 | + #{item.updateBy}, | |
| 70 | + #{item.createTime}, | |
| 71 | + #{item.updateTime} | |
| 72 | + ) | |
| 73 | + </foreach> | |
| 74 | + </insert> | |
| 75 | + | |
| 76 | + | |
| 77 | +</mapper> | ... | ... |