模版新增修改关联的相关实现
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@ 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;
|
||||
@@ -15,9 +16,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -29,34 +28,33 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class TmplItmController {
|
||||
private final TmplItmService tmplItmService;
|
||||
@RequestMapping("/create")
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建模板条款")
|
||||
public CommonResult<TmplItmRespVO> createTmplItm(@Valid @RequestBody TmplItmSaveReqVO createReqVO){
|
||||
TmplItmRespVO tmplItm = tmplItmService.createTmplItm(createReqVO);
|
||||
return success(tmplItm);
|
||||
}
|
||||
@RequestMapping("/update")
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新模板条款")
|
||||
public CommonResult<Boolean> updateTmplItm(@Valid @RequestBody TmplItmSaveReqVO updateReqVO){
|
||||
tmplItmService.updateTmplItm(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
@RequestMapping("/delete")
|
||||
@Operation(summary = "删除模板条款")
|
||||
public CommonResult<Boolean> deleteTmplItm(@RequestBody String ids){
|
||||
return success( tmplItmService.deleteTmplItm(ids));
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除模板条款", description = "")
|
||||
public CommonResult<Boolean> deleteTmplItm(@RequestBody BatchDeleteReqVO req){
|
||||
return success( tmplItmService.deleteTmplItm(req.getIds()));
|
||||
}
|
||||
@RequestMapping("/get")
|
||||
@GetMapping("/id")
|
||||
@Operation(summary = "根据id获得模板条款")
|
||||
public CommonResult<TmplItmRespVO> getTmplItm(@RequestBody String id){
|
||||
return success(BeanUtils.toBean(tmplItmService.getById(id), TmplItmRespVO.class));
|
||||
}
|
||||
@RequestMapping("/list")
|
||||
|
||||
@GetMapping("/list")
|
||||
public CommonResult<List<TmplItmRespVO>> listTmplItm(){
|
||||
return success(BeanUtils.toBean(tmplItmService.list(), TmplItmRespVO.class));
|
||||
}
|
||||
@RequestMapping("/page")
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "分页获得模板条款")
|
||||
public CommonResult<PageResult<TmplItmRespVO>> pageTmplItm(@Validated TmpItmPageReqVO pageReqVO){
|
||||
PageResult<TmplItmDO> pageResult = tmplItmService.pageTmplItm(pageReqVO);
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplTpPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplTpRespVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplTpSaveReqVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplTpTreeVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.*;
|
||||
import cn.iocoder.yudao.module.base.dal.dataobject.tmpltp.TmplTpDO;
|
||||
import cn.iocoder.yudao.module.base.service.tmpltp.TmplTpService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -67,8 +64,8 @@ public class TmplTpController extends AbstractFileUploadController implements Bu
|
||||
@Operation(summary = "删除模板分类")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:delete')")
|
||||
public CommonResult<Boolean> deleteTmplTp(@RequestParam("id") Long id) {
|
||||
tmplTpService.deleteTmplTp(id);
|
||||
public CommonResult<Boolean> deleteTmplTp(@RequestBody BatchDeleteReqVO req) {
|
||||
tmplTpService.deleteTmplTp(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -111,8 +108,8 @@ public class TmplTpController extends AbstractFileUploadController implements Bu
|
||||
BeanUtils.toBean(list, TmplTpRespVO.class));
|
||||
}
|
||||
//字段和条款回显
|
||||
@GetMapping("/get-field-and-clause")
|
||||
@Operation(summary = "获得字段和条款")
|
||||
@GetMapping("/field-and-clause")
|
||||
@Operation(summary = "获得字段和条款",description = "字段和条款回显,传入模版分类的id")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:query')")
|
||||
public CommonResult<Map<String, Object>> getFieldAndClause(@RequestParam("id") Long id) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@@ -122,10 +119,19 @@ public class TmplTpController extends AbstractFileUploadController implements Bu
|
||||
}
|
||||
//获取分类树
|
||||
@GetMapping("/tree")
|
||||
@Operation(summary = "获得分类树")
|
||||
@Operation(summary = "获得分类树--上级")
|
||||
public CommonResult<List<TmplTpTreeVO>> getTree() {
|
||||
List<TmplTpTreeVO> tree = tmplTpService.buildTree();
|
||||
return success(tree);
|
||||
}
|
||||
|
||||
//更新类型状态
|
||||
@PutMapping("/updateStatus")
|
||||
@Operation(summary = "更新模板字段状态")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:update')")
|
||||
public CommonResult<Boolean> updateStatus(@RequestBody TmplTpSaveReqVO updateReqVO) {
|
||||
tmplTpService.updateStatus(updateReqVO.getId(), updateReqVO.getSts());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.base.controller.admin.templtp;
|
||||
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.TmplFldPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplFldRespVO;
|
||||
@@ -18,6 +19,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@@ -29,31 +31,30 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
@RequiredArgsConstructor
|
||||
public class TmplTpFldController {
|
||||
private final TmplTpFldService tmplTpFldService;
|
||||
@RequestMapping("/create")
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建模板字段")
|
||||
// @PreAuthorize("@ss.hasPermission('bse:tmpl-tp:create')")
|
||||
// @PreAuthorize("@ss.hasPermission('bse:tmpl-tp-fld:create')")
|
||||
public CommonResult<TmplFldRespVO> createTmplFld(@Valid @RequestBody TmplTpFldSaveReqVO tmplTpFldSaveReqVO) {
|
||||
return success(tmplTpFldService.createTmplFld(tmplTpFldSaveReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新模板字段")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:update')")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp-fld:update')")
|
||||
public CommonResult<Boolean> updateTmplTp(@Valid @RequestBody TmplTpFldSaveReqVO updateReqVO) {
|
||||
tmplTpFldService.updateTmplFld(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除模板字段")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:delete')")
|
||||
public CommonResult<Boolean> deleteTmplTp(@RequestParam("id") String id) {
|
||||
tmplTpFldService.removeById(id);
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp-fld:delete')")
|
||||
public CommonResult<Boolean> deleteTmplTp(@RequestBody BatchDeleteReqVO req) {
|
||||
tmplTpFldService.deleteTmplTpByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得模板字段列表")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp:list')")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp-fld:list')")
|
||||
public CommonResult<PageResult<TmplFldRespVO>> getTmplTpList( @Valid TmplFldPageReqVO pageReqVO) {
|
||||
PageResult<TmplTpFldDO> pageResult = tmplTpFldService.tmplTpFldPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, TmplFldRespVO.class));
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 模板实例分页 Request VO")
|
||||
@Data
|
||||
public class TemplateInstancePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "分类树主键", example = "7804")
|
||||
private Long typeId;
|
||||
|
||||
@Schema(description = "模板名称", example = "王五")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "模板编码")
|
||||
private String coding;
|
||||
|
||||
@Schema(description = "模板描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "实例文件内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "原始文件内容")
|
||||
private String originalContent;
|
||||
|
||||
@Schema(description = "文件类型", example = "1")
|
||||
private String fileType;
|
||||
|
||||
@Schema(description = "版本号;如v1.0")
|
||||
private String version;
|
||||
|
||||
@Schema(description = "状态", example = "2")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 模板实例 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class TemplateInstanceRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "29024")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "分类树主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7804")
|
||||
@ExcelProperty("分类树主键")
|
||||
private Long typeId;
|
||||
|
||||
@Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@ExcelProperty("模板名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("模板编码")
|
||||
private String coding;
|
||||
|
||||
@Schema(description = "模板描述")
|
||||
@ExcelProperty("模板描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "实例文件内容")
|
||||
@ExcelProperty("实例文件内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "原始文件内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("原始文件内容")
|
||||
private String originalContent;
|
||||
|
||||
@Schema(description = "文件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("文件类型")
|
||||
private String fileType;
|
||||
|
||||
@Schema(description = "版本号;如v1.0", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("版本号;如v1.0")
|
||||
private String version;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 模板实例新增/修改 Request VO")
|
||||
@Data
|
||||
public class TemplateInstanceSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "29024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "分类树主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7804")
|
||||
@NotNull(message = "分类树主键不能为空")
|
||||
private Long typeId;
|
||||
|
||||
@Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "模板名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "模板编码不能为空")
|
||||
private String coding;
|
||||
|
||||
@Schema(description = "模板描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "实例文件内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "原始文件内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "原始文件内容不能为空")
|
||||
private String originalContent;
|
||||
|
||||
@Schema(description = "文件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotEmpty(message = "文件类型不能为空")
|
||||
private String fileType;
|
||||
|
||||
@Schema(description = "版本号;如v1.0", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "版本号;如v1.0不能为空")
|
||||
private String version;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "状态不能为空")
|
||||
private String status;
|
||||
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Schema(description = "管理后台 - 模板分类 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@@ -33,4 +35,13 @@ public class TmplItmRespVO {
|
||||
@Schema(description = "条款结构", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
@ExcelProperty("条款结构")
|
||||
private String itmVal;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDate createTime;
|
||||
|
||||
|
||||
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建人")
|
||||
private String creator;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -15,10 +16,10 @@ public class TmplTpFldSaveReqVO {
|
||||
@Schema(description = "字段数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "string")
|
||||
private String datTp;
|
||||
@Schema(description = "字段描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "代码")
|
||||
private String fldDoc;
|
||||
private JSONObject fldDoc;
|
||||
@Schema(description = "字段备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "代码")
|
||||
private String rmk;
|
||||
@Schema(description = "是否必填", requiredMode = Schema.RequiredMode.REQUIRED, example = "Y")
|
||||
@Schema(description = "是否必填", requiredMode = Schema.RequiredMode.REQUIRED, example = "Y or N")
|
||||
private String isMust;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,33 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
@Data
|
||||
public class TmplTpTreeVO {
|
||||
private String tenantId;
|
||||
private String id;
|
||||
private String label;
|
||||
private String value;
|
||||
private String prnId;
|
||||
public class TmplTpTreeVO{
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20895")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "类型名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "类型编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String num;
|
||||
|
||||
@Schema(description = "父类型主键;顶级为NULL", example = "20414")
|
||||
private Long prnId;
|
||||
|
||||
@Schema(description = "同级排序序号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long srt;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String sts;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDate createTime;
|
||||
|
||||
private List<TmplTpTreeVO> children;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user