Explorar o código

优化添加修改

java110 %!s(int64=4) %!d(string=hai) anos
pai
achega
4375e80eb1

+ 50 - 31
java110-bean/src/main/java/com/java110/po/parkingAreaText/ParkingAreaTextPo.java

@@ -16,7 +16,7 @@
 package com.java110.po.parkingAreaText;
 
 import java.io.Serializable;
-import java.util.Date;
+
 /**
  * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
  * add by 吴学文 at 2021-09-23 18:15:21 mail: 928255095@qq.com
@@ -28,76 +28,95 @@ import java.util.Date;
 public class ParkingAreaTextPo implements Serializable {
 
     private String voice;
-private String textId;
-private String typeCd;
-private String text3;
-private String text4;
-private String text1;
-private String text2;
-private String paId;
-private String statusCd = "0";
-private String communityId;
-public String getVoice() {
+    private String textId;
+    private String typeCd;
+    private String text3;
+    private String text4;
+    private String text1;
+    private String text2;
+    private String paId;
+    private String statusCd = "0";
+    private String communityId;
+
+    public String getVoice() {
         return voice;
     }
-public void setVoice(String voice) {
+
+    public void setVoice(String voice) {
         this.voice = voice;
     }
-public String getTextId() {
+
+    public String getTextId() {
         return textId;
     }
-public void setTextId(String textId) {
+
+    public void setTextId(String textId) {
         this.textId = textId;
     }
-public String getTypeCd() {
+
+    public String getTypeCd() {
         return typeCd;
     }
-public void setTypeCd(String typeCd) {
+
+    public void setTypeCd(String typeCd) {
         this.typeCd = typeCd;
     }
-public String getText3() {
+
+    public String getText3() {
         return text3;
     }
-public void setText3(String text3) {
+
+    public void setText3(String text3) {
         this.text3 = text3;
     }
-public String getText4() {
+
+    public String getText4() {
         return text4;
     }
-public void setText4(String text4) {
+
+    public void setText4(String text4) {
         this.text4 = text4;
     }
-public String getText1() {
+
+    public String getText1() {
         return text1;
     }
-public void setText1(String text1) {
+
+    public void setText1(String text1) {
         this.text1 = text1;
     }
-public String getText2() {
+
+    public String getText2() {
         return text2;
     }
-public void setText2(String text2) {
+
+    public void setText2(String text2) {
         this.text2 = text2;
     }
-public String getPaId() {
+
+    public String getPaId() {
         return paId;
     }
-public void setPaId(String paId) {
+
+    public void setPaId(String paId) {
         this.paId = paId;
     }
-public String getStatusCd() {
+
+    public String getStatusCd() {
         return statusCd;
     }
-public void setStatusCd(String statusCd) {
+
+    public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
     }
 
 
-
 }

+ 6 - 6
java110-db/src/main/resources/mapper/community/ParkingAreaTextV1ServiceDaoImplMapper.xml

@@ -84,16 +84,16 @@
         <if test="text2 !=null and text2 != ''">
             , t.text2= #{text2}
         </if>
-        <if test="paId !=null and paId != ''">
-            , t.pa_id= #{paId}
-        </if>
-        <if test="communityId !=null and communityId != ''">
-            , t.community_id= #{communityId}
-        </if>
         where 1=1
         <if test="textId !=null and textId != ''">
             and t.text_id= #{textId}
         </if>
+        <if test="paId !=null and paId != ''">
+            and t.pa_id= #{paId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
     </update>
 

+ 0 - 71
service-community/src/main/java/com/java110/community/cmd/parkingAreaText/DeleteParkingAreaTextCmd.java

@@ -1,71 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.community.cmd.parkingAreaText;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.core.annotation.Java110Cmd;
-import com.java110.core.annotation.Java110Transactional;
-import com.java110.core.context.ICmdDataFlowContext;
-import com.java110.core.event.cmd.AbstractServiceCmdListener;
-import com.java110.core.event.cmd.CmdEvent;
-import com.java110.intf.community.IParkingAreaTextV1InnerServiceSMO;
-import com.java110.po.parkingAreaText.ParkingAreaTextPo;
-import com.java110.utils.exception.CmdException;
-import com.java110.utils.util.Assert;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.vo.ResultVo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * 类表述:删除
- * 服务编码:parkingAreaText.deleteParkingAreaText
- * 请求路劲:/app/parkingAreaText.DeleteParkingAreaText
- * add by 吴学文 at 2021-09-23 18:15:21 mail: 928255095@qq.com
- * open source address: https://gitee.com/wuxw7/MicroCommunity
- * 官网:http://www.homecommunity.cn
- * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
- * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
- */
-@Java110Cmd(serviceCode = "parkingAreaText.deleteParkingAreaText")
-public class DeleteParkingAreaTextCmd extends AbstractServiceCmdListener {
-    private static Logger logger = LoggerFactory.getLogger(DeleteParkingAreaTextCmd.class);
-
-    @Autowired
-    private IParkingAreaTextV1InnerServiceSMO parkingAreaTextV1InnerServiceSMOImpl;
-
-    @Override
-    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
-        Assert.hasKeyAndValue(reqJson, "textId", "textId不能为空");
-        Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
-
-    }
-
-    @Override
-    @Java110Transactional
-    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
-
-        ParkingAreaTextPo parkingAreaTextPo = BeanConvertUtil.covertBean(reqJson, ParkingAreaTextPo.class);
-        int flag = parkingAreaTextV1InnerServiceSMOImpl.deleteParkingAreaText(parkingAreaTextPo);
-
-        if (flag < 1) {
-            throw new CmdException("删除数据失败");
-        }
-
-        cmdDataFlowContext.setResponseEntity(ResultVo.success());
-    }
-}

