From bd09d7dc3a0a600868ad337f0c12a20c26ab634e Mon Sep 17 00:00:00 2001 From: ljlong_2630 Date: Wed, 20 Dec 2023 10:26:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E6=96=B0=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DcBaseAssetInfoController.java | 9 +++++++-- .../controller/DcBaseParamModelController.java | 10 ++++------ .../com/lzbi/asset/domain/DcBaseParamModel.java | 3 --- .../controller/DcBaseAssetTargetController.java | 9 +++++++-- .../controller/DcBaseTargetModelController.java | 17 +++++++++++------ .../mapper/asset/DcBaseAssetInfoMapper.xml | 7 ++++--- .../mapper/asset/DcBaseParamModelMapper.xml | 1 + .../targetFolder/DcBaseAssetTargetMapper.xml | 1 + .../targetFolder/DcBaseTargetModelMapper.xml | 1 + 9 files changed, 36 insertions(+), 22 deletions(-) diff --git a/lzbi-module/src/main/java/com/lzbi/asset/controller/DcBaseAssetInfoController.java b/lzbi-module/src/main/java/com/lzbi/asset/controller/DcBaseAssetInfoController.java index bdfceb5..243f3aa 100644 --- a/lzbi-module/src/main/java/com/lzbi/asset/controller/DcBaseAssetInfoController.java +++ b/lzbi-module/src/main/java/com/lzbi/asset/controller/DcBaseAssetInfoController.java @@ -79,6 +79,10 @@ public class DcBaseAssetInfoController extends BaseController { @Log(title = "资产信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody DcBaseAssetInfo dcBaseAssetInfo) { + dcBaseAssetInfo.setCreatedTime(DateUtils.getNowDate()); + dcBaseAssetInfo.setCreatedBy(String.valueOf(getUserId())); + dcBaseAssetInfo.setDeptId(getDeptId()); + dcBaseAssetInfo.setUserId(getUserId()); return toAjax(dcBaseAssetInfoService.insertDcBaseAssetInfo(dcBaseAssetInfo)); } @@ -89,6 +93,8 @@ public class DcBaseAssetInfoController extends BaseController { @Log(title = "资产信息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody DcBaseAssetInfo dcBaseAssetInfo) { + dcBaseAssetInfo.setUpdatedBy(getUsername()); + dcBaseAssetInfo.setUpdatedTime(DateUtils.getNowDate()); return toAjax(dcBaseAssetInfoService.updateDcBaseAssetInfo(dcBaseAssetInfo)); } @@ -122,10 +128,9 @@ public class DcBaseAssetInfoController extends BaseController { beanObject.remove("id"); DcBaseAssetInfo dcBaseAssetInfo = JSON.toJavaObject(beanObject, DcBaseAssetInfo.class); dcBaseAssetInfo.setCreatedTime(DateUtils.getNowDate()); + dcBaseAssetInfo.setCreatedBy(String.valueOf(getUserId())); dcBaseAssetInfo.setDeptId(getDeptId()); dcBaseAssetInfo.setUserId(getUserId()); - dcBaseAssetInfo.setCreatedBy(String.valueOf(getUserId())); - dcBaseAssetInfo.setCreatedTime(DateUtils.getNowDate()); beanList.add(dcBaseAssetInfo); } } catch (Exception e) { diff --git a/lzbi-module/src/main/java/com/lzbi/asset/controller/DcBaseParamModelController.java b/lzbi-module/src/main/java/com/lzbi/asset/controller/DcBaseParamModelController.java index fcbf22b..004f976 100644 --- a/lzbi-module/src/main/java/com/lzbi/asset/controller/DcBaseParamModelController.java +++ b/lzbi-module/src/main/java/com/lzbi/asset/controller/DcBaseParamModelController.java @@ -72,11 +72,10 @@ public class DcBaseParamModelController extends BaseController @PostMapping public AjaxResult add(@Valid @RequestBody DcBaseParamModel dcBaseParamModel) { //BeanValidators.validateWithException(validator, dcBaseParamModel); - dcBaseParamModel.setCreatedBy(getUsername()); dcBaseParamModel.setCreatedTime(DateUtils.getNowDate()); - dcBaseParamModel.setTenantId("0"); - dcBaseParamModel.setUpdatedBy(getUsername()); - dcBaseParamModel.setUpdatedTime(DateUtils.getNowDate()); + dcBaseParamModel.setCreatedBy(String.valueOf(getUserId())); + dcBaseParamModel.setDeptId(getDeptId()); + dcBaseParamModel.setUserId(getUserId()); return toAjax(dcBaseParamModelService.insertByVo(dcBaseParamModel)); } /** @@ -154,10 +153,9 @@ public class DcBaseParamModelController extends BaseController beanObject.remove("id"); DcBaseParamModel dcBaseParamModel = JSON.toJavaObject(beanObject, DcBaseParamModel.class); dcBaseParamModel.setCreatedTime(DateUtils.getNowDate()); + dcBaseParamModel.setCreatedBy(String.valueOf(getUserId())); dcBaseParamModel.setDeptId(getDeptId()); dcBaseParamModel.setUserId(getUserId()); - dcBaseParamModel.setCreatedBy(String.valueOf(getUserId())); - dcBaseParamModel.setCreatedTime(DateUtils.getNowDate()); dcBaseParamModelList.add(dcBaseParamModel); } } catch (Exception e) { diff --git a/lzbi-module/src/main/java/com/lzbi/asset/domain/DcBaseParamModel.java b/lzbi-module/src/main/java/com/lzbi/asset/domain/DcBaseParamModel.java index a2aa9ba..0fdb568 100644 --- a/lzbi-module/src/main/java/com/lzbi/asset/domain/DcBaseParamModel.java +++ b/lzbi-module/src/main/java/com/lzbi/asset/domain/DcBaseParamModel.java @@ -22,9 +22,6 @@ import com.lzbi.module.base.BaseModuleEntity; @TableName("dc_base_param_model") public class DcBaseParamModel extends BaseModuleEntity{ - /** 主键 */ - @ApiModelProperty(name = "主键",notes = "") - private Long id ; /** 参数模型编码 */ @ApiModelProperty(name = "参数模型编码",notes = "") private String paramModelCode ; diff --git a/lzbi-module/src/main/java/com/lzbi/targetFolder/controller/DcBaseAssetTargetController.java b/lzbi-module/src/main/java/com/lzbi/targetFolder/controller/DcBaseAssetTargetController.java index a715896..93a793e 100644 --- a/lzbi-module/src/main/java/com/lzbi/targetFolder/controller/DcBaseAssetTargetController.java +++ b/lzbi-module/src/main/java/com/lzbi/targetFolder/controller/DcBaseAssetTargetController.java @@ -83,6 +83,10 @@ public class DcBaseAssetTargetController extends BaseController @PostMapping public AjaxResult add(@RequestBody DcBaseAssetTarget dcBaseAssetTarget) { + dcBaseAssetTarget.setCreatedTime(DateUtils.getNowDate()); + dcBaseAssetTarget.setCreatedBy(String.valueOf(getUserId())); + dcBaseAssetTarget.setDeptId(getDeptId()); + dcBaseAssetTarget.setUserId(getUserId()); return toAjax(dcBaseAssetTargetService.insertDcBaseAssetTarget(dcBaseAssetTarget)); } @@ -94,6 +98,8 @@ public class DcBaseAssetTargetController extends BaseController @PutMapping public AjaxResult edit(@RequestBody DcBaseAssetTarget dcBaseAssetTarget) { + dcBaseAssetTarget.setUpdatedTime(DateUtils.getNowDate()); + dcBaseAssetTarget.setUpdatedBy(String.valueOf(getUserId())); return toAjax(dcBaseAssetTargetService.updateDcBaseAssetTarget(dcBaseAssetTarget)); } @@ -140,10 +146,9 @@ public class DcBaseAssetTargetController extends BaseController beanObject.remove("id"); DcBaseAssetTarget dcBaseAssetTarget = JSON.toJavaObject(beanObject, DcBaseAssetTarget.class); dcBaseAssetTarget.setCreatedTime(DateUtils.getNowDate()); + dcBaseAssetTarget.setCreatedBy(String.valueOf(getUserId())); dcBaseAssetTarget.setDeptId(getDeptId()); dcBaseAssetTarget.setUserId(getUserId()); - dcBaseAssetTarget.setCreatedBy(String.valueOf(getUserId())); - dcBaseAssetTarget.setCreatedTime(DateUtils.getNowDate()); beanList.add(dcBaseAssetTarget); } } catch (Exception e) { diff --git a/lzbi-module/src/main/java/com/lzbi/targetFolder/controller/DcBaseTargetModelController.java b/lzbi-module/src/main/java/com/lzbi/targetFolder/controller/DcBaseTargetModelController.java index c8a348e..047170f 100644 --- a/lzbi-module/src/main/java/com/lzbi/targetFolder/controller/DcBaseTargetModelController.java +++ b/lzbi-module/src/main/java/com/lzbi/targetFolder/controller/DcBaseTargetModelController.java @@ -101,9 +101,13 @@ public class DcBaseTargetModelController extends BaseController @PreAuthorize("@ss.hasPermi('target:targetModel:add')") @Log(title = "指标模版配置", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody DcBaseTargetModel DcBaseTargetModel) + public AjaxResult add(@RequestBody DcBaseTargetModel dcBaseTargetModel) { - return toAjax(dcBaseTargetModelService.insertDcBaseTargetModel(DcBaseTargetModel)); + dcBaseTargetModel.setCreatedTime(DateUtils.getNowDate()); + dcBaseTargetModel.setCreatedBy(String.valueOf(getUserId())); + dcBaseTargetModel.setDeptId(getDeptId()); + dcBaseTargetModel.setUserId(getUserId()); + return toAjax(dcBaseTargetModelService.insertDcBaseTargetModel(dcBaseTargetModel)); } /** @@ -117,9 +121,11 @@ public class DcBaseTargetModelController extends BaseController @PreAuthorize("@ss.hasPermi('target:targetModel:edit')") @Log(title = "指标模版配置", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody DcBaseTargetModel DcBaseTargetModel) + public AjaxResult edit(@RequestBody DcBaseTargetModel dcBaseTargetModel) { - return toAjax(dcBaseTargetModelService.updateDcBaseTargetModel(DcBaseTargetModel)); + dcBaseTargetModel.setUpdatedTime(DateUtils.getNowDate()); + dcBaseTargetModel.setUpdatedBy(String.valueOf(getUserId())); + return toAjax(dcBaseTargetModelService.updateDcBaseTargetModel(dcBaseTargetModel)); } /** @@ -157,10 +163,9 @@ public class DcBaseTargetModelController extends BaseController beanObject.remove("id"); DcBaseTargetModel dcBaseTargetModel = JSON.toJavaObject(beanObject, DcBaseTargetModel.class); dcBaseTargetModel.setCreatedTime(DateUtils.getNowDate()); + dcBaseTargetModel.setCreatedBy(String.valueOf(getUserId())); dcBaseTargetModel.setDeptId(getDeptId()); dcBaseTargetModel.setUserId(getUserId()); - dcBaseTargetModel.setCreatedBy(String.valueOf(getUserId())); - dcBaseTargetModel.setCreatedTime(DateUtils.getNowDate()); beanList.add(dcBaseTargetModel); } } catch (Exception e) { diff --git a/lzbi-module/src/main/resources/mapper/asset/DcBaseAssetInfoMapper.xml b/lzbi-module/src/main/resources/mapper/asset/DcBaseAssetInfoMapper.xml index dd97119..317cec1 100644 --- a/lzbi-module/src/main/resources/mapper/asset/DcBaseAssetInfoMapper.xml +++ b/lzbi-module/src/main/resources/mapper/asset/DcBaseAssetInfoMapper.xml @@ -65,6 +65,7 @@ and comany_id = #{comanyId} and dept_id = #{deptId} + ORDER BY COALESCE(updated_time, created_time) DESC insert into dc_base_param_model diff --git a/lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml b/lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml index 3a80772..8efca09 100644 --- a/lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml +++ b/lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml @@ -62,6 +62,7 @@ and dept_id = #{deptId} and user_id = #{userId} + ORDER BY COALESCE(updated_time, created_time) DESC