Răsfoiți Sursa

feat: 调整表字段

weijianghai 1 an în urmă
părinte
comite
8d04b41618

+ 38 - 38
src/main/java/com/nokia/financeapi/dao/car/CarResourceMapMapper.java

@@ -42,13 +42,13 @@ select
 from
     car.car_base_data_month
 where
-    nian_yue = (
+    year_month = (
     select
-        max(nian_yue)
+        max(year_month)
     from
         car.car_base_data_month)
     <if test="dto.city != null and dto.city != ''">
-      and di_shi = #{dto.city}
+      and first_unit = #{dto.city}
     </if>
 </script>
 """)
@@ -66,9 +66,9 @@ select
 from
     car.car_base_data_month
 where
-    nian_yue = (
+    year_month = (
     select
-        max(nian_yue)
+        max(year_month)
     from
         car.car_base_data_month)
     and city is not null
@@ -83,9 +83,9 @@ select
 from
     car.car_di_xiao_month
 where
-    nian_yue = (
+    year_month = (
     select
-        max(nian_yue)
+        max(year_month)
     from
         car.car_di_xiao_month)
     and city is not null
@@ -122,9 +122,9 @@ select
 from
     car.car_base_data_month
 where
-    nian_yue = (
+    year_month = (
     select
-        max(nian_yue)
+        max(year_month)
     from
         car.car_base_data_month)
     and district is not null
@@ -140,9 +140,9 @@ select
 from
     car.car_di_xiao_month
 where
-    nian_yue = (
+    year_month = (
     select
-        max(nian_yue)
+        max(year_month)
     from
         car.car_di_xiao_month)
     and district is not null
@@ -175,7 +175,7 @@ select * from t104 order by area_name
 with
 t101 as (
 select
-    di_shi,
+    first_unit,
     avg(zong_li_cheng) as mileage,
     avg(chu_qin_lv) as attendanceRate
 from
@@ -186,12 +186,12 @@ where
         max(year_no)
     from
         car.car_li_cheng_month)
-    and di_shi is not null
-    and di_shi != ''
-    and di_shi != '省公司本部'
+    and first_unit is not null
+    and first_unit != ''
+    and first_unit != '省公司本部'
     and position('建设部' in che_liang_suo_shu_dan_wei) = 0
 group by
-    di_shi
+    first_unit
 ),
 t102 as (
 select
@@ -200,11 +200,11 @@ select
 from
     t101
 left join car.car_second_unit_sort on
-    t101.di_shi = car.car_second_unit_sort.second_unit
+    t101.first_unit = car.car_second_unit_sort.second_unit
 ),
 t103 as (
 select
-    di_shi as area_name,
+    first_unit as area_name,
     round(mileage,
     2) as mileage,
     round(attendanceRate * 100,
@@ -229,7 +229,7 @@ from
 with
 t101 as (
 select
-    er_ji_dan_wei,
+    second_unit,
     avg(zong_li_cheng) as mileage,
     avg(chu_qin_lv) as attendanceRate
 from
@@ -240,15 +240,15 @@ where
         max(year_no)
     from
         car.car_li_cheng_month)
-    and er_ji_dan_wei is not null
-    and er_ji_dan_wei != ''
-    and di_shi = #{dto.city}
+    and second_unit is not null
+    and second_unit != ''
+    and first_unit = #{dto.city}
 group by
-    er_ji_dan_wei
+    second_unit
 ),
 t102 as (
 select
-    er_ji_dan_wei as area_name,
+    second_unit as area_name,
     round(mileage,
     2) as mileage,
     round(attendanceRate * 100,
@@ -256,7 +256,7 @@ select
 from
     t101
 order by
-    er_ji_dan_wei
+    second_unit
 )
 select
     *
@@ -272,7 +272,7 @@ from
 with
 t101 as (
 select
-    di_shi,
+    first_unit,
     sum(zong_fei_yong) as cost_sum,
     avg(zong_fei_yong) as cost_avg
 from
@@ -283,12 +283,12 @@ where
         max(year_no)
     from
         car.car_fei_yong_month)
-    and di_shi is not null
-    and di_shi != ''
+    and first_unit is not null
+    and first_unit != ''
     and position('建设部' in che_liang_suo_shu_dan_wei) = 0
     and rui_xing = 1
 group by
-    di_shi
+    first_unit
 ),
 t102 as (
 select
@@ -297,11 +297,11 @@ select
 from
     t101
 left join car.car_second_unit_sort on
-    t101.di_shi = car.car_second_unit_sort.second_unit
+    t101.first_unit = car.car_second_unit_sort.second_unit
 ),
 t103 as (
 select
-    di_shi as area_name,
+    first_unit as area_name,
     round(cost_sum,
     2) as cost_sum,
     round(cost_avg,
@@ -326,7 +326,7 @@ from
 with
 t101 as (
 select
-    er_ji_dan_wei,
+    second_unit,
     sum(zong_fei_yong) as cost_sum,
     avg(zong_fei_yong) as cost_avg
 from
@@ -337,16 +337,16 @@ where
         max(year_no)
     from
         car.car_fei_yong_month)
-    and er_ji_dan_wei is not null
-    and er_ji_dan_wei != ''
+    and second_unit is not null
+    and second_unit != ''
     and rui_xing = 1
-    and di_shi = #{dto.city}
+    and first_unit = #{dto.city}
 group by
-    er_ji_dan_wei
+    second_unit
 ),
 t102 as (
 select
-    er_ji_dan_wei as area_name,
+    second_unit as area_name,
     round(cost_sum,
     2) as cost_sum,
     round(cost_avg,
@@ -354,7 +354,7 @@ select
 from
     t101
 order by
-    er_ji_dan_wei
+    second_unit
 )
 select
     *

+ 4 - 4
src/main/java/com/nokia/financeapi/dao/house/HouseResourceMapMapper.java

@@ -47,7 +47,7 @@ where
     from
         house.building_month)
     <if test="dto.city != null and dto.city != ''">
-      and area_name = #{dto.city}
+      and city = #{dto.city}
     </if>
 )
 select
@@ -482,7 +482,7 @@ select
     building_area,
     building_area_idle,
     building_area_rent,
-    round(maintenance_cost, 2) as maintenance_cost,
+    case when maintenance_cost is null then 0 else round(maintenance_cost, 2) end as maintenance_cost,
     building_img,
     lng_bd09 as lng,
     lat_bd09 as lat
@@ -545,7 +545,7 @@ select
     building_area,
     building_area_idle,
     building_area_rent,
-    round(maintenance_cost, 2) as maintenance_cost,
+    case when maintenance_cost is null then 0 else round(maintenance_cost, 2) end as maintenance_cost,
     building_img,
     lng_bd09 as lng,
     lat_bd09 as lat
@@ -608,7 +608,7 @@ select
     building_area,
     building_area_idle,
     building_area_rent,
-    round(maintenance_cost, 2) as maintenance_cost,
+    case when maintenance_cost is null then 0 else round(maintenance_cost, 2) end as maintenance_cost,
     building_img,
     lng_bd09 as lng,
     lat_bd09 as lat

+ 2 - 2
src/main/java/com/nokia/financeapi/pojo/po/AreaPo.java

@@ -10,7 +10,7 @@ public class AreaPo {
     /**
      * 地区id
      */
-    private Integer areaId;
+    private String areaId;
     /**
      * 地区名称
      */
@@ -18,7 +18,7 @@ public class AreaPo {
     /**
      * 父级id
      */
-    private Integer parentId;
+    private String parentId;
     /**
      * 地区级别
      */

+ 2 - 2
src/main/java/com/nokia/financeapi/pojo/vo/TreeAreaVo.java

@@ -14,11 +14,11 @@ public class TreeAreaVo {
     @Schema(description = "地区名称", example = "石家庄")
     private String label;
     @Schema(description = "地区id", example = "130100")
-    private Integer value;
+    private String value;
     @Schema(description = "子地区列表")
     private List<TreeAreaVo> children;
 
-    public TreeAreaVo(String label, Integer value) {
+    public TreeAreaVo(String label, String value) {
         this.label = label;
         this.value = value;
     }

+ 6 - 6
src/main/java/com/nokia/financeapi/service/house/HouseResourceMapService.java

@@ -66,12 +66,12 @@ public class HouseResourceMapService {
     public R<TreeAreaVo> treeArea() {
         // 查询所有地区
         List<AreaPo> areas = areaDao.getAll();
-        Map<Integer, List<AreaPo>> parentMap = getAreaParentMap(areas);
+        Map<String, List<AreaPo>> parentMap = getAreaParentMap(areas);
         // 地市列表
-        List<AreaPo> cityList = parentMap.get(130000);
+        List<AreaPo> cityList = parentMap.get("130000");
         TreeAreaVo vo = new TreeAreaVo();
         vo.setLabel("河北省");
-        vo.setValue(130000);
+        vo.setValue("130000");
         List<TreeAreaVo> cityVoList = new ArrayList<>();
         vo.setChildren(cityVoList);
         for (AreaPo tt : cityList) {
@@ -92,7 +92,7 @@ public class HouseResourceMapService {
         }
         TreeAreaVo sbb = new TreeAreaVo();
         sbb.setLabel("省本部");
-        sbb.setValue(-12);
+        sbb.setValue("-12");
         cityVoList.add(sbb);
         return R.ok(vo);
     }
@@ -102,8 +102,8 @@ public class HouseResourceMapService {
      *
      * @param areas 区域
      */
-    private Map<Integer, List<AreaPo>> getAreaParentMap(List<AreaPo> areas) {
-        Map<Integer, List<AreaPo>> parentMap = new HashMap<>();
+    private Map<String, List<AreaPo>> getAreaParentMap(List<AreaPo> areas) {
+        Map<String, List<AreaPo>> parentMap = new HashMap<>();
         for (AreaPo t : areas) {
             parentMap.putIfAbsent(t.getParentId(), new ArrayList<>());
             parentMap.get(t.getParentId()).add(t);