From 90941913110fe3792c50e6c5bf58b737c77d0f10 Mon Sep 17 00:00:00 2001 From: PQZ Date: Thu, 8 Aug 2024 17:33:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=90=8C=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/BaseContTempController.java | 39 +++++++++++++++-- .../cont/service/BaseContTempService.java | 25 ++++++----- .../service/impl/BaseContTempServiceImpl.java | 43 ++++++++++++------- .../resources/mapper/cont/BaseContTemp.xml | 1 + 4 files changed, 77 insertions(+), 31 deletions(-) diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/cont/controller/admin/BaseContTempController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/cont/controller/admin/BaseContTempController.java index d965c236..fab1f662 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/cont/controller/admin/BaseContTempController.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/cont/controller/admin/BaseContTempController.java @@ -51,21 +51,46 @@ public class BaseContTempController { return success(contTempService.getContTempPage(pageReqVO, page)); } + /** + * 创建合同模板 + * + * @param createReqVO BaseContTempSaveReqVO + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 17:11 2024/8/8 + **/ @PostMapping("/create") @Operation(summary = "创建合同模板") @PreAuthorize("@ss.hasPermission('base:cont-temp:create')") - public CommonResult createContTemp(@Valid @RequestBody BaseContTempSaveReqVO createReqVO) { - return success(contTempService.createContTemp(createReqVO)); + public CommonResult createContTemp(@Valid @RequestBody BaseContTempSaveReqVO createReqVO) { + contTempService.saveConTemp(createReqVO); + return success(true); } + /** + * 编辑合同模板 + * + * @param updateReqVO BaseContTempSaveReqVO + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 17:11 2024/8/8 + **/ @PutMapping("/update") @Operation(summary = "更新合同模板") @PreAuthorize("@ss.hasPermission('base:cont-temp:update')") public CommonResult updateContTemp(@Valid @RequestBody BaseContTempSaveReqVO updateReqVO) { - contTempService.updateContTemp(updateReqVO); + contTempService.saveConTemp(updateReqVO); return success(true); } + /** + * 删除合同模板 + * + * @param id 合同模板id + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 17:12 2024/8/8 + **/ @DeleteMapping("/delete") @Operation(summary = "删除合同模板") @Parameter(name = "id", description = "编号", required = true) @@ -75,6 +100,14 @@ public class BaseContTempController { return success(true); } + /** + * 通过id查询合同模板 + * + * @param id id + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 17:12 2024/8/8 + **/ @GetMapping("/get") @Operation(summary = "获得合同模板") @Parameter(name = "id", description = "编号", required = true, example = "1024") diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/cont/service/BaseContTempService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/cont/service/BaseContTempService.java index 9dec53e9..b3b4d2e3 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/cont/service/BaseContTempService.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/cont/service/BaseContTempService.java @@ -17,26 +17,25 @@ import javax.validation.Valid; */ public interface BaseContTempService extends IService { - /** - * 创建合同模板 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - String createContTemp(@Valid BaseContTempSaveReqVO createReqVO); /** - * 更新合同模板 + * 保存合同模板 * - * @param updateReqVO 更新信息 - */ - void updateContTemp(@Valid BaseContTempSaveReqVO updateReqVO); + * @param reqVo BaseContTempSaveReqVO + * @return void + * @author PQZ + * @date 17:13 2024/8/8 + **/ + void saveConTemp(BaseContTempSaveReqVO reqVo); /** * 删除合同模板 * - * @param id 编号 - */ + * @param id 模板id + * @return void + * @author PQZ + * @date 17:16 2024/8/8 + **/ void deleteContTemp(String id); /** diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/cont/service/impl/BaseContTempServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/cont/service/impl/BaseContTempServiceImpl.java index 6a0f7935..2db5a2a5 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/cont/service/impl/BaseContTempServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/cont/service/impl/BaseContTempServiceImpl.java @@ -22,33 +22,46 @@ import javax.annotation.Resource; */ @Service @Validated -public class BaseContTempServiceImpl extends ServiceImpl implements BaseContTempService { +public class BaseContTempServiceImpl extends ServiceImpl implements BaseContTempService { @Resource private BaseContTempMapper contTempMapper; + + /** + * 保存合同模板 + * + * @param reqVo BaseContTempSaveReqVO + * @return void + * @author PQZ + * @date 17:13 2024/8/8 + **/ @Override - public String createContTemp(BaseContTempSaveReqVO createReqVO) { - // 插入 - BaseContTemp contTemp = BeanUtils.toBean(createReqVO, BaseContTemp.class); - contTempMapper.insert(contTemp); - // 返回 - return contTemp.getId(); - } - - @Override - public void updateContTemp(BaseContTempSaveReqVO updateReqVO) { - // 更新 - BaseContTemp updateObj = BeanUtils.toBean(updateReqVO, BaseContTemp.class); - contTempMapper.updateById(updateObj); + public void saveConTemp(BaseContTempSaveReqVO reqVo) { + BaseContTemp saveObj = BeanUtils.toBean(reqVo, BaseContTemp.class); + saveOrUpdate(saveObj); } + /** + * 删除合同模板 + * + * @param id 模板id + * @return void + * @author PQZ + * @date 17:16 2024/8/8 + **/ @Override public void deleteContTemp(String id) { // 删除 contTempMapper.deleteById(id); } + /** + * 获得合同模板 + * + * @param id 编号 + * @return 合同模板 + */ @Override public BaseContTemp getContTemp(String id) { return contTempMapper.selectById(id); @@ -65,7 +78,7 @@ public class BaseContTempServiceImpl extends ServiceImpl getContTempPage(BaseContTempPageReqVO pageReqVO, Page page) { - return contTempMapper.selectListPage(pageReqVO,page); + return contTempMapper.selectListPage(pageReqVO, page); } } \ No newline at end of file diff --git a/dl-module-base/src/main/resources/mapper/cont/BaseContTemp.xml b/dl-module-base/src/main/resources/mapper/cont/BaseContTemp.xml index 0a41637c..ef2cfb7d 100644 --- a/dl-module-base/src/main/resources/mapper/cont/BaseContTemp.xml +++ b/dl-module-base/src/main/resources/mapper/cont/BaseContTemp.xml @@ -19,5 +19,6 @@ AND main.temp_use = #{entity.tempUse} +ORDER BY main.create_time DESC \ No newline at end of file