数据字典相关
This commit is contained in:
parent
7c3d2eb7f6
commit
da563a9d78
@ -32,6 +32,8 @@ public class SystemDictDataDO extends BpmBaseDO{
|
|||||||
|
|
||||||
/** css 样式 */
|
/** css 样式 */
|
||||||
private String cssClass;
|
private String cssClass;
|
||||||
|
/**备注*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
/** 状态(0正常 1停用) */
|
/** 状态(0正常 1停用) */
|
||||||
private String status;
|
private String status;
|
||||||
|
|||||||
@ -1,8 +1,43 @@
|
|||||||
package cn.axzo.workflow.core.service;
|
package cn.axzo.workflow.core.service;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.axzo.workflow.core.service.dto.request.model.BpmCategoryBpmPageDTO;
|
||||||
|
import cn.axzo.workflow.core.service.dto.request.model.BpmCategoryCreateDTO;
|
||||||
|
import cn.axzo.workflow.core.service.dto.request.model.BpmCategoryUpdateDTO;
|
||||||
|
import cn.axzo.workflow.core.service.dto.response.model.BpmCategoryItemVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category的增删改查
|
* Category的增删改查
|
||||||
*/
|
*/
|
||||||
public interface BpmCategoryService {
|
public interface BpmCategoryService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建
|
||||||
|
* @param createDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int createBpmCategory(BpmCategoryCreateDTO createDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
* @param createDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int updateBpmCategory(BpmCategoryUpdateDTO createDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int deleteBpmCategory(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
* @param findDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<BpmCategoryItemVo> findBpmCategory(BpmCategoryBpmPageDTO findDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
package cn.axzo.workflow.core.service.converter;
|
||||||
|
|
||||||
|
import cn.axzo.workflow.core.repository.entity.SystemDictDataDO;
|
||||||
|
import cn.axzo.workflow.core.service.dto.response.model.BpmCategoryItemVo;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static org.mapstruct.NullValueCheckStrategy.ALWAYS;
|
||||||
|
|
||||||
|
@Mapper(
|
||||||
|
componentModel = "spring",
|
||||||
|
nullValueCheckStrategy = ALWAYS,
|
||||||
|
imports = Arrays.class
|
||||||
|
)
|
||||||
|
public interface BpmCategoryConverter extends EntityConverter<BpmCategoryItemVo, SystemDictDataDO>{
|
||||||
|
|
||||||
|
@Mapping(target = "id", source = "category.id")
|
||||||
|
@Mapping(target = "dictType", source = "category.dictType")
|
||||||
|
@Mapping(target = "label", source = "category.label")
|
||||||
|
@Mapping(target = "value", source = "category.value")
|
||||||
|
BpmCategoryItemVo toVo(SystemDictDataDO category);
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
package cn.axzo.workflow.core.service.converter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface EntityConverter<V, E>{
|
||||||
|
|
||||||
|
V toVo(E var);
|
||||||
|
|
||||||
|
List<V> toVo(List<E> var);
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package cn.axzo.workflow.core.service.dto.request.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BpmCategoryBpmPageDTO {
|
||||||
|
@ApiModelProperty(value = "字典类型", example = "process_yudao", notes = "精准匹配")
|
||||||
|
private String dictType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "字典标签", example = "process_yudao", hidden = true)
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "字典值", example = "process_yudao", hidden = true)
|
||||||
|
private String value;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package cn.axzo.workflow.core.service.dto.request.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BpmCategoryCreateDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "字典标签", example = "process_yudao", hidden = true)
|
||||||
|
@Length(max = 50, message = "字典标签最长只支持255个字符")
|
||||||
|
@NotBlank(message = "字典标签表示不能为空")
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "流程模型标识", example = "process_yudao", hidden = true)
|
||||||
|
@Length(max = 50, message = "字典值最长只支持50个字符")
|
||||||
|
@NotBlank(message = "字典值表示不能为空")
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注", example = "process_yudao", hidden = true)
|
||||||
|
@Length(max = 250, message = "备注最长只支持250个字符")
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package cn.axzo.workflow.core.service.dto.request.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BpmCategoryUpdateDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ID", example = "process_yudao", hidden = true)
|
||||||
|
@NotBlank(message = "字典标签表示不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "字典标签", example = "process_yudao", hidden = true)
|
||||||
|
@Length(max = 50, message = "字典标签最长只支持255个字符")
|
||||||
|
@NotBlank(message = "字典标签表示不能为空")
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "流程模型标识", example = "process_yudao", hidden = true)
|
||||||
|
@Length(max = 50, message = "字典值最长只支持50个字符")
|
||||||
|
@NotBlank(message = "字典值表示不能为空")
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注", example = "process_yudao", hidden = true)
|
||||||
|
@Length(max = 250, message = "备注最长只支持250个字符")
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package cn.axzo.workflow.core.service.dto.response.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BpmCategoryItemVo {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ID", required = true)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "字典type", required = true)
|
||||||
|
private String dictType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标签名", required = true)
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "值", required = true)
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注", required = true)
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@ -1,8 +1,69 @@
|
|||||||
package cn.axzo.workflow.core.service.impl;
|
package cn.axzo.workflow.core.service.impl;
|
||||||
|
|
||||||
|
import cn.axzo.workflow.core.repository.entity.SystemDictDataDO;
|
||||||
|
import cn.axzo.workflow.core.repository.mapper.SystemDictDataMapper;
|
||||||
import cn.axzo.workflow.core.service.BpmCategoryService;
|
import cn.axzo.workflow.core.service.BpmCategoryService;
|
||||||
|
import cn.axzo.workflow.core.service.converter.BpmCategoryConverter;
|
||||||
|
import cn.axzo.workflow.core.service.dto.request.model.BpmCategoryBpmPageDTO;
|
||||||
|
import cn.axzo.workflow.core.service.dto.request.model.BpmCategoryCreateDTO;
|
||||||
|
import cn.axzo.workflow.core.service.dto.request.model.BpmCategoryUpdateDTO;
|
||||||
|
import cn.axzo.workflow.core.service.dto.response.model.BpmCategoryItemVo;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class BpmCategoryServiceImpl implements BpmCategoryService {
|
public class BpmCategoryServiceImpl implements BpmCategoryService {
|
||||||
|
@Resource
|
||||||
|
private SystemDictDataMapper systemDictDataMapper;
|
||||||
|
|
||||||
|
private final BpmCategoryConverter bpmCategoryConverter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int createBpmCategory(BpmCategoryCreateDTO createDTO) {
|
||||||
|
SystemDictDataDO systemDictDataDO=new SystemDictDataDO();
|
||||||
|
systemDictDataDO.setDictType("bpm_model_category");
|
||||||
|
systemDictDataDO.setLabel(createDTO.getLabel());
|
||||||
|
systemDictDataDO.setValue(createDTO.getValue());
|
||||||
|
systemDictDataDO.setRemark(createDTO.getRemark());
|
||||||
|
return systemDictDataMapper.insert(systemDictDataDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateBpmCategory(BpmCategoryUpdateDTO createDTO) {
|
||||||
|
SystemDictDataDO systemDictDataDO=new SystemDictDataDO();
|
||||||
|
systemDictDataDO.setId(createDTO.getId());
|
||||||
|
systemDictDataDO.setDictType("bpm_model_category");
|
||||||
|
systemDictDataDO.setLabel(createDTO.getLabel());
|
||||||
|
systemDictDataDO.setValue(createDTO.getValue());
|
||||||
|
systemDictDataDO.setRemark(createDTO.getRemark());
|
||||||
|
return systemDictDataMapper.updateById(systemDictDataDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteBpmCategory(Long id) {
|
||||||
|
return systemDictDataMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BpmCategoryItemVo> findBpmCategory(BpmCategoryBpmPageDTO findDTO) {
|
||||||
|
|
||||||
|
LambdaQueryWrapper<SystemDictDataDO> queryWrapper = Wrappers.lambdaQuery(SystemDictDataDO.class)
|
||||||
|
.eq(StringUtils.isNotBlank(findDTO.getDictType()), SystemDictDataDO::getDictType, findDTO.getDictType())
|
||||||
|
.eq(StringUtils.isNotBlank(findDTO.getLabel()), SystemDictDataDO::getLabel, findDTO.getLabel());
|
||||||
|
|
||||||
|
List<SystemDictDataDO> systemDictDataDO = systemDictDataMapper.selectList(queryWrapper);
|
||||||
|
|
||||||
|
List<BpmCategoryItemVo> categoryVOS = systemDictDataDO.stream().map(bpmCategoryConverter::toVo).collect(Collectors.toList());
|
||||||
|
return categoryVOS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user