+ 17 - 4
service-community/src/main/java/com/java110/community/cmd/parkingAreaText/SaveParkingAreaTextCmd.java

@@ -22,6 +22,7 @@ import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.AbstractServiceCmdListener;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.parkingAreaText.ParkingAreaTextDto;
 import com.java110.intf.community.IParkingAreaTextV1InnerServiceSMO;
 import com.java110.po.parkingAreaText.ParkingAreaTextPo;
 import com.java110.utils.exception.CmdException;
@@ -32,6 +33,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.List;
+
 /**
  * 类表述:保存
  * 服务编码:parkingAreaText.saveParkingAreaText
@@ -68,11 +71,21 @@ public class SaveParkingAreaTextCmd extends AbstractServiceCmdListener {
     @Override
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
-
         ParkingAreaTextPo parkingAreaTextPo = BeanConvertUtil.covertBean(reqJson, ParkingAreaTextPo.class);
-        parkingAreaTextPo.setTextId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
-        int flag = parkingAreaTextV1InnerServiceSMOImpl.saveParkingAreaText(parkingAreaTextPo);
-
+        //查询是否有配置
+        ParkingAreaTextDto parkingAreaTextDto = new ParkingAreaTextDto();
+        parkingAreaTextDto.setPaId(reqJson.getString("paId"));
+        parkingAreaTextDto.setCommunityId(reqJson.getString("communityId"));
+        parkingAreaTextDto.setTypeCd(reqJson.getString("typeCd"));
+        List<ParkingAreaTextDto> parkingAreaTextDtos = parkingAreaTextV1InnerServiceSMOImpl.queryParkingAreaTexts(parkingAreaTextDto);
+        int flag = 0;
+        if (parkingAreaTextDtos == null || parkingAreaTextDtos.size() < 1) {
+            parkingAreaTextPo.setTextId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+            flag = parkingAreaTextV1InnerServiceSMOImpl.saveParkingAreaText(parkingAreaTextPo);
+        } else {
+            parkingAreaTextPo.setTextId(parkingAreaTextDtos.get(0).getTextId());
+            flag = parkingAreaTextV1InnerServiceSMOImpl.updateParkingAreaText(parkingAreaTextPo);
+        }
         if (flag < 1) {
             throw new CmdException("保存数据失败");
         }

+ 0 - 74
service-community/src/main/java/com/java110/community/cmd/parkingAreaText/UpdateParkingAreaTextCmd.java

@@ -1,74 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.community.cmd.parkingAreaText;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.core.annotation.Java110Cmd;
-import com.java110.core.annotation.Java110Transactional;
-import com.java110.core.context.ICmdDataFlowContext;
-import com.java110.core.event.cmd.AbstractServiceCmdListener;
-import com.java110.core.event.cmd.CmdEvent;
-import com.java110.intf.community.IParkingAreaTextV1InnerServiceSMO;
-import com.java110.po.parkingAreaText.ParkingAreaTextPo;
-import com.java110.utils.exception.CmdException;
-import com.java110.utils.util.Assert;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.vo.ResultVo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-
-
-/**
- * 类表述:更新
- * 服务编码:parkingAreaText.updateParkingAreaText
- * 请求路劲:/app/parkingAreaText.UpdateParkingAreaText
- * add by 吴学文 at 2021-09-23 18:15:21 mail: 928255095@qq.com
- * open source address: https://gitee.com/wuxw7/MicroCommunity
- * 官网:http://www.homecommunity.cn
- * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
- * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
- */
-@Java110Cmd(serviceCode = "parkingAreaText.updateParkingAreaText")
-public class UpdateParkingAreaTextCmd extends AbstractServiceCmdListener {
-
-    private static Logger logger = LoggerFactory.getLogger(UpdateParkingAreaTextCmd.class);
-
-
-    @Autowired
-    private IParkingAreaTextV1InnerServiceSMO parkingAreaTextV1InnerServiceSMOImpl;
-
-    @Override
-    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
-        Assert.hasKeyAndValue(reqJson, "textId", "textId不能为空");
-        Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
-
-    }
-
-    @Override
-    @Java110Transactional
-    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
-
-        ParkingAreaTextPo parkingAreaTextPo = BeanConvertUtil.covertBean(reqJson, ParkingAreaTextPo.class);
-        int flag = parkingAreaTextV1InnerServiceSMOImpl.updateParkingAreaText(parkingAreaTextPo);
-
-        if (flag < 1) {
-            throw new CmdException("更新数据失败");
-        }
-
-        cmdDataFlowContext.setResponseEntity(ResultVo.success());
-    }
-}