Browse Source

分区多标签

lv.wenbin 11 months ago
parent
commit
1967595567

+ 86 - 55
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaBuildingZoning.java

@@ -1,75 +1,101 @@
 package com.ruoyi.ems.domain;
 
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.core.annotation.Excel;
 import com.ruoyi.common.core.web.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.List;
 
 /**
  * 建筑区域划分对象 adm_area_building_zoning
- * 
+ *
  * @author ruoyi
  * @date 2024-07-09
  */
-public class AreaBuildingZoning extends BaseEntity
-{
+public class AreaBuildingZoning extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 序号 */
+    /**
+     * 序号
+     */
     private Long id;
 
-    /** 建筑编码 */
+    /**
+     * 建筑编码
+     */
     @Excel(name = "建筑编码")
     private String bldgCode;
 
     @Excel(name = "建筑名称")
     private String bldgName;
 
-    /** 分区编码 */
+    /**
+     * 分区编码
+     */
     @Excel(name = "分区编码")
     private String zoningCode;
 
-    /** 分区名称 */
+    /**
+     * 分区名称
+     */
     @Excel(name = "分区名称")
     private String zoningName;
 
-    /** 楼层 */
+    /**
+     * 楼层
+     */
     @Excel(name = "楼层")
     private Long floor;
 
-    /** 建筑划分面积 */
+    /**
+     * 建筑划分面积
+     */
     @Excel(name = "建筑划分面积")
     private Long bldgLdArea;
 
-    /** 使用详情 */
+    /**
+     * 使用详情
+     */
     @Excel(name = "使用详情")
     private String usageDetail;
 
-    /** 标签代码 */
-    private String tagCode;
+    /** 区域编码 */
+    private String areaCode;
 
-    /** 标签名称 */
-    private String tagName;
+    /**
+     * 标签代码
+     */
+    private List<String> tagCodeList;
 
-    /** 区域路径 **/
+    /**
+     * 标签名称
+     */
+    private String tagCodes;
+
+    /**
+     * 标签名称
+     */
+    private String tagNames;
+
+    /**
+     * 区域路径
+     **/
     private String areaPath;
 
-    public void setId(Long id) 
-    {
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId() 
-    {
+    public Long getId() {
         return id;
     }
-    public void setBldgCode(String bldgCode) 
-    {
+
+    public void setBldgCode(String bldgCode) {
         this.bldgCode = bldgCode;
     }
 
-    public String getBldgCode() 
-    {
+    public String getBldgCode() {
         return bldgCode;
     }
 
@@ -97,49 +123,60 @@ public class AreaBuildingZoning extends BaseEntity
         this.zoningName = zoningName;
     }
 
-    public void setFloor(Long floor)
-    {
+    public void setFloor(Long floor) {
         this.floor = floor;
     }
 
-    public Long getFloor() 
-    {
+    public Long getFloor() {
         return floor;
     }
 
-    public void setBldgLdArea(Long bldgLdArea) 
-    {
+    public void setBldgLdArea(Long bldgLdArea) {
         this.bldgLdArea = bldgLdArea;
     }
 
-    public Long getBldgLdArea() 
-    {
+    public Long getBldgLdArea() {
         return bldgLdArea;
     }
-    public void setUsageDetail(String usageDetail) 
-    {
+
+    public void setUsageDetail(String usageDetail) {
         this.usageDetail = usageDetail;
     }
 
-    public String getUsageDetail() 
-    {
+    public String getUsageDetail() {
         return usageDetail;
     }
 
-    public String getTagCode() {
-        return tagCode;
+    public List<String> getTagCodeList() {
+        return tagCodeList;
+    }
+
+    public void setTagCodeList(List<String> tagCodeList) {
+        this.tagCodeList = tagCodeList;
+    }
+
+    public String getTagCodes() {
+        return tagCodes;
+    }
+
+    public void setTagCodes(String tagCodes) {
+        this.tagCodes = tagCodes;
+    }
+
+    public String getTagNames() {
+        return tagNames;
     }
 
-    public void setTagCode(String tagCode) {
-        this.tagCode = tagCode;
+    public void setTagNames(String tagNames) {
+        this.tagNames = tagNames;
     }
 
-    public String getTagName() {
-        return tagName;
+    public String getAreaCode() {
+        return areaCode;
     }
 
-    public void setTagName(String tagName) {
-        this.tagName = tagName;
+    public void setAreaCode(String areaCode) {
+        this.areaCode = areaCode;
     }
 
     public String getAreaPath() {
@@ -152,16 +189,10 @@ public class AreaBuildingZoning extends BaseEntity
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("bldgCode", getBldgCode())
-            .append("zoningCode", getZoningCode())
-            .append("zoningName", getZoningName())
-            .append("floor", getFloor())
-            .append("bldgLdArea", getBldgLdArea())
-            .append("usageDetail", getUsageDetail())
-            .append("tagCode", getTagCode())
-            .append("tagName", getTagName())
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId())
+            .append("bldgCode", getBldgCode()).append("zoningCode", getZoningCode())
+            .append("zoningName", getZoningName()).append("floor", getFloor()).append("bldgLdArea", getBldgLdArea())
+            .append("usageDetail", getUsageDetail()).append("tagCodes", getTagCodes()).append("tagNames", getTagNames())
             .toString();
     }
 }

+ 25 - 1
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/CoChargingConfig.java

@@ -22,9 +22,15 @@ public class CoChargingConfig extends BaseEntity
     private Long id;
 
     /** 服务区代码 */
-    @Excel(name = "服务区代码")
     private String areaCode;
 
+    /** 服务区名称 */
+    @Excel(name = "服务区")
+    private String areaName;
+
+    /** 服务区简称 */
+    private String areaShortName;
+
     /** 电计量单价 1度 */
     @Excel(name = "电计量单价")
     private Long elecUnitPrice;
@@ -69,6 +75,23 @@ public class CoChargingConfig extends BaseEntity
     {
         return areaCode;
     }
+
+    public String getAreaName() {
+        return areaName;
+    }
+
+    public void setAreaName(String areaName) {
+        this.areaName = areaName;
+    }
+
+    public String getAreaShortName() {
+        return areaShortName;
+    }
+
+    public void setAreaShortName(String areaShortName) {
+        this.areaShortName = areaShortName;
+    }
+
     public void setElecUnitPrice(Long elecUnitPrice)
     {
         this.elecUnitPrice = elecUnitPrice;
@@ -137,6 +160,7 @@ public class CoChargingConfig extends BaseEntity
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
             .append("id", getId())
             .append("areaCode", getAreaCode())
+            .append("areaName", getAreaName())
             .append("elecUnitPrice", getElecUnitPrice())
             .append("elecGtComputeType", getElecGtComputeType())
             .append("elecComputeDesc", getElecComputeDesc())

+ 73 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ObjTagRel.java

@@ -0,0 +1,73 @@
+package com.ruoyi.ems.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.core.annotation.Excel;
+import com.ruoyi.common.core.web.domain.BaseEntity;
+
+/**
+ * 对象&标签关系对象 adm_obj_tag_rel
+ * 
+ * @author ruoyi
+ * @date 2024-08-27
+ */
+public class ObjTagRel
+{
+    /** 标签类型 */
+    @Excel(name = "标签类型")
+    private Integer tagType;
+
+    /** 标签代码 */
+    @Excel(name = "标签代码")
+    private String tagCode;
+
+    /** 对象代码 */
+    @Excel(name = "对象代码")
+    private String objCode;
+
+    public ObjTagRel(){
+    }
+
+    public ObjTagRel(Integer tagType, String tagCode, String objCode) {
+        this.tagType = tagType;
+        this.tagCode = tagCode;
+        this.objCode = objCode;
+    }
+
+    public void setTagType(Integer tagType)
+    {
+        this.tagType = tagType;
+    }
+
+    public Integer getTagType()
+    {
+        return tagType;
+    }
+    public void setTagCode(String tagCode) 
+    {
+        this.tagCode = tagCode;
+    }
+
+    public String getTagCode() 
+    {
+        return tagCode;
+    }
+    public void setObjCode(String objCode) 
+    {
+        this.objCode = objCode;
+    }
+
+    public String getObjCode() 
+    {
+        return objCode;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("tagType", getTagType())
+            .append("tagCode", getTagCode())
+            .append("objCode", getObjCode())
+            .toString();
+    }
+}

+ 65 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ObjTagRelMapper.java

@@ -0,0 +1,65 @@
+package com.ruoyi.ems.mapper;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.ObjTagRel;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 对象&标签关系Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-08-27
+ */
+public interface ObjTagRelMapper {
+    /**
+     * 查询对象&标签关系列表
+     *
+     * @param tagType 标签类型
+     * @return 对象&标签关系集合
+     */
+    List<ObjTagRel> selectListByType(int tagType);
+
+    /**
+     * 新增对象&标签关系
+     *
+     * @param tagType 标签类型
+     * @param tagCode 标签代码
+     * @return 结果
+     */
+    List<ObjTagRel> selectListByTagCode(@Param("tagType") int tagType, @Param("tagCode") String tagCode);
+
+    /**
+     * 新增对象&标签关系
+     *
+     * @param tagType 标签类型
+     * @param objCode 标签代码
+     * @return 结果
+     */
+    List<ObjTagRel> selectListByObjCode(@Param("tagType") int tagType, @Param("objCode") String objCode);
+
+    /**
+     * 批量插入
+     *
+     * @param list 对象&标签关系
+     * @return 结果
+     */
+    int insertBatch(List<ObjTagRel> list);
+
+    /**
+     * 删除对象&标签关系
+     *
+     * @param tagType 标签类型
+     * @param objCode 对象代码
+     * @return 结果
+     */
+    int deleteByObjCode(@Param("tagType") int tagType, @Param("objCode") String objCode);
+
+    /**
+     * 删除对象&标签关系
+     *
+     * @param tagCode 标签代码
+     * @return 结果
+     */
+    int deleteByTagCode(String tagCode);
+}

+ 65 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IObjTagRelService.java

@@ -0,0 +1,65 @@
+package com.ruoyi.ems.service;
+
+import com.ruoyi.ems.domain.ObjTagRel;
+
+import java.util.List;
+
+/**
+ * 对象&标签关系Service接口
+ *
+ * @author ruoyi
+ * @date 2024-08-27
+ */
+public interface IObjTagRelService {
+    /**
+     * 查询对象&标签关系列表
+     *
+     * @param tagType 标签类型
+     * @return 对象&标签关系集合
+     */
+    List<ObjTagRel> selectListByType(int tagType);
+
+    /**
+     * 新增对象&标签关系
+     *
+     * @param tagType 标签类型
+     * @param tagCode 标签代码
+     * @return 结果
+     */
+    List<ObjTagRel> selectListByTagCode(int tagType, String tagCode);
+
+    /**
+     * 新增对象&标签关系
+     *
+     * @param tagType 标签类型
+     * @param objCode 标签代码
+     * @return 结果
+     */
+    List<ObjTagRel> selectListByObjCode(int tagType, String objCode);
+
+    /**
+     * 批量插入
+     *
+     * @param list 对象&标签关系
+     * @return 结果
+     */
+    int insertBatch(List<ObjTagRel> list);
+
+    /**
+     * 删除对象&标签关系
+     *
+     * @param tagType 标签类型
+     * @param objCode 对象代码
+     * @return 结果
+     */
+    int deleteByObjCode(int tagType, String objCode);
+
+    /**
+     * 删除对象&标签关系
+     *
+     * @param tagType 标签类型
+     * @param tagCode 标签代码
+     * @return 结果
+     */
+    int deleteByTagCode(String tagCode);
+}

+ 71 - 17
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaBuildingZoningServiceImpl.java

@@ -1,20 +1,23 @@
 package com.ruoyi.ems.service.impl;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
 import com.ruoyi.ems.domain.AreaBuilding;
+import com.ruoyi.ems.domain.AreaBuildingZoning;
+import com.ruoyi.ems.domain.ObjTagRel;
 import com.ruoyi.ems.mapper.AreaBuildingMapper;
-import com.ruoyi.ems.service.IAreaBuildingService;
+import com.ruoyi.ems.mapper.AreaBuildingZoningMapper;
+import com.ruoyi.ems.service.IAreaBuildingZoningService;
+import com.ruoyi.ems.service.IObjTagRelService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.ruoyi.ems.mapper.AreaBuildingZoningMapper;
-import com.ruoyi.ems.domain.AreaBuildingZoning;
-import com.ruoyi.ems.service.IAreaBuildingZoningService;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * 建筑区域划分Service业务层处理
@@ -30,6 +33,9 @@ public class AreaBuildingZoningServiceImpl implements IAreaBuildingZoningService
     @Autowired
     private AreaBuildingMapper areaBuildingMapper;
 
+    @Autowired
+    private IObjTagRelService tagRelService;
+
     /**
      * 查询建筑区域划分
      *
@@ -38,7 +44,9 @@ public class AreaBuildingZoningServiceImpl implements IAreaBuildingZoningService
      */
     @Override
     public AreaBuildingZoning selectAreaBuildingZoningById(Long id) {
-        return areaBuildingZoningMapper.selectAreaBuildingZoningById(id);
+        AreaBuildingZoning zoning = areaBuildingZoningMapper.selectAreaBuildingZoningById(id);
+        zoning.setTagCodeList(Arrays.asList(StringUtils.split(zoning.getTagCodes(), ",")));
+        return zoning;
     }
 
     /**
@@ -61,7 +69,7 @@ public class AreaBuildingZoningServiceImpl implements IAreaBuildingZoningService
     @Override
     public List<AreaBuildingZoning> selectAreaBuildingZoningList(AreaBuildingZoning areaBuildingZoning) {
         List<AreaBuildingZoning> list = areaBuildingZoningMapper.selectAreaBuildingZoningList(areaBuildingZoning);
-        fillAreaPath(list);
+        fillFields(list);
         return list;
     }
 
@@ -70,7 +78,7 @@ public class AreaBuildingZoningServiceImpl implements IAreaBuildingZoningService
         AreaBuildingZoning zParam = new AreaBuildingZoning();
         zParam.setBldgCode(buildingCode);
         List<AreaBuildingZoning> list = areaBuildingZoningMapper.selectAreaBuildingZoningList(zParam);
-        fillAreaPath(list);
+        fillFields(list);
         return list;
     }
 
@@ -82,7 +90,8 @@ public class AreaBuildingZoningServiceImpl implements IAreaBuildingZoningService
             AreaBuildingZoning zParam = new AreaBuildingZoning();
             zParam.setBldgCode(buildCode);
             List<AreaBuildingZoning> list = areaBuildingZoningMapper.selectAreaBuildingZoningList(zParam);
-            fillAreaPath(list);
+            fillFields(list);
+
             retList.addAll(list);
         }
 
@@ -97,7 +106,21 @@ public class AreaBuildingZoningServiceImpl implements IAreaBuildingZoningService
      */
     @Override
     public int insertAreaBuildingZoning(AreaBuildingZoning areaBuildingZoning) {
-        return areaBuildingZoningMapper.insertAreaBuildingZoning(areaBuildingZoning);
+        int count = areaBuildingZoningMapper.insertAreaBuildingZoning(areaBuildingZoning);
+
+        if (CollectionUtils.isNotEmpty(areaBuildingZoning.getTagCodeList())) {
+            List<String> tagArray = areaBuildingZoning.getTagCodeList();
+            List<ObjTagRel> tagRelList = new ArrayList<>();
+
+            for (String tagCode : tagArray) {
+                ObjTagRel tagRel = new ObjTagRel(3, tagCode, areaBuildingZoning.getZoningCode());
+                tagRelList.add(tagRel);
+            }
+
+            tagRelService.insertBatch(tagRelList);
+        }
+
+        return count;
     }
 
     /**
@@ -108,7 +131,24 @@ public class AreaBuildingZoningServiceImpl implements IAreaBuildingZoningService
      */
     @Override
     public int updateAreaBuildingZoning(AreaBuildingZoning areaBuildingZoning) {
-        return areaBuildingZoningMapper.updateAreaBuildingZoning(areaBuildingZoning);
+        int count = areaBuildingZoningMapper.updateAreaBuildingZoning(areaBuildingZoning);
+        if (CollectionUtils.isNotEmpty(areaBuildingZoning.getTagCodeList())) {
+            List<String> tagArray = areaBuildingZoning.getTagCodeList();
+            List<ObjTagRel> tagRelList = new ArrayList<>();
+
+            for (String tagCode : tagArray) {
+                ObjTagRel tagRel = new ObjTagRel(3, tagCode, areaBuildingZoning.getZoningCode());
+                tagRelList.add(tagRel);
+            }
+
+            tagRelService.deleteByObjCode(3, areaBuildingZoning.getZoningCode());
+            tagRelService.insertBatch(tagRelList);
+        }
+        else {
+            tagRelService.deleteByObjCode(3, areaBuildingZoning.getZoningCode());
+        }
+
+        return count;
     }
 
     /**
@@ -119,6 +159,13 @@ public class AreaBuildingZoningServiceImpl implements IAreaBuildingZoningService
      */
     @Override
     public int deleteAreaBuildingZoningByIds(Long[] ids) {
+        for (Long id : ids) {
+            AreaBuildingZoning zoning = areaBuildingZoningMapper.selectAreaBuildingZoningById(id);
+            if (null != zoning) {
+                tagRelService.deleteByObjCode(3, zoning.getZoningCode());
+            }
+        }
+
         return areaBuildingZoningMapper.deleteAreaBuildingZoningByIds(ids);
     }
 
@@ -130,10 +177,16 @@ public class AreaBuildingZoningServiceImpl implements IAreaBuildingZoningService
      */
     @Override
     public int deleteAreaBuildingZoningById(Long id) {
+        AreaBuildingZoning zoning = areaBuildingZoningMapper.selectAreaBuildingZoningById(id);
+
+        if (null != zoning) {
+            tagRelService.deleteByObjCode(3, zoning.getZoningCode());
+        }
+
         return areaBuildingZoningMapper.deleteAreaBuildingZoningById(id);
     }
 
-    private void fillAreaPath(List<AreaBuildingZoning> list) {
+    private void fillFields(List<AreaBuildingZoning> list) {
         if (CollectionUtils.isNotEmpty(list)) {
             List<AreaBuilding> areaBuildings = areaBuildingMapper.selectAreaBuildingList(new AreaBuilding());
             Map<String, AreaBuilding> areaBuildingsMap = areaBuildings.stream()
@@ -148,6 +201,7 @@ public class AreaBuildingZoningServiceImpl implements IAreaBuildingZoningService
                 buildingName = zoning.getBldgName() != null ? zoning.getBldgName() : "*";
 
                 zoning.setAreaPath(areaName + buildingName);
+                zoning.setTagCodeList(Arrays.asList(StringUtils.split(zoning.getTagCodes(), ",")));
             }
         }
     }

+ 17 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/EmsTagServiceImpl.java

@@ -3,6 +3,7 @@ package com.ruoyi.ems.service.impl;
 import com.ruoyi.ems.domain.EmsTag;
 import com.ruoyi.ems.mapper.EmsTagMapper;
 import com.ruoyi.ems.service.IEmsTagService;
+import com.ruoyi.ems.service.IObjTagRelService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -19,6 +20,9 @@ public class EmsTagServiceImpl implements IEmsTagService {
     @Autowired
     private EmsTagMapper emsTagMapper;
 
+    @Autowired
+    private IObjTagRelService tagRelService;
+
     /**
      * 查询标签分类
      *
@@ -71,6 +75,13 @@ public class EmsTagServiceImpl implements IEmsTagService {
      */
     @Override
     public int deleteEmsTagByIds(Long[] ids) {
+        for (Long id : ids) {
+            EmsTag tag = emsTagMapper.selectEmsTagById(id);
+            if (null != tag) {
+                tagRelService.deleteByTagCode(tag.getTagCode());
+            }
+        }
+
         return emsTagMapper.deleteEmsTagByIds(ids);
     }
 
@@ -82,6 +93,12 @@ public class EmsTagServiceImpl implements IEmsTagService {
      */
     @Override
     public int deleteEmsTagById(Long id) {
+        EmsTag tag = emsTagMapper.selectEmsTagById(id);
+
+        if (null != tag) {
+            tagRelService.deleteByTagCode(tag.getTagCode());
+        }
+
         return emsTagMapper.deleteEmsTagById(id);
     }
 }

+ 51 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ObjTagRelServiceImpl.java

@@ -0,0 +1,51 @@
+package com.ruoyi.ems.service.impl;
+
+import com.ruoyi.ems.domain.ObjTagRel;
+import com.ruoyi.ems.mapper.ObjTagRelMapper;
+import com.ruoyi.ems.service.IObjTagRelService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 对象&标签关系Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-08-27
+ */
+@Service
+public class ObjTagRelServiceImpl implements IObjTagRelService {
+    @Autowired
+    private ObjTagRelMapper objTagRelMapper;
+
+    @Override
+    public List<ObjTagRel> selectListByType(int tagType) {
+        return objTagRelMapper.selectListByType(tagType);
+    }
+
+    @Override
+    public List<ObjTagRel> selectListByTagCode(int tagType, String tagCode) {
+        return objTagRelMapper.selectListByTagCode(tagType, tagCode);
+    }
+
+    @Override
+    public List<ObjTagRel> selectListByObjCode(int tagType, String objCode) {
+        return objTagRelMapper.selectListByObjCode(tagType, objCode);
+    }
+
+    @Override
+    public int insertBatch(List<ObjTagRel> list) {
+        return objTagRelMapper.insertBatch(list);
+    }
+
+    @Override
+    public int deleteByObjCode(int tagType, String objCode) {
+        return objTagRelMapper.deleteByObjCode(tagType, objCode);
+    }
+
+    @Override
+    public int deleteByTagCode(String tagCode) {
+        return objTagRelMapper.deleteByTagCode(tagCode);
+    }
+}

+ 25 - 9
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaBuildingZoningMapper.xml

@@ -13,27 +13,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="floor"    column="floor"    />
         <result property="bldgLdArea"    column="bldg_ld_area"    />
         <result property="usageDetail"    column="usage_detail"    />
-        <result property="tagCode"    column="tag_code"    />
-        <result property="tagName"    column="tag_name"    />
+        <result property="tagCodes"    column="tag_codes"    />
+        <result property="tagNames"    column="tag_names"    />
     </resultMap>
 
     <sql id="selectAreaBuildingZoningVo">
-        select z.`id`, z.`bldg_code`, b.`bldg_name`, z.`zoning_code`, z.`zoning_name`, z.`floor`, z.`bldg_ld_area`, z.`usage_detail`, z.`tag_code`, t.tag_name from adm_area_building_zoning z
+        select
+            z.`id`,
+            z.`bldg_code`,
+            b.`bldg_name`,
+            z.`zoning_code`,
+            z.`zoning_name`,
+            z.`floor`,
+            z.`bldg_ld_area`,
+            z.`usage_detail`,
+            COALESCE(GROUP_CONCAT(r.tag_code SEPARATOR ','), '') AS tag_codes,
+            COALESCE(GROUP_CONCAT(t.tag_name SEPARATOR ','), '') AS tag_names
+        from adm_area_building_zoning z
             LEFT JOIN adm_area_building b ON z.bldg_code = b.bldg_code
-            LEFT JOIN dim_ems_tag t ON z.tag_code = t.tag_code
+            LEFT JOIN adm_obj_tag_rel r ON z.zoning_code = r.obj_code
+            LEFT JOIN dim_ems_tag t ON t.tag_code = r.tag_code
     </sql>
 
     <select id="selectAreaBuildingZoningList" parameterType="com.ruoyi.ems.domain.AreaBuildingZoning" resultMap="AreaBuildingZoningResult">
         <include refid="selectAreaBuildingZoningVo"/>
-        <where>  
+        <where>
+            <if test="areaCode != null  and areaCode != ''"> and b.`area_code` = #{areaCode}</if>
             <if test="bldgCode != null  and bldgCode != ''"> and z.`bldg_code` = #{bldgCode}</if>
             <if test="zoningCode != null  and zoningCode != ''"> and z.`zoning_code` = #{zoningCode}</if>
             <if test="zoningName != null  and zoningName != ''"> and z.`zoning_name` like concat('%', #{zoningName}, '%')</if>
             <if test="floor != null "> and z.`floor` = #{floor}</if>
             <if test="bldgLdArea != null "> and z.`bldg_ld_area` = #{bldgLdArea}</if>
             <if test="usageDetail != null  and usageDetail != ''"> and z.`usage_detail` = #{usageDetail}</if>
-            <if test="tagCode != null  and tagCode != ''"> and z.`tag_code` = #{tagCode}</if>
+            <if test="tagCodeList != null"> and r.tag_code in
+              <foreach item="code" collection="tagCodeList" open="(" separator="," close=")">
+                #{code}
+              </foreach>
+             </if>
         </where>
+        GROUP BY z.zoning_code
+        ORDER BY bldg_code,zoning_code
     </select>
     
     <select id="selectAreaBuildingZoningById" parameterType="Long" resultMap="AreaBuildingZoningResult">
@@ -55,7 +74,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="floor != null">floor,</if>
             <if test="bldgLdArea != null">bldg_ld_area,</if>
             <if test="usageDetail != null">usage_detail,</if>
-            <if test="tagCode != null">tag_code,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="bldgCode != null and bldgCode != ''">#{bldgCode},</if>
@@ -64,7 +82,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="floor != null">#{floor},</if>
             <if test="bldgLdArea != null">#{bldgLdArea},</if>
             <if test="usageDetail != null">#{usageDetail},</if>
-            <if test="tagCode != null">#{tagCode}</if>
          </trim>
     </insert>
 
@@ -77,7 +94,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="floor != null">floor = #{floor},</if>
             <if test="bldgLdArea != null">bldg_ld_area = #{bldgLdArea},</if>
             <if test="usageDetail != null">usage_detail = #{usageDetail},</if>
-            <if test="tagCode != null">tag_code = #{tagCode},</if>
         </trim>
         where id = #{id}
     </update>

+ 8 - 3
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/CoChargingConfigMapper.xml

@@ -7,6 +7,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="com.ruoyi.ems.domain.CoChargingConfig" id="CoChargingConfigResult">
         <result property="id"    column="id"    />
         <result property="areaCode"    column="area_code"    />
+        <result property="areaName"    column="area_name"    />
+        <result property="areaShortName"    column="area_short_name"    />
         <result property="elecUnitPrice"    column="elec_unit_price"    />
         <result property="elecGtComputeType"    column="elec_gt_compute_type"    />
         <result property="elecComputeDesc"    column="elec_compute_desc"    />
@@ -16,19 +18,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectCoChargingConfigVo">
-        select id, area_code, elec_unit_price, elec_gt_compute_type, elec_compute_desc, water_unit_price, water_gt_compute_type, water_compute_desc from adm_co_charging_config
+        select
+            c.id, c.area_code, a.area_name, a.short_name as area_short_name, c.elec_unit_price, c.elec_gt_compute_type, c.elec_compute_desc, c.water_unit_price, c.water_gt_compute_type, c.water_compute_desc
+        from adm_co_charging_config c
+          LEFT JOIN adm_service_area a ON c.area_code = a.area_code
     </sql>
 
     <select id="selectCoChargingConfigList" parameterType="com.ruoyi.ems.domain.CoChargingConfig" resultMap="CoChargingConfigResult">
         <include refid="selectCoChargingConfigVo"/>
         <where>  
-            <if test="areaCode != null  and areaCode != ''"> and area_code = #{areaCode}</if>
+            <if test="areaCode != null  and areaCode != ''"> and a.area_code = #{areaCode}</if>
         </where>
     </select>
     
     <select id="selectCoChargingConfigById" parameterType="Long" resultMap="CoChargingConfigResult">
         <include refid="selectCoChargingConfigVo"/>
-        where id = #{id}
+        where a.id = #{id}
     </select>
         
     <insert id="insertCoChargingConfig" parameterType="com.ruoyi.ems.domain.CoChargingConfig" useGeneratedKeys="true" keyProperty="id">

+ 48 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ObjTagRelMapper.xml

@@ -0,0 +1,48 @@
+<?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="com.ruoyi.ems.mapper.ObjTagRelMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.ObjTagRel" id="objTagRelResult">
+        <result property="tagType"    column="tag_type"    />
+        <result property="tagCode"    column="tag_code"    />
+        <result property="objCode"    column="obj_code"    />
+    </resultMap>
+
+    <sql id="selectAdmObjTagRelVo">
+        select tag_type, tag_code, obj_code from adm_obj_tag_rel
+    </sql>
+
+    <select id="selectListByType" parameterType="java.lang.Integer" resultMap="objTagRelResult">
+        <include refid="selectAdmObjTagRelVo"/>
+        where tag_type = #{tagType}
+    </select>
+
+    <select id="selectListByTagCode" resultMap="objTagRelResult">
+        <include refid="selectAdmObjTagRelVo"/>
+        where tag_type = #{tagType} and tag_code = #{tagCode}
+    </select>
+
+    <select id="selectListByObjCode" resultMap="objTagRelResult">
+        <include refid="selectAdmObjTagRelVo"/>
+        where tag_type = #{tagType} and obj_code = #{objCode}
+    </select>
+
+    <insert id="insertBatch" parameterType="java.util.List">
+        insert into adm_obj_tag_rel (tag_type, tag_code, obj_code)
+        values
+        <foreach collection="list" item="item" index="index" separator=",">
+            (#{item.tagType}, #{item.tagCode}, #{item.objCode})
+        </foreach>
+    </insert>
+
+    <delete id="deleteByTagCode" >
+        delete from adm_obj_tag_rel where tag_code = #{tagCode}
+    </delete>
+
+
+    <delete id="deleteByObjCode">
+        delete from adm_obj_tag_rel where tag_type = #{tagType} and obj_code = #{objCode}
+    </delete>
+</mapper>

+ 67 - 36
ems-cloud/sql/ems_server.sql

@@ -450,44 +450,43 @@ create table adm_area_building_zoning (
   `room_no`          varchar(16)     default null               comment '房间号',
   `bldg_ld_area`     double          default null               comment '建筑划分面积',
   `usage_detail`     varchar(200)    default null               comment '使用详情',
-  `tag_code`         varchar(64)     default null               comment '标签编码',
   primary key (`id`),
-    unique key ux_building_zoning_code(`bldg_code`, `zoning_code`)
+  unique key ux_building_zoning_code(`bldg_code`, `zoning_code`)
 ) engine=innodb auto_increment=1 comment = '建筑区域划分表';
 
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-101', '开水泡面间', 1, '101', 100, '使用中', 'Area_01');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-102', '超市', 1, '102', 200, '使用中', 'Area_01');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-103', '中式糕点', 1, '103', 150, '使用中', 'Area_01');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-104', '特色产品市集', 1, '104', 200, '使用中', 'Area_01');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-105', '奶茶/咖啡', 1, '105', 100, '使用中', 'Area_01');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-106', '中式套餐', 1, '106', 200, '使用中', 'Area_01');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-107', '特色小吃', 1, '107', 100, '使用中', 'Area_01');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-108', '串串/卤味', 1, '108', 100, '使用中', 'Area_01');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-109', '糖葫芦/水果', 1, '109', 100, '使用中', 'Area_01');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-110', '美食广场', 1, '110', 300, '使用中', 'Area_01');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-111', '男卫', 1, '111', 200, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-112', '男盥洗室', 1, '112', 150, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-113', '女卫', 1, '113', 200, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-114', '女盥洗室', 1, '114', 150, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-115', '工具间1', 1, '115', 50, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-116', '工具间2', 1, '116', 50, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-117', '工具间3', 1, '117', 50, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-118', '工具间4', 1, '118', 50, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300101', 'B-119', '货车服务空间', 1, '119', 50, '使用中', 'Area_01');
-
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300106', '321283124S3001_CW-XK', '小客停车位', 1, 'CW-XK', 100, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300106', '321283124S3001_CW-CD', '充电车位', 1, 'CW-CD', 100, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300106', '321283124S3001_CW-WZA', '无障碍车位', 1, 'CW-WZA', 100, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300106', '321283124S3001_CW-DKC', '大客车停车位', 1, 'CW-DKC', 100, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300106', '321283124S3001_CW-HC', '货车车位', 1, 'CW-HC', 100, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300106', '321283124S3001_CW-WXP', '危险品车位', 1, 'CW-WXP', 100, '使用中', 'Area_00');
-
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300206', '321283124S3002_CW-XK', '小客停车位', 1, 'CW-XK', 100, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300206', '321283124S3002_CW-CD', '充电车位', 1, 'CW-XK', 100, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300206', '321283124S3002_CW-WZA', '无障碍车位', 1, 'CW-XK', 100, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300206', '321283124S3002_CW-DKC', '大客车停车位', 1, 'CW-XK', 100, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300206', '321283124S3002_CW-HC', '货车车位', 1, 'CW-XK', 100, '使用中', 'Area_00');
-INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`, `tag_code`) VALUES ('321283124S300206', '321283124S3002_CW-WXP','危险品车位', 1, 'CW-XK', 100, '使用中', 'Area_00');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-101', '开水泡面间', 1, '101', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-102', '超市', 1, '102', 200, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-103', '中式糕点', 1, '103', 150, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-104', '特色产品市集', 1, '104', 200, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-105', '奶茶/咖啡', 1, '105', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-106', '中式套餐', 1, '106', 200, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-107', '特色小吃', 1, '107', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-108', '串串/卤味', 1, '108', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-109', '糖葫芦/水果', 1, '109', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-110', '美食广场', 1, '110', 300, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-111', '男卫', 1, '111', 200, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-112', '男盥洗室', 1, '112', 150, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-113', '女卫', 1, '113', 200, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-114', '女盥洗室', 1, '114', 150, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-115', '工具间1', 1, '115', 50, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-116', '工具间2', 1, '116', 50, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-117', '工具间3', 1, '117', 50, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-118', '工具间4', 1, '118', 50, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-119', '货车服务空间', 1, '119', 50, '使用中');
+                                                                                                                                   
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-XK', '小客停车位', 1, 'CW-XK', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-CD', '充电车位', 1, 'CW-CD', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-WZA', '无障碍车位', 1, 'CW-WZA', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-DKC', '大客车停车位', 1, 'CW-DKC', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-HC', '货车车位', 1, 'CW-HC', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-WXP', '危险品车位', 1, 'CW-WXP', 100, '使用中');
+                                                                                                                                   
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-XK', '小客停车位', 1, 'CW-XK', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-CD', '充电车位', 1, 'CW-XK', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-WZA', '无障碍车位', 1, 'CW-XK', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-DKC', '大客车停车位', 1, 'CW-XK', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-HC', '货车车位', 1, 'CW-XK', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-WXP','危险品车位', 1, 'CW-XK', 100, '使用中');
 
 -- ----------------------------
 -- 能源设施/系统表
@@ -887,6 +886,38 @@ create table adm_ems_device_rbook (
 
 
 -- ----------------------------
+-- 对象&标签关系表
+-- ----------------------------
+drop table if exists adm_obj_tag_rel;
+create table adm_obj_tag_rel (
+  `tag_type`         int             not null                     comment '标签类型',
+  `tag_code`         varchar(64)     not null                     comment '标签代码',
+  `obj_code`         varchar(64)     not null                     comment '对象代码',
+  key inx_obj_tag_rel(`tag_type`, `tag_code`)
+) engine=innodb auto_increment=1 comment = '对象&标签关系表';
+
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-101','Area_00');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-102','Area_01');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-103','Area_01');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-104','Area_01');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-105','Area_01');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-106','Area_01');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-107','Area_01');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-108','Area_01');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-109','Area_01');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-110','Area_01');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-111','Area_00');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-112','Area_00');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-113','Area_00');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-114','Area_00');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-115','Area_00');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-116','Area_00');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-117','Area_00');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-118','Area_00');
+insert into adm_obj_tag_rel(`tag_type`,`obj_code`,`tag_code`) VALUES ('3','B-119','Area_00');
+
+
+-- ----------------------------
 -- 服务区用电属性表
 -- ----------------------------
 drop table if exists adm_area_elec_attr;
@@ -943,7 +974,7 @@ INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `
 drop table if exists adm_pv_elecprice_config;
 create table adm_pv_elecprice_config (
   `id`                    bigint(20)      not null auto_increment      comment '序号',
-  `cfg_code`              varchar(16)      not null                     comment '配置代码',
+  `cfg_code`              varchar(16)      not null                    comment '配置代码',
   `price_name`            varchar(32)     not null                     comment '价格名称',
   `obj_price`             double          default null                 comment '对象价格',
   `state_subsidy`         double          default null                 comment '国家补贴',