模版新增修改关联的相关实现
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
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, "模板分类不存在");
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
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.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 io.swagger.v3.oas.annotations.Operation;
|
||||
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 java.util.List;
|
||||
|
||||
@Tag(name = "管理后台 - 模板条款")
|
||||
@RestController
|
||||
@RequestMapping("/base/tmpl-ltm")
|
||||
@Validated
|
||||
@FileUploadController(source = "bse.tmplltm")
|
||||
@RequiredArgsConstructor
|
||||
public class TmplItmController {
|
||||
private final TmplItmService tmplItmService;
|
||||
@RequestMapping("/create")
|
||||
@Operation(summary = "创建模板条款")
|
||||
public CommonResult<TmplItmRespVO> createTmplItm(@Valid @RequestBody TmplItmSaveReqVO createReqVO){
|
||||
TmplItmRespVO tmplItm = tmplItmService.createTmplItm(createReqVO);
|
||||
return success(tmplItm);
|
||||
}
|
||||
@RequestMapping("/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));
|
||||
}
|
||||
@RequestMapping("/get")
|
||||
@Operation(summary = "根据id获得模板条款")
|
||||
public CommonResult<TmplItmRespVO> getTmplItm(@RequestBody String id){
|
||||
return success(BeanUtils.toBean(tmplItmService.getById(id), TmplItmRespVO.class));
|
||||
}
|
||||
@RequestMapping("/list")
|
||||
|
||||
public CommonResult<List<TmplItmRespVO>> listTmplItm(){
|
||||
return success(BeanUtils.toBean(tmplItmService.list(), TmplItmRespVO.class));
|
||||
}
|
||||
@RequestMapping("/page")
|
||||
@Operation(summary = "分页获得模板条款")
|
||||
public CommonResult<PageResult<TmplItmRespVO>> pageTmplItm(@Validated TmpItmPageReqVO pageReqVO){
|
||||
PageResult<TmplItmDO> pageResult = tmplItmService.pageTmplItm(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult,TmplItmRespVO.class));
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
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.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;
|
||||
import cn.iocoder.yudao.module.base.controller.admin.templtp.vo.TmplTpFldSaveReqVO;
|
||||
import cn.iocoder.yudao.module.base.dal.dataobject.tmpltp.TmplTpFldDO;
|
||||
import cn.iocoder.yudao.module.base.service.tmpltp.TmplTpFldService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 模板字段")
|
||||
@RestController
|
||||
@RequestMapping("/base/tmpl-fld")
|
||||
@Validated
|
||||
@FileUploadController(source = "bse.tmplfld")
|
||||
@RequiredArgsConstructor
|
||||
public class TmplTpFldController {
|
||||
private final TmplTpFldService tmplTpFldService;
|
||||
@RequestMapping("/create")
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建模板字段")
|
||||
// @PreAuthorize("@ss.hasPermission('bse:tmpl-tp: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')")
|
||||
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);
|
||||
return success(true);
|
||||
}
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得模板字段列表")
|
||||
@PreAuthorize("@ss.hasPermission('bse:tmpl-tp: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,35 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
|
||||
@Schema(description = "管理后台 - 模板条款分页 Request VO")
|
||||
@Data
|
||||
public class TmpItmPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "主键", example = "")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "条款编号")
|
||||
private String itmNum;
|
||||
|
||||
@Schema(description = "条款名称", example = "")
|
||||
private String itmName;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String rmk;
|
||||
|
||||
@Schema(description = "条款值")
|
||||
private String itmVal;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDate[] createTime;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
|
||||
@Schema(description = "管理后台 - 模板字段分页 Request VO")
|
||||
@Data
|
||||
public class TmplFldPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "字段编码", example = "")
|
||||
private String fldKy;
|
||||
|
||||
@Schema(description = "字段名称")
|
||||
private String fldName;
|
||||
|
||||
@Schema(description = "数据类型", example = "")
|
||||
private String datTp;
|
||||
|
||||
@Schema(description = "字段结构")
|
||||
private String fldDoc;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String rmk;
|
||||
@Schema(description = "是否必填")
|
||||
private String isMust;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDate[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
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
|
||||
public class TmplFldRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "类型字段编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
@ExcelProperty("类型字段编码")
|
||||
private String fldKy;
|
||||
|
||||
@Schema(description = "字段名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("字段名称")
|
||||
private String fldName;
|
||||
|
||||
@Schema(description = "数据类型", example = "")
|
||||
@ExcelProperty("数据类型")
|
||||
private String datTp;
|
||||
|
||||
@Schema(description = "字段结构", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("字段结构")
|
||||
private String fldDoc;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("备注")
|
||||
private String rmk;
|
||||
|
||||
@Schema(description = "是否必填, 建议值:Y(是)、N(否),需在业务层做枚举校验", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("是否必填")
|
||||
private String isMust;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 模板分类 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class TmplItmRespVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
@ExcelProperty("主键")
|
||||
private String id;
|
||||
|
||||
|
||||
@Schema(description = "条款编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
@ExcelProperty("条款编码")
|
||||
private String itmNum;
|
||||
|
||||
|
||||
@Schema(description = "条款名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
@ExcelProperty("条款名称")
|
||||
private String itmName;
|
||||
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
@ExcelProperty("备注")
|
||||
private String rmk;
|
||||
|
||||
|
||||
@Schema(description = "条款结构", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
@ExcelProperty("条款结构")
|
||||
private String itmVal;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 模板条款新增/修改 Request VO")
|
||||
@Data
|
||||
public class TmplItmSaveReqVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
private long id;
|
||||
|
||||
@Schema(description = "条款编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
private String itmNum;
|
||||
|
||||
@Schema(description = "条款名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
private String itmName;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
private String rmk;
|
||||
|
||||
@Schema(description = "条款值", requiredMode = Schema.RequiredMode.REQUIRED, example = "")
|
||||
private String itmVal;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 模板字段新增/修改 Request VO")
|
||||
@Data
|
||||
public class TmplTpFldSaveReqVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20895")
|
||||
private Long id;
|
||||
@Schema(description = "字段编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "code")
|
||||
private String fldKy;
|
||||
@Schema(description = "字段名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "代码")
|
||||
private String fldName;
|
||||
@Schema(description = "字段数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "string")
|
||||
private String datTp;
|
||||
@Schema(description = "字段描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "代码")
|
||||
private String fldDoc;
|
||||
@Schema(description = "字段备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "代码")
|
||||
private String rmk;
|
||||
@Schema(description = "是否必填", requiredMode = Schema.RequiredMode.REQUIRED, example = "Y")
|
||||
private String isMust;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user