正在显示
12 个修改的文件
包含
195 行增加
和
219 行删除
1 | +package com.sunyo.energy.location.controller; | ||
2 | + | ||
3 | +import com.github.pagehelper.PageInfo; | ||
4 | +import com.sunyo.energy.location.controller.response.ResultJson; | ||
5 | +import com.sunyo.energy.location.model.ElectricityInfo; | ||
6 | +import com.sunyo.energy.location.service.EeInfoService; | ||
7 | +import io.swagger.annotations.ApiOperation; | ||
8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
9 | +import org.springframework.stereotype.Component; | ||
10 | +import org.springframework.stereotype.Controller; | ||
11 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
12 | +import org.springframework.web.bind.annotation.RequestParam; | ||
13 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
14 | +import sun.jvm.hotspot.debugger.Page; | ||
15 | + | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | +/** | ||
19 | + * @author shenhailong | ||
20 | + * <p> | ||
21 | + * 2020/6/5/10:44 | ||
22 | + */ | ||
23 | +@RequestMapping(value = "/eeInfo") | ||
24 | +@Component | ||
25 | +public class EeInfoController { | ||
26 | + | ||
27 | + @Autowired | ||
28 | + EeInfoService eeInfoService; | ||
29 | + | ||
30 | + @ApiOperation(value = "查询电表充值失败信息") | ||
31 | + @RequestMapping("/list") | ||
32 | + @ResponseBody | ||
33 | + public PageInfo<ElectricityInfo> list(@RequestParam(value = "pageSize", required = false, defaultValue = "1") int pageSize, | ||
34 | + @RequestParam(value = "pageNum", required = false, defaultValue = "5") int pageNum, | ||
35 | + @RequestParam(value = "deviceId", required = false) String deviceId){ | ||
36 | + | ||
37 | + PageInfo<ElectricityInfo> eeInfo = eeInfoService.getEeInfo(pageSize, pageNum, deviceId); | ||
38 | + | ||
39 | + return eeInfo; | ||
40 | + | ||
41 | + } | ||
42 | + | ||
43 | +} |
@@ -31,11 +31,21 @@ public class LocationController { | @@ -31,11 +31,21 @@ public class LocationController { | ||
31 | @RequestParam(value = "pageSize",required = false,defaultValue = "5") | 31 | @RequestParam(value = "pageSize",required = false,defaultValue = "5") |
32 | int pageSize, | 32 | int pageSize, |
33 | @RequestParam(value = "processName", required = false) | 33 | @RequestParam(value = "processName", required = false) |
34 | - String adrname){ | 34 | + String adrname, |
35 | + @RequestParam(value = "parent", required = false) | ||
36 | + int parent){ | ||
35 | Page<Location> page = PageHelper.startPage(pageNum,pageSize); | 37 | Page<Location> page = PageHelper.startPage(pageNum,pageSize); |
36 | List<Location> list = null; | 38 | List<Location> list = null; |
37 | if (StringUtils.isEmpty(adrname)) { | 39 | if (StringUtils.isEmpty(adrname)) { |
38 | - list= locationMapper.selectAll(0); | 40 | + list = locationMapper.selectAll(parent); |
41 | + if (parent == 0){ | ||
42 | + Location location = list.get(0); | ||
43 | + List<Location> locationsList = locationMapper.selectAll(location.getId()); | ||
44 | + for (Location loc: list){ | ||
45 | + loc.setChildren(locationsList); | ||
46 | + } | ||
47 | + } | ||
48 | + | ||
39 | }else { | 49 | }else { |
40 | list= locationMapper.selectAllAdrName(adrname); | 50 | list= locationMapper.selectAllAdrName(adrname); |
41 | } | 51 | } |
@@ -30,7 +30,7 @@ public class UserPayController { | @@ -30,7 +30,7 @@ public class UserPayController { | ||
30 | @Autowired | 30 | @Autowired |
31 | private WaterMeterService waterMeterService; | 31 | private WaterMeterService waterMeterService; |
32 | 32 | ||
33 | - @ApiOperation(value = "查询缴费订单") | 33 | + @ApiOperation(value = "查看缴费房间") |
34 | @RequestMapping("/list") | 34 | @RequestMapping("/list") |
35 | public List userPayList(@RequestParam(value = "roomNumber", required = false) String roomNumber ){ | 35 | public List userPayList(@RequestParam(value = "roomNumber", required = false) String roomNumber ){ |
36 | 36 |
1 | package com.sunyo.energy.location.dao; | 1 | package com.sunyo.energy.location.dao; |
2 | 2 | ||
3 | import com.sunyo.energy.location.model.ElectricityInfo; | 3 | import com.sunyo.energy.location.model.ElectricityInfo; |
4 | +import org.apache.ibatis.annotations.Param; | ||
4 | 5 | ||
5 | import java.util.List; | 6 | import java.util.List; |
6 | 7 | ||
@@ -13,7 +14,7 @@ public interface ElectricityInfoMapper { | @@ -13,7 +14,7 @@ public interface ElectricityInfoMapper { | ||
13 | 14 | ||
14 | ElectricityInfo selectByPrimaryKey(String orderNumber); | 15 | ElectricityInfo selectByPrimaryKey(String orderNumber); |
15 | 16 | ||
16 | - List<ElectricityInfo> selectAll(); | 17 | + List<ElectricityInfo> selectAll(@Param("deviceId") String deviceId); |
17 | 18 | ||
18 | int updateByPrimaryKeySelective(ElectricityInfo record); | 19 | int updateByPrimaryKeySelective(ElectricityInfo record); |
19 | 20 |
1 | -package com.sunyo.energy.location.dao; | ||
2 | - | ||
3 | -import com.sunyo.energy.location.model.ElectricityMeter; | ||
4 | - | ||
5 | -public interface ElectricityMeterMapper { | ||
6 | - int deleteByPrimaryKey(String deviceId); | ||
7 | - | ||
8 | - int insert(ElectricityMeter record); | ||
9 | - | ||
10 | - int insertSelective(ElectricityMeter record); | ||
11 | - | ||
12 | - ElectricityMeter selectByPrimaryKey(String deviceId); | ||
13 | - | ||
14 | - int updateByPrimaryKeySelective(ElectricityMeter record); | ||
15 | - | ||
16 | - int updateByPrimaryKey(ElectricityMeter record); | ||
17 | -} |
1 | +package com.sunyo.energy.location.service; | ||
2 | + | ||
3 | +import com.github.pagehelper.PageInfo; | ||
4 | +import com.sunyo.energy.location.model.ElectricityInfo; | ||
5 | +import com.sunyo.energy.location.model.PayRecords; | ||
6 | + | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author shenhailong | ||
11 | + * <p> | ||
12 | + * 2020/6/5/10:45 | ||
13 | + */ | ||
14 | +public interface EeInfoService { | ||
15 | + | ||
16 | + int deleteByPrimaryKey(String orderNumber); | ||
17 | + | ||
18 | + int insert(ElectricityInfo record); | ||
19 | + | ||
20 | + int insertSelective(ElectricityInfo record); | ||
21 | + | ||
22 | + ElectricityInfo selectByPrimaryKey(String orderNumber); | ||
23 | + | ||
24 | + PageInfo<ElectricityInfo> getEeInfo(int pageSize, int pageNum, String deviceId); | ||
25 | + | ||
26 | + int updateByPrimaryKeySelective(ElectricityInfo record); | ||
27 | + | ||
28 | + int updateByPrimaryKey(ElectricityInfo record); | ||
29 | + | ||
30 | +} |
1 | +package com.sunyo.energy.location.service.imp; | ||
2 | + | ||
3 | +import com.github.pagehelper.Page; | ||
4 | +import com.github.pagehelper.PageHelper; | ||
5 | +import com.github.pagehelper.PageInfo; | ||
6 | +import com.sunyo.energy.location.dao.ElectricityInfoMapper; | ||
7 | +import com.sunyo.energy.location.model.ElectricityInfo; | ||
8 | +import com.sunyo.energy.location.model.PayRecords; | ||
9 | +import com.sunyo.energy.location.service.EeInfoService; | ||
10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
11 | +import org.springframework.stereotype.Service; | ||
12 | +import org.springframework.util.StringUtils; | ||
13 | + | ||
14 | +import java.util.List; | ||
15 | + | ||
16 | +/** | ||
17 | + * @author shenhailong | ||
18 | + * <p> | ||
19 | + * 2020/6/5/10:45 | ||
20 | + */ | ||
21 | +@Service | ||
22 | +public class EeInfoServiceImpl implements EeInfoService { | ||
23 | + | ||
24 | + @Autowired | ||
25 | + ElectricityInfoMapper electricityInfoMapper; | ||
26 | + | ||
27 | + @Override | ||
28 | + public int deleteByPrimaryKey(String orderNumber) { | ||
29 | + return 0; | ||
30 | + } | ||
31 | + | ||
32 | + @Override | ||
33 | + public int insert(ElectricityInfo record) { | ||
34 | + return 0; | ||
35 | + } | ||
36 | + | ||
37 | + @Override | ||
38 | + public int insertSelective(ElectricityInfo record) { | ||
39 | + return 0; | ||
40 | + } | ||
41 | + | ||
42 | + @Override | ||
43 | + public ElectricityInfo selectByPrimaryKey(String orderNumber) { | ||
44 | + return null; | ||
45 | + } | ||
46 | + | ||
47 | + @Override | ||
48 | + public PageInfo<ElectricityInfo> getEeInfo(int pageSize, int pageNum, String deviceId) { | ||
49 | + | ||
50 | + PageHelper.startPage(pageNum,pageSize); | ||
51 | + List<ElectricityInfo> list = electricityInfoMapper.selectAll(deviceId); | ||
52 | + PageInfo<ElectricityInfo> result = new PageInfo<>(list); | ||
53 | + | ||
54 | + return result; | ||
55 | + } | ||
56 | + | ||
57 | + | ||
58 | + @Override | ||
59 | + public int updateByPrimaryKeySelective(ElectricityInfo record) { | ||
60 | + return 0; | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public int updateByPrimaryKey(ElectricityInfo record) { | ||
65 | + return 0; | ||
66 | + } | ||
67 | +} |
@@ -2,7 +2,6 @@ package com.sunyo.energy.location.service.imp; | @@ -2,7 +2,6 @@ package com.sunyo.energy.location.service.imp; | ||
2 | 2 | ||
3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
4 | import com.sunyo.energy.location.dao.ElectricityInfoMapper; | 4 | import com.sunyo.energy.location.dao.ElectricityInfoMapper; |
5 | -import com.sunyo.energy.location.dao.ElectricityMeterMapper; | ||
6 | import com.sunyo.energy.location.dao.PayRecordsMapper; | 5 | import com.sunyo.energy.location.dao.PayRecordsMapper; |
7 | import com.sunyo.energy.location.model.*; | 6 | import com.sunyo.energy.location.model.*; |
8 | import com.sunyo.energy.location.service.ElectricityMeterService; | 7 | import com.sunyo.energy.location.service.ElectricityMeterService; |
@@ -25,9 +24,6 @@ import java.util.Map; | @@ -25,9 +24,6 @@ import java.util.Map; | ||
25 | public class ElectricityMeterServiceImp implements ElectricityMeterService { | 24 | public class ElectricityMeterServiceImp implements ElectricityMeterService { |
26 | 25 | ||
27 | @Autowired | 26 | @Autowired |
28 | - ElectricityMeterMapper electricityMeterMapper; | ||
29 | - | ||
30 | - @Autowired | ||
31 | ElectricityInfoMapper electricityInfoMapper; | 27 | ElectricityInfoMapper electricityInfoMapper; |
32 | 28 | ||
33 | @Autowired | 29 | @Autowired |
@@ -47,32 +43,18 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -47,32 +43,18 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
47 | * 电表充值接口地址 | 43 | * 电表充值接口地址 |
48 | */ | 44 | */ |
49 | private final static String rechargeDevicesUrl = "http://192.168.1.2:18080/api/emcs/rechargeDevices"; | 45 | private final static String rechargeDevicesUrl = "http://192.168.1.2:18080/api/emcs/rechargeDevices"; |
50 | - | ||
51 | /** | 46 | /** |
52 | - * 获取全部电表设备数据 定时查询 入临时电表 | 47 | + * 获取设备跟公寓信息 |
53 | */ | 48 | */ |
54 | - @Scheduled(cron = "0 0 03 * * ?" ) | ||
55 | - public void balanceList(){ | ||
56 | - | ||
57 | - try { | ||
58 | - | ||
59 | - Map<String, Object> stringObjectMap = eeInfo("all"); | ||
60 | - String infoForRealTime = HttpsUtils.sendPost(electricityBanlanceUrl, stringObjectMap); | ||
61 | - ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(infoForRealTime, ElectricityBalanceOne.class); | ||
62 | - List<ElectricityMeter> electricityMeterList = electricityBalanceOne.getData().getDatas(); | ||
63 | - for (ElectricityMeter electricityMeter : electricityMeterList){ | ||
64 | - electricityMeterMapper.insertSelective(electricityMeter); | ||
65 | - } | ||
66 | - | ||
67 | - }catch (Exception e){ | ||
68 | - e.printStackTrace(); | ||
69 | - } | ||
70 | - | ||
71 | - } | 49 | + private final static String getRoomAndDeviceUrl = "http://192.168.1.2:18080/api/emcs/getRoomAndDevice"; |
72 | 50 | ||
51 | + /** | ||
52 | + * 实施获取电表数据 | ||
53 | + */ | ||
73 | @Override | 54 | @Override |
74 | public ElectricityMeter getEnergyInfoForRealTime(String deviceId){ | 55 | public ElectricityMeter getEnergyInfoForRealTime(String deviceId){ |
75 | try { | 56 | try { |
57 | + if(!"".equals(deviceId)){ | ||
76 | Map<String, Object> stringObjectMap = eeInfo(deviceId); | 58 | Map<String, Object> stringObjectMap = eeInfo(deviceId); |
77 | String infoForRealTime = HttpsUtils.sendPost(electricityBanlanceUrl, stringObjectMap); | 59 | String infoForRealTime = HttpsUtils.sendPost(electricityBanlanceUrl, stringObjectMap); |
78 | ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(infoForRealTime, ElectricityBalanceOne.class); | 60 | ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(infoForRealTime, ElectricityBalanceOne.class); |
@@ -82,6 +64,7 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -82,6 +64,7 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
82 | return electricityBalanceThree; | 64 | return electricityBalanceThree; |
83 | } | 65 | } |
84 | } | 66 | } |
67 | + } | ||
85 | return null; | 68 | return null; |
86 | }catch (Exception e){ | 69 | }catch (Exception e){ |
87 | e.printStackTrace(); | 70 | e.printStackTrace(); |
@@ -89,6 +72,14 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -89,6 +72,14 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
89 | } | 72 | } |
90 | } | 73 | } |
91 | 74 | ||
75 | + /** | ||
76 | + * 电表充值 | ||
77 | + * @param deviceId 设备编号 | ||
78 | + * @param money 充值金额 | ||
79 | + * @param actionType 充值类型 0 充值 1 扣费 | ||
80 | + * @param orderNumber 订单号 | ||
81 | + * @return | ||
82 | + */ | ||
92 | @Override | 83 | @Override |
93 | public int rechargeDevices(String deviceId, String money, String actionType, String orderNumber) { | 84 | public int rechargeDevices(String deviceId, String money, String actionType, String orderNumber) { |
94 | 85 | ||
@@ -146,7 +137,7 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -146,7 +137,7 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
146 | */ | 137 | */ |
147 | @Scheduled(fixedDelay = 5000) | 138 | @Scheduled(fixedDelay = 5000) |
148 | public void electricityInfo(){ | 139 | public void electricityInfo(){ |
149 | - List<ElectricityInfo> electricityInfos = electricityInfoMapper.selectAll(); | 140 | + List<ElectricityInfo> electricityInfos = electricityInfoMapper.selectAll(""); |
150 | if (electricityInfos.size() > 0){ | 141 | if (electricityInfos.size() > 0){ |
151 | for (ElectricityInfo electricityInfo: electricityInfos){ | 142 | for (ElectricityInfo electricityInfo: electricityInfos){ |
152 | Map<String, Object> stringObjectMap = mapCommon(electricityInfo.getActionType(), | 143 | Map<String, Object> stringObjectMap = mapCommon(electricityInfo.getActionType(), |
@@ -158,6 +149,7 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -158,6 +149,7 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
158 | log.info("电表临时表充值请求信息:{}", electricityInfo.toString()); | 149 | log.info("电表临时表充值请求信息:{}", electricityInfo.toString()); |
159 | log.info("电表临时表充值返回信息:{}", result); | 150 | log.info("电表临时表充值返回信息:{}", result); |
160 | RechargeDevicesResult rechargeDevicesResult = JSON.parseObject(result, RechargeDevicesResult.class); | 151 | RechargeDevicesResult rechargeDevicesResult = JSON.parseObject(result, RechargeDevicesResult.class); |
152 | + if(rechargeDevicesResult.getData()!= null){ | ||
161 | List<RechargeDevicesResultData> data = rechargeDevicesResult.getData().getDatas(); | 153 | List<RechargeDevicesResultData> data = rechargeDevicesResult.getData().getDatas(); |
162 | Boolean message = null; | 154 | Boolean message = null; |
163 | for (RechargeDevicesResultData rechargeDevicesResultData : data){ | 155 | for (RechargeDevicesResultData rechargeDevicesResultData : data){ |
@@ -171,6 +163,7 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -171,6 +163,7 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
171 | } | 163 | } |
172 | } | 164 | } |
173 | } | 165 | } |
166 | + } | ||
174 | 167 | ||
175 | public Map<String, Object> mapCommon( String actionType, String deviceId, String money, String ip_address){ | 168 | public Map<String, Object> mapCommon( String actionType, String deviceId, String money, String ip_address){ |
176 | Map<String, Object> map = new HashMap<>(); | 169 | Map<String, Object> map = new HashMap<>(); |
1 | package com.sunyo.energy.location.service.imp; | 1 | package com.sunyo.energy.location.service.imp; |
2 | 2 | ||
3 | -import com.sunyo.energy.location.dao.ElectricityMeterMapper; | ||
4 | import com.sunyo.energy.location.dao.LocationMapper; | 3 | import com.sunyo.energy.location.dao.LocationMapper; |
5 | import com.sunyo.energy.location.model.ElectricityMeter; | 4 | import com.sunyo.energy.location.model.ElectricityMeter; |
6 | import com.sunyo.energy.location.model.WaterMeter; | 5 | import com.sunyo.energy.location.model.WaterMeter; |
6 | +import com.sunyo.energy.location.service.ElectricityMeterService; | ||
7 | import com.sunyo.energy.location.service.LocationService; | 7 | import com.sunyo.energy.location.service.LocationService; |
8 | import com.sunyo.energy.location.utils.AllUtils; | 8 | import com.sunyo.energy.location.utils.AllUtils; |
9 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -21,8 +21,9 @@ public class LocationServiceImp implements LocationService { | @@ -21,8 +21,9 @@ public class LocationServiceImp implements LocationService { | ||
21 | @Autowired | 21 | @Autowired |
22 | LocationMapper locationMapper; | 22 | LocationMapper locationMapper; |
23 | 23 | ||
24 | + | ||
24 | @Autowired | 25 | @Autowired |
25 | - ElectricityMeterMapper electricityMeterMapper; | 26 | + ElectricityMeterService electricityMeterService; |
26 | 27 | ||
27 | @Override | 28 | @Override |
28 | public List userPayList(String roomNumber) { | 29 | public List userPayList(String roomNumber) { |
@@ -66,15 +67,16 @@ public class LocationServiceImp implements LocationService { | @@ -66,15 +67,16 @@ public class LocationServiceImp implements LocationService { | ||
66 | * 电费查询 通过房间号查询设备id | 67 | * 电费查询 通过房间号查询设备id |
67 | */ | 68 | */ |
68 | String eeId = locationMapper.eeId(roomNumber); | 69 | String eeId = locationMapper.eeId(roomNumber); |
69 | - | ||
70 | - ElectricityMeter electricityMeter = electricityMeterMapper.selectByPrimaryKey(eeId); | 70 | + if (!"".equals(eeId)){ |
71 | + ElectricityMeter energyInfoForRealTime = electricityMeterService.getEnergyInfoForRealTime(eeId); | ||
71 | Map<String, Object> eeMap = new HashMap<>(); | 72 | Map<String, Object> eeMap = new HashMap<>(); |
72 | - if (electricityMeter != null){ | ||
73 | - eeMap.put("deviceId", electricityMeter.getDeviceId()); | ||
74 | - eeMap.put("balance", electricityMeter.getBalance()); | 73 | + if (energyInfoForRealTime != null){ |
74 | + eeMap.put("deviceId", energyInfoForRealTime.getDeviceId()); | ||
75 | + eeMap.put("balance", energyInfoForRealTime.getBalance()); | ||
75 | eeMap.put("wmId", ""); | 76 | eeMap.put("wmId", ""); |
76 | list.add(eeMap); | 77 | list.add(eeMap); |
77 | } | 78 | } |
79 | + } | ||
78 | return list; | 80 | return list; |
79 | } | 81 | } |
80 | return null; | 82 | return null; |
@@ -83,4 +85,8 @@ public class LocationServiceImp implements LocationService { | @@ -83,4 +85,8 @@ public class LocationServiceImp implements LocationService { | ||
83 | return null; | 85 | return null; |
84 | } | 86 | } |
85 | } | 87 | } |
88 | + | ||
89 | + | ||
90 | + | ||
91 | + | ||
86 | } | 92 | } |
@@ -24,11 +24,15 @@ | @@ -24,11 +24,15 @@ | ||
24 | where order_number = #{orderNumber,jdbcType=VARCHAR} | 24 | where order_number = #{orderNumber,jdbcType=VARCHAR} |
25 | </select> | 25 | </select> |
26 | 26 | ||
27 | - <select id="selectAll" resultMap="BaseResultMap"> | 27 | + <select id="selectAll" resultMap="BaseResultMap" parameterType="string"> |
28 | select | 28 | select |
29 | <include refid="Base_Column_List" /> | 29 | <include refid="Base_Column_List" /> |
30 | from electricity_info | 30 | from electricity_info |
31 | where status = '1' | 31 | where status = '1' |
32 | + <if test="deviceId != null and deviceId != ''" > | ||
33 | + and device_id = #{deviceId, jdbcType=VARCHAR} | ||
34 | + </if> | ||
35 | + order by opert_time desc | ||
32 | </select> | 36 | </select> |
33 | 37 | ||
34 | <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > | 38 | <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > |
1 | -<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | -<mapper namespace="com.sunyo.energy.location.dao.ElectricityMeterMapper" > | ||
4 | - <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.ElectricityMeter" > | ||
5 | - <id column="device_id" property="deviceId" jdbcType="VARCHAR" /> | ||
6 | - <result column="total_energy" property="totalEnergy" jdbcType="DECIMAL" /> | ||
7 | - <result column="tip_energy" property="tipEnergy" jdbcType="DECIMAL" /> | ||
8 | - <result column="peak_energy" property="peakEnergy" jdbcType="DECIMAL" /> | ||
9 | - <result column="valley_energy" property="valleyEnergy" jdbcType="DECIMAL" /> | ||
10 | - <result column="flat_energy" property="flatEnergy" jdbcType="DECIMAL" /> | ||
11 | - <result column="balance" property="balance" jdbcType="DECIMAL" /> | ||
12 | - <result column="acTime" property="actime" jdbcType="TIMESTAMP" /> | ||
13 | - <result column="updateTime" property="updatetime" jdbcType="TIMESTAMP" /> | ||
14 | - <result column="reamke1" property="reamke1" jdbcType="VARCHAR" /> | ||
15 | - <result column="reamke2" property="reamke2" jdbcType="VARCHAR" /> | ||
16 | - </resultMap> | ||
17 | - <sql id="Base_Column_List" > | ||
18 | - device_id, total_energy, tip_energy, peak_energy, valley_energy, flat_energy, balance, | ||
19 | - acTime, updateTime, reamke1, reamke2 | ||
20 | - </sql> | ||
21 | - <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > | ||
22 | - select | ||
23 | - <include refid="Base_Column_List" /> | ||
24 | - from electricity_meter | ||
25 | - where device_id = #{deviceId,jdbcType=VARCHAR} | ||
26 | - </select> | ||
27 | - <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > | ||
28 | - delete from electricity_meter | ||
29 | - where device_id = #{deviceId,jdbcType=VARCHAR} | ||
30 | - </delete> | ||
31 | - <insert id="insert" parameterType="com.sunyo.energy.location.model.ElectricityMeter" > | ||
32 | - insert into electricity_meter (device_id, total_energy, tip_energy, | ||
33 | - peak_energy, valley_energy, flat_energy, | ||
34 | - balance, acTime, updateTime, | ||
35 | - reamke1, reamke2) | ||
36 | - values (#{deviceId,jdbcType=VARCHAR}, #{totalEnergy,jdbcType=DECIMAL}, #{tipEnergy,jdbcType=DECIMAL}, | ||
37 | - #{peakEnergy,jdbcType=DECIMAL}, #{valleyEnergy,jdbcType=DECIMAL}, #{flatEnergy,jdbcType=DECIMAL}, | ||
38 | - #{balance,jdbcType=DECIMAL}, #{actime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP}, | ||
39 | - #{reamke1,jdbcType=VARCHAR}, #{reamke2,jdbcType=VARCHAR}) | ||
40 | - </insert> | ||
41 | - <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.ElectricityMeter" > | ||
42 | - insert into electricity_meter | ||
43 | - <trim prefix="(" suffix=")" suffixOverrides="," > | ||
44 | - <if test="deviceId != null" > | ||
45 | - device_id, | ||
46 | - </if> | ||
47 | - <if test="totalEnergy != null" > | ||
48 | - total_energy, | ||
49 | - </if> | ||
50 | - <if test="tipEnergy != null" > | ||
51 | - tip_energy, | ||
52 | - </if> | ||
53 | - <if test="peakEnergy != null" > | ||
54 | - peak_energy, | ||
55 | - </if> | ||
56 | - <if test="valleyEnergy != null" > | ||
57 | - valley_energy, | ||
58 | - </if> | ||
59 | - <if test="flatEnergy != null" > | ||
60 | - flat_energy, | ||
61 | - </if> | ||
62 | - <if test="balance != null" > | ||
63 | - balance, | ||
64 | - </if> | ||
65 | - <if test="actime != null" > | ||
66 | - acTime, | ||
67 | - </if> | ||
68 | - <if test="updatetime != null" > | ||
69 | - updateTime, | ||
70 | - </if> | ||
71 | - <if test="reamke1 != null" > | ||
72 | - reamke1, | ||
73 | - </if> | ||
74 | - <if test="reamke2 != null" > | ||
75 | - reamke2, | ||
76 | - </if> | ||
77 | - </trim> | ||
78 | - <trim prefix="values (" suffix=")" suffixOverrides="," > | ||
79 | - <if test="deviceId != null" > | ||
80 | - #{deviceId,jdbcType=VARCHAR}, | ||
81 | - </if> | ||
82 | - <if test="totalEnergy != null" > | ||
83 | - #{totalEnergy,jdbcType=DECIMAL}, | ||
84 | - </if> | ||
85 | - <if test="tipEnergy != null" > | ||
86 | - #{tipEnergy,jdbcType=DECIMAL}, | ||
87 | - </if> | ||
88 | - <if test="peakEnergy != null" > | ||
89 | - #{peakEnergy,jdbcType=DECIMAL}, | ||
90 | - </if> | ||
91 | - <if test="valleyEnergy != null" > | ||
92 | - #{valleyEnergy,jdbcType=DECIMAL}, | ||
93 | - </if> | ||
94 | - <if test="flatEnergy != null" > | ||
95 | - #{flatEnergy,jdbcType=DECIMAL}, | ||
96 | - </if> | ||
97 | - <if test="balance != null" > | ||
98 | - #{balance,jdbcType=DECIMAL}, | ||
99 | - </if> | ||
100 | - <if test="actime != null" > | ||
101 | - #{actime,jdbcType=TIMESTAMP}, | ||
102 | - </if> | ||
103 | - <if test="updatetime != null" > | ||
104 | - #{updatetime,jdbcType=TIMESTAMP}, | ||
105 | - </if> | ||
106 | - <if test="reamke1 != null" > | ||
107 | - #{reamke1,jdbcType=VARCHAR}, | ||
108 | - </if> | ||
109 | - <if test="reamke2 != null" > | ||
110 | - #{reamke2,jdbcType=VARCHAR}, | ||
111 | - </if> | ||
112 | - </trim> | ||
113 | - </insert> | ||
114 | - <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.ElectricityMeter" > | ||
115 | - update electricity_meter | ||
116 | - <set > | ||
117 | - <if test="totalEnergy != null" > | ||
118 | - total_energy = #{totalEnergy,jdbcType=DECIMAL}, | ||
119 | - </if> | ||
120 | - <if test="tipEnergy != null" > | ||
121 | - tip_energy = #{tipEnergy,jdbcType=DECIMAL}, | ||
122 | - </if> | ||
123 | - <if test="peakEnergy != null" > | ||
124 | - peak_energy = #{peakEnergy,jdbcType=DECIMAL}, | ||
125 | - </if> | ||
126 | - <if test="valleyEnergy != null" > | ||
127 | - valley_energy = #{valleyEnergy,jdbcType=DECIMAL}, | ||
128 | - </if> | ||
129 | - <if test="flatEnergy != null" > | ||
130 | - flat_energy = #{flatEnergy,jdbcType=DECIMAL}, | ||
131 | - </if> | ||
132 | - <if test="balance != null" > | ||
133 | - balance = #{balance,jdbcType=DECIMAL}, | ||
134 | - </if> | ||
135 | - <if test="actime != null" > | ||
136 | - acTime = #{actime,jdbcType=TIMESTAMP}, | ||
137 | - </if> | ||
138 | - <if test="updatetime != null" > | ||
139 | - updateTime = #{updatetime,jdbcType=TIMESTAMP}, | ||
140 | - </if> | ||
141 | - <if test="reamke1 != null" > | ||
142 | - reamke1 = #{reamke1,jdbcType=VARCHAR}, | ||
143 | - </if> | ||
144 | - <if test="reamke2 != null" > | ||
145 | - reamke2 = #{reamke2,jdbcType=VARCHAR}, | ||
146 | - </if> | ||
147 | - </set> | ||
148 | - where device_id = #{deviceId,jdbcType=VARCHAR} | ||
149 | - </update> | ||
150 | - <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.ElectricityMeter" > | ||
151 | - update electricity_meter | ||
152 | - set total_energy = #{totalEnergy,jdbcType=DECIMAL}, | ||
153 | - tip_energy = #{tipEnergy,jdbcType=DECIMAL}, | ||
154 | - peak_energy = #{peakEnergy,jdbcType=DECIMAL}, | ||
155 | - valley_energy = #{valleyEnergy,jdbcType=DECIMAL}, | ||
156 | - flat_energy = #{flatEnergy,jdbcType=DECIMAL}, | ||
157 | - balance = #{balance,jdbcType=DECIMAL}, | ||
158 | - acTime = #{actime,jdbcType=TIMESTAMP}, | ||
159 | - updateTime = #{updatetime,jdbcType=TIMESTAMP}, | ||
160 | - reamke1 = #{reamke1,jdbcType=VARCHAR}, | ||
161 | - reamke2 = #{reamke2,jdbcType=VARCHAR} | ||
162 | - where device_id = #{deviceId,jdbcType=VARCHAR} | ||
163 | - </update> | ||
164 | -</mapper> |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | <result column="adrName" property="adrname" jdbcType="VARCHAR" /> | 8 | <result column="adrName" property="adrname" jdbcType="VARCHAR" /> |
9 | <result column="parent" property="parent" jdbcType="INTEGER" /> | 9 | <result column="parent" property="parent" jdbcType="INTEGER" /> |
10 | <result column="type" property="type" jdbcType="INTEGER" /> | 10 | <result column="type" property="type" jdbcType="INTEGER" /> |
11 | - <collection property="children" select="selectAll" column="id"></collection> | 11 | +<!-- <collection property="children" select="selectAll" column="id"></collection>--> |
12 | </resultMap> | 12 | </resultMap> |
13 | <sql id="Base_Column_List" > | 13 | <sql id="Base_Column_List" > |
14 | id, adrName, parent, type, wm_id, ee_id | 14 | id, adrName, parent, type, wm_id, ee_id |
@@ -140,6 +140,9 @@ | @@ -140,6 +140,9 @@ | ||
140 | <if test="wmid != null" > | 140 | <if test="wmid != null" > |
141 | wm_id = #{wmid,jdbcType=VARCHAR}, | 141 | wm_id = #{wmid,jdbcType=VARCHAR}, |
142 | </if> | 142 | </if> |
143 | + <if test="eeid != null" > | ||
144 | + ee_id = #{eeid,jdbcType=VARCHAR} | ||
145 | + </if> | ||
143 | </set> | 146 | </set> |
144 | where id = #{id,jdbcType=INTEGER} | 147 | where id = #{id,jdbcType=INTEGER} |
145 | </update> | 148 | </update> |
-
请 注册 或 登录 后发表评论