Procházet zdrojové kódy

加入巡检项目功能

java110 před 4 roky
rodič
revize
1bc979c2ce

+ 64 - 68
java110-db/src/main/resources/mapper/community/InspectionItemV1ServiceDaoImplMapper.xml

@@ -5,93 +5,89 @@
 <mapper namespace="inspectionItemV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存巡检项目信息 add by wuxw 2018-07-03 -->
     <insert id="saveInspectionItemInfo" parameterType="Map">
         insert into inspection_item(
-item_id,item_name,remark,community_id
-) values (
-#{itemId},#{itemName},#{remark},#{communityId}
-)
+        item_id,item_name,remark,community_id
+        ) values (
+        #{itemId},#{itemName},#{remark},#{communityId}
+        )
     </insert>
 
 
-
     <!-- 查询巡检项目信息 add by wuxw 2018-07-03 -->
     <select id="getInspectionItemInfo" parameterType="Map" resultType="Map">
-        select  t.item_id,t.item_id itemId,t.item_name,t.item_name itemName,t.remark,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId 
-from inspection_item t 
-where 1 =1 
-<if test="itemId !=null and itemId != ''">
-   and t.item_id= #{itemId}
-</if> 
-<if test="itemName !=null and itemName != ''">
-   and t.item_name= #{itemName}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.item_id,t.item_id itemId,t.item_name,t.item_name itemName,t.remark,t.status_cd,t.status_cd
+        statusCd,t.community_id,t.community_id communityId,t.create_time createTime
+        from inspection_item t
+        where 1 =1
+        <if test="itemId !=null and itemId != ''">
+            and t.item_id= #{itemId}
+        </if>
+        <if test="itemName !=null and itemName != ''">
+            and t.item_name= #{itemName}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </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="updateInspectionItemInfo" parameterType="Map">
-        update  inspection_item t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="itemName !=null and itemName != ''">
-, t.item_name= #{itemName}
-</if> 
-<if test="remark !=null and remark != ''">
-, t.remark= #{remark}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
- where 1=1 <if test="itemId !=null and itemId != ''">
-and t.item_id= #{itemId}
-</if> 
+        update inspection_item t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="itemName !=null and itemName != ''">
+            , t.item_name= #{itemName}
+        </if>
+        <if test="remark !=null and remark != ''">
+            , t.remark= #{remark}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        where 1=1
+        <if test="itemId !=null and itemId != ''">
+            and t.item_id= #{itemId}
+        </if>
 
     </update>
 
     <!-- 查询巡检项目数量 add by wuxw 2018-07-03 -->
-     <select id="queryInspectionItemsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from inspection_item t 
-where 1 =1 
-<if test="itemId !=null and itemId != ''">
-   and t.item_id= #{itemId}
-</if> 
-<if test="itemName !=null and itemName != ''">
-   and t.item_name= #{itemName}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
+    <select id="queryInspectionItemsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from inspection_item t
+        where 1 =1
+        <if test="itemId !=null and itemId != ''">
+            and t.item_id= #{itemId}
+        </if>
+        <if test="itemName !=null and itemName != ''">
+            and t.item_name= #{itemName}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 10 - 11
java110-generator/src/main/java/com/java110/code/TableToJsonWeb.java

