瀏覽代碼

优化代码

1098226878 4 年之前
父節點
當前提交
3f1dc57d57

+ 9 - 0
java110-bean/src/main/java/com/java110/po/floor/FloorPo.java

@@ -19,6 +19,7 @@ public class FloorPo implements Serializable {
     private String userId;
     private String remark;
     private String communityId;
+    private String statusCd;
 
     public String getFloorId() {
         return floorId;
@@ -75,4 +76,12 @@ public class FloorPo implements Serializable {
     public void setFloorArea(String floorArea) {
         this.floorArea = floorArea;
     }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
 }

+ 127 - 0
java110-db/src/main/resources/mapper/community/FFloorV1ServiceDaoImplMapper.xml

@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="fFloorV1ServiceDaoImpl">
+
+
+
+
+
+    <!-- 保存楼栋信息 add by wuxw 2018-07-03 -->
+    <insert id="saveFFloorInfo" parameterType="Map">
+        insert into f_floor(
+floor_id,name,remark,b_id,community_id,user_id,floor_num,floor_area
+) values (
+#{floorId},#{name},#{remark},#{bId},#{communityId},#{userId},#{floorNum},#{floorArea}
+)
+    </insert>
+
+
+
+    <!-- 查询楼栋信息 add by wuxw 2018-07-03 -->
+    <select id="getFFloorInfo" parameterType="Map" resultType="Map">
+        select  t.floor_id,t.floor_id floorId,t.name,t.remark,t.b_id,t.b_id bId,t.community_id,t.community_id communityId,t.user_id,t.user_id userId,t.floor_num,t.floor_num floorNum,t.floor_area,t.floor_area floorArea 
+from f_floor t 
+where 1 =1 
+<if test="floorId !=null and floorId != ''">
+   and t.floor_id= #{floorId}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="floorNum !=null and floorNum != ''">
+   and t.floor_num= #{floorNum}
+</if> 
+<if test="floorArea !=null and floorArea != ''">
+   and t.floor_area= #{floorArea}
+</if> 
+order by t.create_time desc
+<if test="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改楼栋信息 add by wuxw 2018-07-03 -->
+    <update id="updateFFloorInfo" parameterType="Map">
+        update  f_floor t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="name !=null and name != ''">
+, t.name= #{name}
+</if> 
+<if test="remark !=null and remark != ''">
+, t.remark= #{remark}
+</if> 
+<if test="communityId !=null and communityId != ''">
+, t.community_id= #{communityId}
+</if> 
+<if test="userId !=null and userId != ''">
+, t.user_id= #{userId}
+</if> 
+<if test="floorNum !=null and floorNum != ''">
+, t.floor_num= #{floorNum}
+</if> 
+<if test="floorArea !=null and floorArea != ''">
+, t.floor_area= #{floorArea}
+</if> 
+ where 1=1 <if test="floorId !=null and floorId != ''">
+and t.floor_id= #{floorId}
+</if> 
+<if test="bId !=null and bId != ''">
+and t.b_id= #{bId}
+</if> 
+
+    </update>
+
+    <!-- 查询楼栋数量 add by wuxw 2018-07-03 -->
+     <select id="queryFFloorsCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from f_floor t 
+where 1 =1 
+<if test="floorId !=null and floorId != ''">
+   and t.floor_id= #{floorId}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="floorNum !=null and floorNum != ''">
+   and t.floor_num= #{floorNum}
+</if> 
+<if test="floorArea !=null and floorArea != ''">
+   and t.floor_area= #{floorArea}
+</if> 
+
+
+     </select>
+
+</mapper>

+ 127 - 0
java110-db/src/main/resources/mapper/community/FloorV1ServiceDaoImplMapper.xml

@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="floorV1ServiceDaoImpl">
+
+
+
+
+
+    <!-- 保存楼栋信息 add by wuxw 2018-07-03 -->
+    <insert id="saveFloorInfo" parameterType="Map">
+        insert into f_floor(
+floor_id,name,remark,b_id,community_id,user_id,floor_num,floor_area
+) values (
+#{floorId},#{name},#{remark},#{bId},#{communityId},#{userId},#{floorNum},#{floorArea}
+)
+    </insert>
+
+
+
+    <!-- 查询楼栋信息 add by wuxw 2018-07-03 -->
+    <select id="getFloorInfo" parameterType="Map" resultType="Map">
+        select  t.floor_id,t.floor_id floorId,t.name,t.remark,t.b_id,t.b_id bId,t.community_id,t.community_id communityId,t.user_id,t.user_id userId,t.floor_num,t.floor_num floorNum,t.floor_area,t.floor_area floorArea 
+from f_floor t 
+where 1 =1 
+<if test="floorId !=null and floorId != ''">
+   and t.floor_id= #{floorId}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="floorNum !=null and floorNum != ''">
+   and t.floor_num= #{floorNum}
+</if> 
+<if test="floorArea !=null and floorArea != ''">
+   and t.floor_area= #{floorArea}
+</if> 
+order by t.create_time desc
+<if test="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改楼栋信息 add by wuxw 2018-07-03 -->
+    <update id="updateFloorInfo" parameterType="Map">
+        update  f_floor t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="name !=null and name != ''">
+, t.name= #{name}
+</if> 
+<if test="remark !=null and remark != ''">
+, t.remark= #{remark}
+</if> 
+<if test="communityId !=null and communityId != ''">
+, t.community_id= #{communityId}
+</if> 
+<if test="userId !=null and userId != ''">
+, t.user_id= #{userId}
+</if> 
+<if test="floorNum !=null and floorNum != ''">
+, t.floor_num= #{floorNum}
+</if> 
+<if test="floorArea !=null and floorArea != ''">
+, t.floor_area= #{floorArea}
+</if> 
+ where 1=1 <if test="floorId !=null and floorId != ''">
+and t.floor_id= #{floorId}
+</if> 
+<if test="bId !=null and bId != ''">
+and t.b_id= #{bId}
+</if> 
+
+    </update>
+
+    <!-- 查询楼栋数量 add by wuxw 2018-07-03 -->
+     <select id="queryFloorsCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from f_floor t 
+where 1 =1 
+<if test="floorId !=null and floorId != ''">
+   and t.floor_id= #{floorId}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="remark !=null and remark != ''">
+   and t.remark= #{remark}
+</if> 
+<if test="bId !=null and bId != ''">
+   and t.b_id= #{bId}
+</if> 
+<if test="communityId !=null and communityId != ''">
+   and t.community_id= #{communityId}
+</if> 
+<if test="userId !=null and userId != ''">
+   and t.user_id= #{userId}
+</if> 
+<if test="floorNum !=null and floorNum != ''">
+   and t.floor_num= #{floorNum}
+</if> 
+<if test="floorArea !=null and floorArea != ''">
+   and t.floor_area= #{floorArea}
+</if> 
+
+
+     </select>
+
+</mapper>

+ 1 - 1
java110-generator/src/main/java/com/java110/code/newBack/BackCoderGeneratorStart.java

@@ -70,7 +70,7 @@ public class BackCoderGeneratorStart extends BaseGenerator {
         generatorInnerServiceSMOImpl.generator(data);
 
         GeneratorDtoBean generatorDtoBean = new GeneratorDtoBean();
-        generatorDtoBean.generator(data);
+        //generatorDtoBean.generator(data);
 
         GeneratorIInnerServiceSMO generatorIInnerServiceSMO = new GeneratorIInnerServiceSMO();
         generatorIInnerServiceSMO.generator(data);

+ 1 - 1
java110-generator/src/main/java/com/java110/code/newBack/GeneratorApiListener.java

@@ -14,7 +14,7 @@ public class GeneratorApiListener extends BaseGenerator {
      * @param data
      */
     public void generator(Data data) throws Exception {
-        genneratorPo(data);             //API DataVo对象
+        //genneratorPo(data);             //API DataVo对象
         genneratorSaveCmd(data);            //Api BmoImpl
         genneratorUpdateBmoImpl(data);            //Api BmoImpl
         genneratorDeleteBmoImpl(data);            //Api BmoImpl

+ 33 - 22
java110-generator/src/main/resources/newBack/template_1.json

@@ -1,38 +1,49 @@
 {
   "autoMove": true,
-  "id": "userId",
-  "name": "user",
-  "desc": "用户",
-  "shareParam": "userId",
-  "shareColumn": "user_id",
-  "shareName": "user",
-  "tableName": "u_user",
+  "id": "floorId",
+  "name": "floor",
+  "desc": "楼栋",
+  "shareParam": "floorId",
+  "shareColumn": "floor_id",
+  "shareName": "community",
+  "tableName": "f_floor",
   "param": {
-    "userId": "user_id",
-    "name": "name",
-    "email": "email",
-    "address": "address",
-    "password": "password",
-    "locationCd": "location_cd",
-    "age": "age",
-    "sex": "sex",
-    "tel": "tel",
-    "levelCd": "level_cd",
+    "floorId": "floor_id",
     "bId": "b_id",
-    "score": "score",
-    "statusCd": "status_cd"
+    "floorNum": "floor_num",
+    "name": "name",
+    "userId": "user_id",
+    "remark": "remark",
+    "communityId": "community_id",
+    "floorArea": "floor_area"
   },
   "required": [
     {
-      "code": "name",
+      "code": "floorId",
       "msg": "用户名称不能为空"
     },
     {
-      "code": "password",
+      "code": "bId",
       "msg": "密码不能为空"
     },
     {
-      "code": "tel",
+      "code": "floorNum",
+      "msg": "手机号不能为空"
+    },
+    {
+      "code": "name",
+      "msg": "手机号不能为空"
+    },
+    {
+      "code": "userId",
+      "msg": "手机号不能为空"
+    },
+    {
+      "code": "communityId",
+      "msg": "手机号不能为空"
+    },
+    {
+      "code": "floorArea",
       "msg": "手机号不能为空"
     }
   ]

+ 68 - 0
java110-interface/src/main/java/com/java110/intf/community/IFloorV1InnerServiceSMO.java

@@ -0,0 +1,68 @@
+/*
+ * 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.intf.community;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.FloorDto;
+import com.java110.po.floor.FloorPo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+/**
+ * 类表述: 服务之前调用的接口类,不对外提供接口能力 只用于接口建调用
+ * add by 吴学文 at 2021-09-13 16:41:17 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行
+ */
+@FeignClient(name = "community-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/floorV1Api")
+public interface IFloorV1InnerServiceSMO {
+
+
+    @RequestMapping(value = "/saveFloor", method = RequestMethod.POST)
+    public int saveFloor(@RequestBody  FloorPo floorPo);
+
+    @RequestMapping(value = "/updateFloor", method = RequestMethod.POST)
+    public int updateFloor(@RequestBody  FloorPo floorPo);
+
+    @RequestMapping(value = "/deleteFloor", method = RequestMethod.POST)
+    public int deleteFloor(@RequestBody  FloorPo floorPo);
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param floorDto 数据对象分享
+     * @return FloorDto 对象数据
+     */
+    @RequestMapping(value = "/queryFloors", method = RequestMethod.POST)
+    List<FloorDto> queryFloors(@RequestBody FloorDto floorDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param floorDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryFloorsCount", method = RequestMethod.POST)
+    int queryFloorsCount(@RequestBody FloorDto floorDto);
+}

+ 72 - 0
service-community/src/main/java/com/java110/community/cmd/floor/DeleteFloorCmd.java

@@ -0,0 +1,72 @@
+/*
+ * 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.floor;
+
+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.core.factory.GenerateCodeFactory;
+import com.java110.intf.community.IFloorV1InnerServiceSMO;
+import com.java110.po.floor.FloorPo;
+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.springframework.beans.factory.annotation.Autowired;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 类表述:删除
+ * 服务编码:floor.deleteFloor
+ * 请求路劲:/app/floor.DeleteFloor
+ * add by 吴学文 at 2021-09-13 16:41:17 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 = "floor.deleteFloorV1")
+public class DeleteFloorCmd extends AbstractServiceCmdListener {
+    private static Logger logger = LoggerFactory.getLogger(DeleteFloorCmd.class);
+
+    @Autowired
+    private IFloorV1InnerServiceSMO floorV1InnerServiceSMOImpl;
+
+    @Override
+    protected void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "floorId", "floorId不能为空");
+        Assert.hasKeyAndValue(reqJson, "floorId", "floorId不能为空");
+
+    }
+
+    @Override
+    @Java110Transactional
+    protected void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        FloorPo floorPo = BeanConvertUtil.covertBean(reqJson, FloorPo.class);
+        int flag = floorV1InnerServiceSMOImpl.deleteFloor(floorPo);
+
+        if (flag < 1) {
+            throw new CmdException("删除数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 87 - 0
service-community/src/main/java/com/java110/community/cmd/floor/ListFloorCmd.java

@@ -0,0 +1,87 @@
+/*
+ * 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.floor;
+
+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.core.factory.GenerateCodeFactory;
+import com.java110.dto.FloorDto;
+import com.java110.intf.community.IFloorV1InnerServiceSMO;
+import com.java110.po.floor.FloorPo;
+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.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.HttpStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * 类表述:查询
+ * 服务编码:floor.listFloor
+ * 请求路劲:/app/floor.ListFloor
+ * add by 吴学文 at 2021-09-13 16:41:17 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 = "floor.listFloorV1")
+public class ListFloorCmd extends AbstractServiceCmdListener {
+
+    private static Logger logger = LoggerFactory.getLogger(ListFloorCmd.class);
+    @Autowired
+    private IFloorV1InnerServiceSMO floorV1InnerServiceSMOImpl;
+
+    @Override
+    protected void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    @Java110Transactional
+    protected void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        FloorDto floorDto = BeanConvertUtil.covertBean(reqJson, FloorDto.class);
+
+        int count = floorV1InnerServiceSMOImpl.queryFloorsCount(floorDto);
+
+        List<FloorDto> floorDtos = null;
+
+        if (count > 0) {
+            floorDtos = floorV1InnerServiceSMOImpl.queryFloors(floorDto);
+        } else {
+            floorDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, floorDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        cmdDataFlowContext.setResponseEntity(responseEntity);
+    }
+}

+ 81 - 0
service-community/src/main/java/com/java110/community/cmd/floor/SaveFloorCmd.java

@@ -0,0 +1,81 @@
+/*
+ * 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.floor;
+
+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.core.factory.GenerateCodeFactory;
+import com.java110.intf.community.IFloorV1InnerServiceSMO;
+import com.java110.po.floor.FloorPo;
+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.springframework.beans.factory.annotation.Autowired;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 类表述:保存
+ * 服务编码:floor.saveFloor
+ * 请求路劲:/app/floor.SaveFloor
+ * add by 吴学文 at 2021-09-13 16:41:17 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 = "floor.saveFloorV1")
+public class SaveFloorCmd extends AbstractServiceCmdListener {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveFloorCmd.class);
+
+    public static final String CODE_PREFIX_ID = "10";
+
+    @Autowired
+    private IFloorV1InnerServiceSMO floorV1InnerServiceSMOImpl;
+
+    @Override
+    protected void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "floorId", "请求报文中未包含floorId");
+        Assert.hasKeyAndValue(reqJson, "bId", "请求报文中未包含bId");
+        Assert.hasKeyAndValue(reqJson, "floorNum", "请求报文中未包含floorNum");
+        Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name");
+        Assert.hasKeyAndValue(reqJson, "userId", "请求报文中未包含userId");
+        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
+        Assert.hasKeyAndValue(reqJson, "floorArea", "请求报文中未包含floorArea");
+
+    }
+
+    @Override
+    @Java110Transactional
+    protected void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        FloorPo floorPo = BeanConvertUtil.covertBean(reqJson, FloorPo.class);
+        floorPo.setFloorId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+        int flag = floorV1InnerServiceSMOImpl.saveFloor(floorPo);
+
+        if (flag < 1) {
+            throw new CmdException("保存数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 75 - 0
service-community/src/main/java/com/java110/community/cmd/floor/UpdateFloorCmd.java

@@ -0,0 +1,75 @@
+/*
+ * 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.floor;
+
+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.core.factory.GenerateCodeFactory;
+import com.java110.intf.community.IFloorV1InnerServiceSMO;
+import com.java110.po.floor.FloorPo;
+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.springframework.beans.factory.annotation.Autowired;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * 类表述:更新
+ * 服务编码:floor.updateFloor
+ * 请求路劲:/app/floor.UpdateFloor
+ * add by 吴学文 at 2021-09-13 16:41:17 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 = "floor.updateFloorV1")
+public class UpdateFloorCmd extends AbstractServiceCmdListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateFloorCmd.class);
+
+
+    @Autowired
+    private IFloorV1InnerServiceSMO floorV1InnerServiceSMOImpl;
+
+    @Override
+    protected void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "floorId", "floorId不能为空");
+        Assert.hasKeyAndValue(reqJson, "floorId", "floorId不能为空");
+
+    }
+
+    @Override
+    @Java110Transactional
+    protected void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        FloorPo floorPo = BeanConvertUtil.covertBean(reqJson, FloorPo.class);
+        int flag = floorV1InnerServiceSMOImpl.updateFloor(floorPo);
+
+        if (flag < 1) {
+            throw new CmdException("更新数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 77 - 0
service-community/src/main/java/com/java110/community/dao/IFloorV1ServiceDao.java

@@ -0,0 +1,77 @@
+/*
+ * 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.dao;
+
+
+import com.java110.utils.exception.DAOException;
+import com.java110.entity.merchant.BoMerchant;
+import com.java110.entity.merchant.BoMerchantAttr;
+import com.java110.entity.merchant.Merchant;
+import com.java110.entity.merchant.MerchantAttr;
+
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2021-09-13 16:41:17 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行
+ */
+public interface IFloorV1ServiceDao {
+
+
+    /**
+     * 保存 楼栋信息
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    int saveFloorInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询楼栋信息(instance过程)
+     * 根据bId 查询楼栋信息
+     * @param info bId 信息
+     * @return 楼栋信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getFloorInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改楼栋信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    int updateFloorInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询楼栋总数
+     *
+     * @param info 楼栋信息
+     * @return 楼栋数量
+     */
+    int queryFloorsCount(Map info);
+
+}

+ 112 - 0
service-community/src/main/java/com/java110/community/dao/impl/FloorV1ServiceDaoImpl.java

@@ -0,0 +1,112 @@
+/*
+ * 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.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.community.dao.IFloorV1ServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2021-09-13 16:41:17 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行
+ */
+@Service("floorV1ServiceDaoImpl")
+public class FloorV1ServiceDaoImpl extends BaseServiceDao implements IFloorV1ServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(FloorV1ServiceDaoImpl.class);
+
+
+
+
+
+    /**
+     * 保存楼栋信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int saveFloorInfo(Map info) throws DAOException {
+        logger.debug("保存 saveFloorInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("floorV1ServiceDaoImpl.saveFloorInfo",info);
+
+        return saveFlag;
+    }
+
+
+    /**
+     * 查询楼栋信息(instance)
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getFloorInfo(Map info) throws DAOException {
+        logger.debug("查询 getFloorInfo 入参 info : {}",info);
+
+        List<Map> businessFloorInfos = sqlSessionTemplate.selectList("floorV1ServiceDaoImpl.getFloorInfo",info);
+
+        return businessFloorInfos;
+    }
+
+
+    /**
+     * 修改楼栋信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int updateFloorInfo(Map info) throws DAOException {
+        logger.debug("修改 updateFloorInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("floorV1ServiceDaoImpl.updateFloorInfo",info);
+
+        return saveFlag;
+    }
+
+     /**
+     * 查询楼栋数量
+     * @param info 楼栋信息
+     * @return 楼栋数量
+     */
+    @Override
+    public int queryFloorsCount(Map info) {
+        logger.debug("查询 queryFloorsCount 入参 info : {}",info);
+
+        List<Map> businessFloorInfos = sqlSessionTemplate.selectList("floorV1ServiceDaoImpl.queryFloorsCount", info);
+        if (businessFloorInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessFloorInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 89 - 0
service-community/src/main/java/com/java110/community/smo/impl/FloorV1InnerServiceSMOImpl.java

@@ -0,0 +1,89 @@
+/*
+ * 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.smo.impl;
+
+
+import com.java110.community.dao.IFloorV1ServiceDao;
+import com.java110.dto.FloorDto;
+import com.java110.intf.community.IFloorV1InnerServiceSMO;
+import com.java110.po.floor.FloorPo;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.user.UserDto;
+import com.java110.dto.PageDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 类表述: 服务之前调用的接口实现类,不对外提供接口能力 只用于接口建调用
+ * add by 吴学文 at 2021-09-13 16:41:17 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行
+ */
+@RestController
+public class FloorV1InnerServiceSMOImpl extends BaseServiceSMO implements IFloorV1InnerServiceSMO {
+
+    @Autowired
+    private IFloorV1ServiceDao floorV1ServiceDaoImpl;
+
+
+    @Override
+    public int saveFloor(@RequestBody  FloorPo floorPo) {
+        int saveFlag = floorV1ServiceDaoImpl.saveFloorInfo(BeanConvertUtil.beanCovertMap(floorPo));
+        return saveFlag;
+    }
+
+     @Override
+    public int updateFloor(@RequestBody  FloorPo floorPo) {
+        int saveFlag = floorV1ServiceDaoImpl.updateFloorInfo(BeanConvertUtil.beanCovertMap(floorPo));
+        return saveFlag;
+    }
+
+     @Override
+    public int deleteFloor(@RequestBody  FloorPo floorPo) {
+       floorPo.setStatusCd("1");
+       int saveFlag = floorV1ServiceDaoImpl.updateFloorInfo(BeanConvertUtil.beanCovertMap(floorPo));
+       return saveFlag;
+    }
+
+    @Override
+    public List<FloorDto> queryFloors(@RequestBody  FloorDto floorDto) {
+
+        //校验是否传了 分页信息
+
+        int page = floorDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            floorDto.setPage((page - 1) * floorDto.getRow());
+        }
+
+        List<FloorDto> floors = BeanConvertUtil.covertBeanList(floorV1ServiceDaoImpl.getFloorInfo(BeanConvertUtil.beanCovertMap(floorDto)), FloorDto.class);
+
+        return floors;
+    }
+
+
+    @Override
+    public int queryFloorsCount(@RequestBody FloorDto floorDto) {
+        return floorV1ServiceDaoImpl.queryFloorsCount(BeanConvertUtil.beanCovertMap(floorDto));    }
+
+}