同步业务库代码
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>yudao</artifactId>
|
||||
<artifactId>dsc-base</artifactId>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.tmpltp.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 示例模块 1-001-000-000 ==========
|
||||
ErrorCode TMPL_TP_NOT_EXISTS = new ErrorCode(1_027_000_500, "模板分类不存在");
|
||||
ErrorCode TMPL_FLD_NOT_EXISTS = new ErrorCode(1_027_000_501, "模板字段不存在");
|
||||
ErrorCode TMPL_FLD_CODE_EXISTS = new ErrorCode(1_027_000_502, "字段编码已存在");
|
||||
ErrorCode TMPL_ITM_NOT_EXISTS = new ErrorCode(1_027_000_503, "模板条款不存在");
|
||||
ErrorCode TEMPLATE_INSTANCE_NOT_EXISTS = new ErrorCode(1_027_000_504, "模板实例不存在");
|
||||
ErrorCode TMPL_TP_SATUS_ERROR = new ErrorCode(1_027_000_506, "状态变更失败");
|
||||
ErrorCode TMPL_TP_DEl_ERROR = new ErrorCode(1_027_000_507, "模版分类删除失败");
|
||||
ErrorCode TEMPLATE_INSTANCE_DATA_NOT_EXISTS = new ErrorCode(1_027_000_508, "实例字段值不存在");
|
||||
ErrorCode TEMPLATE_INSTANCE_ITEM_NOT_EXISTS = new ErrorCode(1_027_000_509, "实例条款值不存在");
|
||||
ErrorCode PARAMS_IS_NULL_OR_ERR = new ErrorCode(1_027_000_510, "参数为空");
|
||||
ErrorCode DEPARTMENT_INSTANCE_RELATIVITY_NOT_EXISTS = new ErrorCode(1_027_000_511, "部门与实例关联不存在");
|
||||
ErrorCode ILLEGAL_OPERATION_TYPE = new ErrorCode(1_027_000_511, "非法操作类型");
|
||||
ErrorCode OPERATION_FAIL= new ErrorCode(1_027_000_512, "操作失败");
|
||||
|
||||
//Illegal operation type
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package cn.iocoder.yudao.module.tmpltp.enums;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 状态枚举类,定义所有可能的状态及合法的状态转换
|
||||
*/
|
||||
public enum StatusEnum {
|
||||
// 定义所有状态及对应的合法转换目标状态
|
||||
STATUS_1("1", new HashSet<String>() {{
|
||||
add("2");
|
||||
add("4");
|
||||
}}),
|
||||
STATUS_2("2", new HashSet<String>() {{
|
||||
add("3");
|
||||
}}),
|
||||
STATUS_3("3", new HashSet<String>() {{
|
||||
add("4");
|
||||
add("2");
|
||||
}}),
|
||||
STATUS_4("4", new HashSet<>()); // 没有合法的转换目标
|
||||
|
||||
private final String code;
|
||||
private final Set<String> allowedTransitions;
|
||||
|
||||
StatusEnum(String code, Set<String> allowedTransitions) {
|
||||
this.code = code;
|
||||
this.allowedTransitions = allowedTransitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态码获取对应的枚举实例
|
||||
*/
|
||||
public static StatusEnum fromCode(String code) {
|
||||
for (StatusEnum status : values()) {
|
||||
if (status.code.equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验状态转换是否合法
|
||||
*/
|
||||
public boolean isTransitionAllowed(String targetStatus) {
|
||||
return allowedTransitions.contains(targetStatus);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.base;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* Base 模块的启动类
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.base;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,91 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.business.annotation.FileUploadController;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmpItmPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplItmRespVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplItmSaveReqVO;
|
||||
import cn.iocoder.yudao.module.base.dal.dataobject.tmpltp.TmplItmDO;
|
||||
import cn.iocoder.yudao.module.base.service.tmpltp.TmplItmService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Tag(name = "管理后台 - 模板条款")
|
||||
@RestController
|
||||
@RequestMapping("/base/tmpl-ltm")
|
||||
@Validated
|
||||
@FileUploadController(source = "bse.tmplltm")
|
||||
@RequiredArgsConstructor
|
||||
public class TmplItmController {
|
||||
private final TmplItmService tmplItmService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建模板条款")
|
||||
public CommonResult<TmplItmRespVO> createTmplItm(@Valid @RequestBody TmplItmSaveReqVO createReqVO) {
|
||||
TmplItmRespVO tmplItm = tmplItmService.createTmplItm(createReqVO);
|
||||
return success(tmplItm);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新模板条款")
|
||||
public CommonResult<Boolean> updateTmplItm(@Valid @RequestBody TmplItmSaveReqVO updateReqVO) {
|
||||
tmplItmService.updateTmplItm(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除模板条款", description = "")
|
||||
public CommonResult<Boolean> deleteTmplItm(@RequestBody BatchDeleteReqVO req) {
|
||||
return success(tmplItmService.deleteTmplItm(req.getIds()));
|
||||
}
|
||||
|
||||
@GetMapping("/id")
|
||||
@Operation(summary = "根据id获得模板条款")
|
||||
public CommonResult<TmplItmRespVO> getTmplItm(@RequestBody String id) {
|
||||
return success(BeanUtils.toBean(tmplItmService.getById(id), TmplItmRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public CommonResult<List<TmplItmRespVO>> listTmplItm(Map<String, Object> params) {
|
||||
// 创建查询条件构造器
|
||||
QueryWrapper<TmplItmDO> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
// 遍历Map参数,动态添加查询条件
|
||||
if (params != null && !params.isEmpty()) {
|
||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
|
||||
// 过滤掉空值和空字符串
|
||||
if (value != null &&
|
||||
!(value instanceof String && StringUtils.isBlank((String) value))) {
|
||||
queryWrapper.eq(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 执行带条件的查询
|
||||
List<TmplItmDO> list = tmplItmService.list(queryWrapper);
|
||||
return success(BeanUtils.toBean(list, TmplItmRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "分页获得模板条款")
|
||||
public CommonResult<PageResult<TmplItmRespVO>> pageTmplItm(@Validated TmpItmPageReqVO pageReqVO) {
|
||||
PageResult<TmplItmDO> pageResult = tmplItmService.pageTmplItm(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, TmplItmRespVO.class));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user