From 549674700f5ff6970efb3d878f110e015b5ba219 Mon Sep 17 00:00:00 2001 From: Renpc-kilig <308442850@qq.com> Date: Wed, 29 May 2024 17:41:55 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9=E3=80=81=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E8=B0=83=E4=BC=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agreementportal/AgreementPortalDTO.java | 10 +++++++ .../impl/AgreementPortalServiceImpl.java | 16 +++++++++++- .../agreementportal/agreement-mapper.xml | 6 ++++- .../templates/agreementportal/list.html | 26 ++++++++++++++++++- 4 files changed, 55 insertions(+), 3 deletions(-) diff --git a/src/main/java/cn/com/tenlion/operator/pojo/dtos/agreementportal/AgreementPortalDTO.java b/src/main/java/cn/com/tenlion/operator/pojo/dtos/agreementportal/AgreementPortalDTO.java index c0d6e7f..f68d232 100644 --- a/src/main/java/cn/com/tenlion/operator/pojo/dtos/agreementportal/AgreementPortalDTO.java +++ b/src/main/java/cn/com/tenlion/operator/pojo/dtos/agreementportal/AgreementPortalDTO.java @@ -34,6 +34,8 @@ public class AgreementPortalDTO { private Integer isDelete; @ApiModelProperty(name = "agreementType", value = "协议类型") private String agreementType; + @ApiModelProperty(name = "agreementTypeName", value = "协议类型") + private String agreementTypeName; @ApiModelProperty(name = "versionNum", value = "版本号") private Double versionNum; @ApiModelProperty(name = "sendStatus", value = "发布状态") @@ -134,4 +136,12 @@ public class AgreementPortalDTO { public void setSendStatus(String sendStatus) { this.sendStatus = sendStatus; } + + public String getAgreementTypeName() { + return agreementTypeName; + } + + public void setAgreementTypeName(String agreementTypeName) { + this.agreementTypeName = agreementTypeName; + } } diff --git a/src/main/java/cn/com/tenlion/operator/service/agreementportal/impl/AgreementPortalServiceImpl.java b/src/main/java/cn/com/tenlion/operator/service/agreementportal/impl/AgreementPortalServiceImpl.java index 43537b2..22c6b86 100644 --- a/src/main/java/cn/com/tenlion/operator/service/agreementportal/impl/AgreementPortalServiceImpl.java +++ b/src/main/java/cn/com/tenlion/operator/service/agreementportal/impl/AgreementPortalServiceImpl.java @@ -67,6 +67,7 @@ public class AgreementPortalServiceImpl extends DefaultBaseService implements IA Object o = params.get("sendStatus"); params.remove("sendStatus"); List list = list(params); + params.put("versionNum", 1); if(!CollectionUtils.isEmpty(list)) { Optional max = list.stream() .max(Comparator.comparingDouble(AgreementPortalDTO::getVersionNum)); @@ -115,6 +116,18 @@ public class AgreementPortalServiceImpl extends DefaultBaseService implements IA } else { setAppUpdateInfo(token, params); } + // 查询此类型是否已经有数据 + // 如果有,则版本号+1 + Object o = params.get("sendStatus"); + params.remove("sendStatus"); + List list = list(params); + params.put("versionNum", 1); + if(!CollectionUtils.isEmpty(list)) { + Optional max = list.stream() + .max(Comparator.comparingDouble(AgreementPortalDTO::getVersionNum)); + params.put("versionNum", max.get().getVersionNum() + 1); + } + params.put("sendStatus", o); agreementDao.update(params); } @@ -156,7 +169,8 @@ public class AgreementPortalServiceImpl extends DefaultBaseService implements IA @Override public List list(Map params) { - return agreementDao.list(params); + List list = agreementDao.list(params); + return list; } @Override diff --git a/src/main/resources/mybatis/mapper/agreementportal/agreement-mapper.xml b/src/main/resources/mybatis/mapper/agreementportal/agreement-mapper.xml index 14932ad..762e37c 100644 --- a/src/main/resources/mybatis/mapper/agreementportal/agreement-mapper.xml +++ b/src/main/resources/mybatis/mapper/agreementportal/agreement-mapper.xml @@ -8,6 +8,7 @@ + @@ -211,11 +212,13 @@ t1.modifier, t1.gmt_modified, t1.is_delete, + t2.data_name agreement_type_name, 1 FROM - data_agreement t1 + data_agreement t1 LEFT JOIN data_data t2 ON t1.agreement_type = t2.data_id WHERE t1.is_delete = 0 + AND t2.is_delete = 0 AND t1.send_status = #{sendStatus} @@ -242,6 +245,7 @@ #{agreementIds[${index}]} + ORDER BY t1.agreement_type, t1.version_num diff --git a/src/main/resources/templates/agreementportal/list.html b/src/main/resources/templates/agreementportal/list.html index f1ba82f..4529eb1 100644 --- a/src/main/resources/templates/agreementportal/list.html +++ b/src/main/resources/templates/agreementportal/list.html @@ -90,6 +90,30 @@ return rowData; } }, + {field: 'agreementTypeName', width: 180, title: '协议类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'sendStatus', width: 180, title: '发布状态', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + if(rowData == 'save') { + rowData = '

保存状态

'; + } + if(rowData == 'published') { + rowData = '

发布状态

'; + } + return rowData; + } + }, {field: 'versionNum', width: 180, title: '版本号', align:'center', templet: function(row) { var rowData = row[this.field]; @@ -258,7 +282,7 @@ if(i > 1) { ids += '_'; } - ids += item['agreementportalId']; + ids += item['agreementId']; } removeData(ids); }