@@ -7,21 +7,20 @@ import com.java110.utils.util.StringUtil;
 public class TableToJsonWeb {
 
     //show create table c_orders  用这个语句获取
-    public static final String createTableSql = "CREATE TABLE `s_store` (\n" +
-            "  `store_id` varchar(30) NOT NULL COMMENT '商店ID',\n" +
-            "  `name` varchar(100) NOT NULL COMMENT '名称',\n" +
-            "  `address` varchar(200) NOT NULL COMMENT '地址',\n" +
-            "  `tel` varchar(11) NOT NULL COMMENT '电话',\n" +
-            "  `nearby_landmarks` varchar(200) DEFAULT NULL COMMENT '地标',\n" +
+    public static final String createTableSql = "CREATE TABLE `inspection_item` (\n" +
+            "  `item_id` varchar(30) NOT NULL COMMENT '主键ID',\n" +
+            "  `item_name` varchar(256) NOT NULL COMMENT '巡检项目',\n" +
+            "  `community_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '小区ID',\n" +
+            "  `remark` varchar(512) DEFAULT NULL COMMENT '备注',\n" +
             ")";
     public static void main(String[] args) {
-        String templateName = "物业公司"; //业务名称
-        String templateCode = "propertyCompany"; //表名大写
-        String templateKey = "storeId"; //表主键
+        String templateName = "巡检项目"; //业务名称
+        String templateCode = "inspectionItem"; //表名大写
+        String templateKey = "itemId"; //表主键
         String templateKeyName = "编号";//主键说明
-        String searchCode = "storeId"; //分片字段
+        String searchCode = "itemId"; //分片字段
         String searchName = "编号"; //分片字段说明
-        String directories = "admin"; //前端生成到那个目录下
+        String directories = "property"; //前端生成到那个目录下
         // templateName 业务名称 业务编码名称生成后文件名 templateCode 主键 templateKey
         // 业务主键名称 templateKeyName=templateName+ID 主机驼峰 searchCode 主键名称 searchName
         // directories 放在前端那个目录下

+ 22 - 70
java110-generator/src/main/resources/web/template_1.json

@@ -1,103 +1,55 @@
 {
   "templateKeyName": "编号",
-  "templateName": "物业公司",
+  "templateName": "巡检项目",
   "columns": [
     {
       "hasDefaultValue": false,
-      "limitParam": "100",
-      "code": "name",
-      "limitErrInfo": "名称不能超过100",
-      "cnCode": "名称",
+      "limitParam": "256",
+      "code": "itemName",
+      "limitErrInfo": "巡检项目不能超过256",
+      "cnCode": "巡检项目",
       "limit": "maxLength",
       "show": true,
       "inputType": "input",
       "required": true,
-      "desc": "必填,名称"
+      "desc": "必填,巡检项目"
     },
     {
       "hasDefaultValue": false,
-      "limitParam": "200",
-      "code": "address",
-      "limitErrInfo": "地址不能超过200",
-      "cnCode": "地址",
+      "limitParam": "512",
+      "code": "remark",
+      "limitErrInfo": "备注不能超过512",
+      "cnCode": "备注",
       "limit": "maxLength",
       "show": true,
       "inputType": "input",
       "required": true,
-      "desc": "必填,地址"
-    },
-    {
-      "hasDefaultValue": false,
-      "limitParam": "11",
-      "code": "tel",
-      "limitErrInfo": "电话不能超过11",
-      "cnCode": "电话",
-      "limit": "maxLength",
-      "show": true,
-      "inputType": "input",
-      "required": true,
-      "desc": "必填,电话"
-    },
-    {
-      "hasDefaultValue": false,
-      "limitParam": "64",
-      "code": "corporation",
-      "limitErrInfo": "公司法人不能空",
-      "cnCode": "公司法人",
-      "limit": "maxLength",
-      "show": true,
-      "inputType": "input",
-      "required": true,
-      "desc": "必填,公司法人"
-    },
-    {
-      "hasDefaultValue": false,
-      "limitParam": "64",
-      "code": "foundingTime",
-      "limitErrInfo": "成立日期不能空",
-      "cnCode": "成立日期",
-      "limit": "maxLength",
-      "show": true,
-      "inputType": "input",
-      "required": true,
-      "desc": "必填,成立日期"
-    },
-    {
-      "hasDefaultValue": false,
-      "limitParam": "200",
-      "code": "nearbyLandmarks",
-      "limitErrInfo": "地标不能超过200",
-      "cnCode": "地标",
-      "limit": "maxLength",
-      "show": true,
-      "inputType": "input",
-      "required": true,
-      "desc": "地标"
+      "desc": "备注"
     }
   ],
   "searchName": "编号",
-  "directories": "admin",
-  "searchCode": "storeId",
-  "templateCode": "propertyCompany",
+  "directories": "property",
+  "searchCode": "itemId",
+  "templateCode": "inspectionItem",
   "conditions": [
     {
       "whereCondition": "equal",
-      "code": "storeId",
-      "name": "物业编号",
+      "code": "itemId",
+      "name": "主键ID",
       "inputType": "input"
     },
     {
       "whereCondition": "equal",
-      "code": "name",
-      "name": "名称",
+      "code": "itemName",
+      "name": "巡检项目",
       "inputType": "input"
     },
     {
       "whereCondition": "equal",
-      "code": "tel",
-      "name": "电话",
+      "code": "communityId",
+      "name": "小区ID",
       "inputType": "input"
     }
   ],
-  "templateKey": "storeId"
-}
+  "templateKey": "itemId"
+}

+ 5 - 5
service-community/src/main/java/com/java110/community/cmd/inspectionItem/DeleteInspectionItemCmd.java

@@ -21,16 +21,16 @@ 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.IInspectionItemV1InnerServiceSMO;
 import com.java110.po.inspectionItem.InspectionItemPo;
 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;
+import org.springframework.beans.factory.annotation.Autowired;
+
 /**
  * 类表述:删除
  * 服务编码:inspectionItem.deleteInspectionItem
@@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory;
  */
 @Java110Cmd(serviceCode = "inspectionItem.deleteInspectionItem")
 public class DeleteInspectionItemCmd extends AbstractServiceCmdListener {
-  private static Logger logger = LoggerFactory.getLogger(DeleteInspectionItemCmd.class);
+    private static Logger logger = LoggerFactory.getLogger(DeleteInspectionItemCmd.class);
 
     @Autowired
     private IInspectionItemV1InnerServiceSMO inspectionItemV1InnerServiceSMOImpl;
@@ -51,7 +51,7 @@ public class DeleteInspectionItemCmd extends AbstractServiceCmdListener {
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "itemId", "itemId不能为空");
-Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
+        Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
 
     }
 
@@ -59,7 +59,7 @@ Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
-       InspectionItemPo inspectionItemPo = BeanConvertUtil.covertBean(reqJson, InspectionItemPo.class);
+        InspectionItemPo inspectionItemPo = BeanConvertUtil.covertBean(reqJson, InspectionItemPo.class);
         int flag = inspectionItemV1InnerServiceSMOImpl.deleteInspectionItem(inspectionItemPo);
 
         if (flag < 1) {

+ 3 - 3
service-community/src/main/java/com/java110/community/cmd/inspectionItem/SaveInspectionItemCmd.java

@@ -28,9 +28,9 @@ 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;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * 类表述:保存
@@ -55,7 +55,7 @@ public class SaveInspectionItemCmd extends AbstractServiceCmdListener {
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "itemName", "请求报文中未包含itemName");
-Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
+        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
 
     }
 
@@ -63,7 +63,7 @@ Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含community
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
-       InspectionItemPo inspectionItemPo = BeanConvertUtil.covertBean(reqJson, InspectionItemPo.class);
+        InspectionItemPo inspectionItemPo = BeanConvertUtil.covertBean(reqJson, InspectionItemPo.class);
         inspectionItemPo.setItemId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
         int flag = inspectionItemV1InnerServiceSMOImpl.saveInspectionItem(inspectionItemPo);
 

+ 4 - 5
service-community/src/main/java/com/java110/community/cmd/inspectionItem/UpdateInspectionItemCmd.java

@@ -21,16 +21,15 @@ 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.IInspectionItemV1InnerServiceSMO;
 import com.java110.po.inspectionItem.InspectionItemPo;
 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;
+import org.springframework.beans.factory.annotation.Autowired;
 
 
 /**
@@ -46,7 +45,7 @@ import org.slf4j.LoggerFactory;
 @Java110Cmd(serviceCode = "inspectionItem.updateInspectionItem")
 public class UpdateInspectionItemCmd extends AbstractServiceCmdListener {
 
-  private static Logger logger = LoggerFactory.getLogger(UpdateInspectionItemCmd.class);
+    private static Logger logger = LoggerFactory.getLogger(UpdateInspectionItemCmd.class);
 
 
     @Autowired
@@ -55,7 +54,7 @@ public class UpdateInspectionItemCmd extends AbstractServiceCmdListener {
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "itemId", "itemId不能为空");
-Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
+        Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
 
     }
 
@@ -63,7 +62,7 @@ Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
-       InspectionItemPo inspectionItemPo = BeanConvertUtil.covertBean(reqJson, InspectionItemPo.class);
+        InspectionItemPo inspectionItemPo = BeanConvertUtil.covertBean(reqJson, InspectionItemPo.class);
         int flag = inspectionItemV1InnerServiceSMOImpl.updateInspectionItem(inspectionItemPo);
 
         if (flag < 1) {