正在显示
12 个修改的文件
包含
432 行增加
和
20 行删除
@@ -156,4 +156,5 @@ eeUrl: | @@ -156,4 +156,5 @@ eeUrl: | ||
156 | #获取电表实时数据/余额 | 156 | #获取电表实时数据/余额 |
157 | # electricityBanlanceUrl: "http://10.5.10.102:8000/api/emcs/getEnergyInfoForRealTime" | 157 | # electricityBanlanceUrl: "http://10.5.10.102:8000/api/emcs/getEnergyInfoForRealTime" |
158 | electricityBanlanceUrl: "http://192.168.1.199:18080/api/emcs/getEnergyInfoForRealTime" | 158 | electricityBanlanceUrl: "http://192.168.1.199:18080/api/emcs/getEnergyInfoForRealTime" |
159 | - informMoney: "50" | 159 | +waterUrl: |
160 | + getSelectNowwmrdbyMtId: "http://123:56:159:203:8023/nowwmrd/getSelectNowwmrdbyMtId" |
1 | package com.sunyo.energy.location.controller; | 1 | package com.sunyo.energy.location.controller; |
2 | 2 | ||
3 | 3 | ||
4 | -import com.sunyo.energy.location.model.ElectricityMeter; | ||
5 | -import com.sunyo.energy.location.model.InformElectricity; | ||
6 | -import com.sunyo.energy.location.model.NoteInform; | 4 | +import com.sunyo.energy.location.model.*; |
7 | import com.sunyo.energy.location.service.InformElectricityService; | 5 | import com.sunyo.energy.location.service.InformElectricityService; |
6 | +import com.sunyo.energy.location.service.InformWaterService; | ||
8 | import com.sunyo.energy.location.service.NoteInformService; | 7 | import com.sunyo.energy.location.service.NoteInformService; |
9 | import com.sunyo.energy.location.utils.CallWebServiceUtils; | 8 | import com.sunyo.energy.location.utils.CallWebServiceUtils; |
10 | import com.sunyo.energy.location.utils.WaterEleUtils; | 9 | import com.sunyo.energy.location.utils.WaterEleUtils; |
11 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
12 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
13 | import org.springframework.scheduling.annotation.Scheduled; | 12 | import org.springframework.scheduling.annotation.Scheduled; |
13 | +import org.springframework.util.StringUtils; | ||
14 | import org.springframework.web.bind.annotation.RequestMapping; | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
15 | import org.springframework.web.bind.annotation.RestController; | 15 | import org.springframework.web.bind.annotation.RestController; |
16 | 16 | ||
17 | +import java.math.BigDecimal; | ||
17 | import java.util.List; | 18 | import java.util.List; |
18 | 19 | ||
19 | /** | 20 | /** |
@@ -32,27 +33,33 @@ public class NoteInformController { | @@ -32,27 +33,33 @@ public class NoteInformController { | ||
32 | @Autowired | 33 | @Autowired |
33 | NoteInformService noteInformService; | 34 | NoteInformService noteInformService; |
34 | 35 | ||
36 | + @Autowired | ||
37 | + InformWaterService informWaterService; | ||
38 | + | ||
39 | + @Autowired | ||
40 | + WaterEleUtils waterEleUtils; | ||
41 | + | ||
35 | /** | 42 | /** |
36 | - * 短信通知接口 | 43 | + * 电表短信通知接口 |
37 | */ | 44 | */ |
38 | @RequestMapping("/note") | 45 | @RequestMapping("/note") |
39 | - @Scheduled | ||
40 | - public void note(){ | 46 | + @Scheduled(cron = "0 0 10 * * ?") |
47 | + public void note_ele(){ | ||
41 | /** | 48 | /** |
42 | * 通知电表 | 49 | * 通知电表 |
43 | */ | 50 | */ |
44 | try { | 51 | try { |
45 | List<InformElectricity> informElectricitieList = informElectricityService.selectAll(); | 52 | List<InformElectricity> informElectricitieList = informElectricityService.selectAll(); |
46 | - WaterEleUtils waterEleUtils = new WaterEleUtils(); | ||
47 | // 取出每一个房间信息 | 53 | // 取出每一个房间信息 |
48 | for (InformElectricity informElectricity: informElectricitieList){ | 54 | for (InformElectricity informElectricity: informElectricitieList){ |
49 | // 循环查询该设备用电余额 | 55 | // 循环查询该设备用电余额 |
50 | ElectricityMeter energyInfoForRealTime = waterEleUtils.getEnergyInfoForRealTime(informElectricity.getEeId()); | 56 | ElectricityMeter energyInfoForRealTime = waterEleUtils.getEnergyInfoForRealTime(informElectricity.getEeId()); |
51 | // 是否满足通知条件 | 57 | // 是否满足通知条件 |
52 | - boolean eleMoney = waterEleUtils.eleMoney(energyInfoForRealTime.getBalance()); | 58 | + boolean eleMoney = waterEleUtils.eleMoney(energyInfoForRealTime.getBalance(), "50"); |
53 | if (eleMoney){ | 59 | if (eleMoney){ |
60 | + log.info("需要提醒手机号码为:{}", informElectricity.getInformPhone()); | ||
54 | int i = CallWebServiceUtils.sendSMSPost(informElectricity.getInformPhone(), | 61 | int i = CallWebServiceUtils.sendSMSPost(informElectricity.getInformPhone(), |
55 | - "您所在的宿舍" + informElectricity.getRoomName() + "电费已不足50元,为避免停电造成不变,请及时充值", | 62 | + "您所在的宿舍" + informElectricity.getRoomName() + "电费已不足50元,为避免停电造成不便,请及时充值。", |
56 | ""); | 63 | ""); |
57 | if (i > 0){ | 64 | if (i > 0){ |
58 | // 成功修改为通知状态为否 | 65 | // 成功修改为通知状态为否 |
@@ -61,6 +68,48 @@ public class NoteInformController { | @@ -61,6 +68,48 @@ public class NoteInformController { | ||
61 | noteInform.setId(informElectricity.getId()); | 68 | noteInform.setId(informElectricity.getId()); |
62 | noteInformService.updateByPrimaryKeySelective(noteInform); | 69 | noteInformService.updateByPrimaryKeySelective(noteInform); |
63 | log.info("电表余额短信提醒成功房间号码为:{}", informElectricity.getRoomName()); | 70 | log.info("电表余额短信提醒成功房间号码为:{}", informElectricity.getRoomName()); |
71 | + log.info("电表余额短信提醒成功电话号码为:{}", informElectricity.getInformPhone()); | ||
72 | + } | ||
73 | + } | ||
74 | + } | ||
75 | + }catch (Exception e){ | ||
76 | + e.printStackTrace(); | ||
77 | + } | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * 短信水表通知接口 | ||
82 | + */ | ||
83 | + @RequestMapping("/note_water") | ||
84 | + @Scheduled(cron = "0 0 10 * * ?") | ||
85 | + public void note_water(){ | ||
86 | + | ||
87 | + try { | ||
88 | + List<InformWater> informWaterList = informWaterService.selectAll(); | ||
89 | + // 取出每一个房间信息 | ||
90 | + for (InformWater informWater: informWaterList){ | ||
91 | + // 查询该水表 累计消费量 | ||
92 | + String realTime = waterEleUtils.findRealTime(informWater.getWmId()); | ||
93 | + // 查询水表累计充值量 | ||
94 | + WaterMeterSacc waterMeterSacc = informWaterService.selectByPrimaryKey(informWater.getWmId()); | ||
95 | + if (!StringUtils.isEmpty(realTime) && waterMeterSacc != null){ | ||
96 | + // 计算现有量 | ||
97 | + String margin = waterEleUtils.nubmerSubtraction(String.valueOf(waterMeterSacc.getWmSacc()), realTime); | ||
98 | + boolean eleMoney = waterEleUtils.eleMoney(new BigDecimal(margin), "3"); | ||
99 | + if (eleMoney){ | ||
100 | + log.info("需要提醒手机号码为:{}", informWater.getInformPhone()); | ||
101 | + int i = CallWebServiceUtils.sendSMSPost(informWater.getInformPhone(), | ||
102 | + "您所在的宿舍" + informWater.getRoomName() + "水量已不足3吨,为避免停水造成不便,请及时充值。", | ||
103 | + ""); | ||
104 | + if (i > 0){ | ||
105 | + // 成功修改为通知状态为否 | ||
106 | + NoteInform noteInform = new NoteInform(); | ||
107 | + noteInform.setInformStatus("1"); | ||
108 | + noteInform.setId(informWater.getId()); | ||
109 | + noteInformService.updateByPrimaryKeySelective(noteInform); | ||
110 | + log.info("水表余额短信提醒成功房间号码为:{}", informWater.getRoomName()); | ||
111 | + log.info("水表余额短信提醒成功电话号码为:{}", informWater.getInformPhone()); | ||
112 | + } | ||
64 | } | 113 | } |
65 | } | 114 | } |
66 | } | 115 | } |
1 | +package com.sunyo.energy.location.dao; | ||
2 | + | ||
3 | +import com.sunyo.energy.location.model.InformWater; | ||
4 | +import jdk.internal.dynalink.linker.LinkerServices; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +public interface InformWaterMapper { | ||
9 | + int insert(InformWater record); | ||
10 | + | ||
11 | + int insertSelective(InformWater record); | ||
12 | + | ||
13 | + List<InformWater> selectAll(); | ||
14 | + | ||
15 | +} |
1 | +package com.sunyo.energy.location.dao; | ||
2 | + | ||
3 | +import com.sunyo.energy.location.model.WaterMeterSacc; | ||
4 | + | ||
5 | +public interface WaterMeterSaccMapper { | ||
6 | + int deleteByPrimaryKey(String wmId); | ||
7 | + | ||
8 | + int insert(WaterMeterSacc record); | ||
9 | + | ||
10 | + int insertSelective(WaterMeterSacc record); | ||
11 | + | ||
12 | + WaterMeterSacc selectByPrimaryKey(String wmId); | ||
13 | + | ||
14 | + int updateByPrimaryKeySelective(WaterMeterSacc record); | ||
15 | + | ||
16 | + int updateByPrimaryKey(WaterMeterSacc record); | ||
17 | +} |
1 | +package com.sunyo.energy.location.model; | ||
2 | + | ||
3 | +public class InformWater { | ||
4 | + private String informMoney; | ||
5 | + | ||
6 | + private String informPhone; | ||
7 | + | ||
8 | + private String roomName; | ||
9 | + | ||
10 | + private String wmId; | ||
11 | + | ||
12 | + private Integer id; | ||
13 | + | ||
14 | + public String getInformMoney() { | ||
15 | + return informMoney; | ||
16 | + } | ||
17 | + | ||
18 | + public void setInformMoney(String informMoney) { | ||
19 | + this.informMoney = informMoney == null ? null : informMoney.trim(); | ||
20 | + } | ||
21 | + | ||
22 | + public String getInformPhone() { | ||
23 | + return informPhone; | ||
24 | + } | ||
25 | + | ||
26 | + public void setInformPhone(String informPhone) { | ||
27 | + this.informPhone = informPhone == null ? null : informPhone.trim(); | ||
28 | + } | ||
29 | + | ||
30 | + public String getRoomName() { | ||
31 | + return roomName; | ||
32 | + } | ||
33 | + | ||
34 | + public void setRoomName(String roomName) { | ||
35 | + this.roomName = roomName == null ? null : roomName.trim(); | ||
36 | + } | ||
37 | + | ||
38 | + public String getWmId() { | ||
39 | + return wmId; | ||
40 | + } | ||
41 | + | ||
42 | + public void setWmId(String wmId) { | ||
43 | + this.wmId = wmId == null ? null : wmId.trim(); | ||
44 | + } | ||
45 | + | ||
46 | + public Integer getId() { | ||
47 | + return id; | ||
48 | + } | ||
49 | + | ||
50 | + public void setId(Integer id) { | ||
51 | + this.id = id; | ||
52 | + } | ||
53 | +} |
1 | +package com.sunyo.energy.location.model; | ||
2 | + | ||
3 | +import java.math.BigDecimal; | ||
4 | + | ||
5 | +public class WaterMeterSacc { | ||
6 | + private String wmId; | ||
7 | + | ||
8 | + private String ardname; | ||
9 | + | ||
10 | + private BigDecimal unitPrice; | ||
11 | + | ||
12 | + private BigDecimal wmSacc; | ||
13 | + | ||
14 | + public String getWmId() { | ||
15 | + return wmId; | ||
16 | + } | ||
17 | + | ||
18 | + public void setWmId(String wmId) { | ||
19 | + this.wmId = wmId == null ? null : wmId.trim(); | ||
20 | + } | ||
21 | + | ||
22 | + public String getArdname() { | ||
23 | + return ardname; | ||
24 | + } | ||
25 | + | ||
26 | + public void setArdname(String ardname) { | ||
27 | + this.ardname = ardname == null ? null : ardname.trim(); | ||
28 | + } | ||
29 | + | ||
30 | + public BigDecimal getUnitPrice() { | ||
31 | + return unitPrice; | ||
32 | + } | ||
33 | + | ||
34 | + public void setUnitPrice(BigDecimal unitPrice) { | ||
35 | + this.unitPrice = unitPrice; | ||
36 | + } | ||
37 | + | ||
38 | + public BigDecimal getWmSacc() { | ||
39 | + return wmSacc; | ||
40 | + } | ||
41 | + | ||
42 | + public void setWmSacc(BigDecimal wmSacc) { | ||
43 | + this.wmSacc = wmSacc; | ||
44 | + } | ||
45 | +} |
1 | +package com.sunyo.energy.location.service.Imp; | ||
2 | + | ||
3 | +import com.sunyo.energy.location.dao.InformWaterMapper; | ||
4 | +import com.sunyo.energy.location.dao.WaterMeterSaccMapper; | ||
5 | +import com.sunyo.energy.location.model.InformWater; | ||
6 | +import com.sunyo.energy.location.model.WaterMeterSacc; | ||
7 | +import com.sunyo.energy.location.service.InformWaterService; | ||
8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | + | ||
11 | +import java.util.List; | ||
12 | + | ||
13 | +/** | ||
14 | + * @author shenhailong | ||
15 | + * <p> | ||
16 | + * 2020/7/24/10:15 | ||
17 | + */ | ||
18 | +@Service | ||
19 | +public class InformWaterServiceImp implements InformWaterService { | ||
20 | + | ||
21 | + @Autowired | ||
22 | + InformWaterMapper informWaterMapper; | ||
23 | + | ||
24 | + @Autowired | ||
25 | + WaterMeterSaccMapper waterMeterSaccMapper; | ||
26 | + | ||
27 | + @Override | ||
28 | + public List<InformWater> selectAll() { | ||
29 | + return informWaterMapper.selectAll(); | ||
30 | + } | ||
31 | + | ||
32 | + @Override | ||
33 | + public WaterMeterSacc selectByPrimaryKey(String wmId) { | ||
34 | + return waterMeterSaccMapper.selectByPrimaryKey(wmId); | ||
35 | + } | ||
36 | +} |
1 | +package com.sunyo.energy.location.service; | ||
2 | + | ||
3 | +import com.sunyo.energy.location.model.InformWater; | ||
4 | +import com.sunyo.energy.location.model.WaterMeterSacc; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author shenhailong | ||
10 | + * <p> | ||
11 | + * 2020/7/24/10:14 | ||
12 | + */ | ||
13 | +public interface InformWaterService { | ||
14 | + | ||
15 | + List<InformWater> selectAll(); | ||
16 | + | ||
17 | + WaterMeterSacc selectByPrimaryKey(String wmId); | ||
18 | + | ||
19 | +} |
@@ -24,8 +24,8 @@ import java.util.Map; | @@ -24,8 +24,8 @@ import java.util.Map; | ||
24 | */ | 24 | */ |
25 | public class CallWebServiceUtils { | 25 | public class CallWebServiceUtils { |
26 | 26 | ||
27 | - private static final String CorpID="HNJC002221";// 接口账号 | ||
28 | - private static final String Pwd="dxpt2221"; // 接口密码 | 27 | + private static final String CorpID="HNJC010282";// 接口账号 |
28 | + private static final String Pwd="dxpt0282"; // 接口密码 | ||
29 | 29 | ||
30 | 30 | ||
31 | public static void main(String[] args) throws MalformedURLException, UnsupportedEncodingException { | 31 | public static void main(String[] args) throws MalformedURLException, UnsupportedEncodingException { |
@@ -33,7 +33,7 @@ public class CallWebServiceUtils { | @@ -33,7 +33,7 @@ public class CallWebServiceUtils { | ||
33 | System.out.println(i); | 33 | System.out.println(i); |
34 | } | 34 | } |
35 | 35 | ||
36 | - /** | 36 | + /**782540484 |
37 | * Hppt POST请求发送方法 返回值>0 为 提交成功 | 37 | * Hppt POST请求发送方法 返回值>0 为 提交成功 |
38 | * | 38 | * |
39 | * @param Mobile | 39 | * @param Mobile |
1 | package com.sunyo.energy.location.utils; | 1 | package com.sunyo.energy.location.utils; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
4 | +import com.alibaba.fastjson.JSONArray; | ||
4 | import com.sunyo.energy.location.model.ElectricityBalanceOne; | 5 | import com.sunyo.energy.location.model.ElectricityBalanceOne; |
5 | import com.sunyo.energy.location.model.ElectricityMeter; | 6 | import com.sunyo.energy.location.model.ElectricityMeter; |
6 | import org.springframework.beans.factory.annotation.Value; | 7 | import org.springframework.beans.factory.annotation.Value; |
@@ -26,11 +27,9 @@ public class WaterEleUtils { | @@ -26,11 +27,9 @@ public class WaterEleUtils { | ||
26 | @Value("${eeUrl.electricityBanlanceUrl}") | 27 | @Value("${eeUrl.electricityBanlanceUrl}") |
27 | private String electricityBanlanceUrl; | 28 | private String electricityBanlanceUrl; |
28 | 29 | ||
29 | - /** | ||
30 | - * 电表通知余额 | ||
31 | - */ | ||
32 | - @Value("${eeUrl.informMoney}") | ||
33 | - private String informMoney; | 30 | + @Value("${waterUrl.getSelectNowwmrdbyMtId}") |
31 | + private String getSelectNowwmrdbyMtId; | ||
32 | + | ||
34 | 33 | ||
35 | /** | 34 | /** |
36 | * 实施获取电表数据 | 35 | * 实施获取电表数据 |
@@ -62,12 +61,49 @@ public class WaterEleUtils { | @@ -62,12 +61,49 @@ public class WaterEleUtils { | ||
62 | return datas; | 61 | return datas; |
63 | } | 62 | } |
64 | 63 | ||
65 | - public boolean eleMoney(BigDecimal bigDecimal){ | ||
66 | - if (bigDecimal.compareTo(new BigDecimal(informMoney)) == -1){ | 64 | + public boolean eleMoney(BigDecimal bigDecimal, String money){ |
65 | + if (bigDecimal.compareTo(new BigDecimal(money)) == -1){ | ||
67 | return true; | 66 | return true; |
68 | }else { | 67 | }else { |
69 | return false; | 68 | return false; |
70 | } | 69 | } |
71 | } | 70 | } |
72 | 71 | ||
72 | + /** | ||
73 | + * 实施获取水表信息 | ||
74 | + */ | ||
75 | + public String findRealTime(String wmId) { | ||
76 | + try { | ||
77 | + Map<String, Object> datas = new HashMap<>(); | ||
78 | + datas.put("MtId", wmId); | ||
79 | + | ||
80 | + String s = HttpsUtils.httpRequest(getSelectNowwmrdbyMtId, datas); | ||
81 | + JSONArray jsonArray = JSON.parseArray(s); | ||
82 | + String wmLacc = ""; | ||
83 | + for (Object jsonObject : jsonArray) { | ||
84 | + Map<String, Object> map = (Map) jsonObject; | ||
85 | + if (!map.containsKey("state")) { | ||
86 | + // 获取累计消费量 | ||
87 | + wmLacc = map.get("wm_lacc").toString(); | ||
88 | + } | ||
89 | + } | ||
90 | + return wmLacc; | ||
91 | + } catch (Exception e) { | ||
92 | + e.printStackTrace(); | ||
93 | + return null; | ||
94 | + } | ||
95 | + } | ||
96 | + | ||
97 | + // 数字相减 参数1 减去 参数2 | ||
98 | + public String nubmerSubtraction(String sacc, String lacc) { | ||
99 | + | ||
100 | + BigDecimal saccBigDecimal = new BigDecimal(sacc); | ||
101 | + BigDecimal laccBigDecimal = new BigDecimal(lacc); | ||
102 | + | ||
103 | + String surplus = saccBigDecimal.subtract(laccBigDecimal).toString(); | ||
104 | + | ||
105 | + return surplus; | ||
106 | + | ||
107 | + } | ||
108 | + | ||
73 | } | 109 | } |
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.InformWaterMapper" > | ||
4 | + <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.InformWater" > | ||
5 | + <result column="inform_money" property="informMoney" jdbcType="VARCHAR" /> | ||
6 | + <result column="inform_phone" property="informPhone" jdbcType="VARCHAR" /> | ||
7 | + <result column="room_name" property="roomName" jdbcType="VARCHAR" /> | ||
8 | + <result column="wm_id" property="wmId" jdbcType="VARCHAR" /> | ||
9 | + <result column="id" property="id" jdbcType="INTEGER" /> | ||
10 | + </resultMap> | ||
11 | + | ||
12 | + <select id="selectAll" resultMap="BaseResultMap"> | ||
13 | + select * from inform_water | ||
14 | + </select> | ||
15 | + | ||
16 | + <insert id="insert" parameterType="com.sunyo.energy.location.model.InformWater" > | ||
17 | + insert into inform_water (inform_money, inform_phone, room_name, | ||
18 | + wm_id, id) | ||
19 | + values (#{informMoney,jdbcType=VARCHAR}, #{informPhone,jdbcType=VARCHAR}, #{roomName,jdbcType=VARCHAR}, | ||
20 | + #{wmId,jdbcType=VARCHAR}, #{id,jdbcType=INTEGER}) | ||
21 | + </insert> | ||
22 | + <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.InformWater" > | ||
23 | + insert into inform_water | ||
24 | + <trim prefix="(" suffix=")" suffixOverrides="," > | ||
25 | + <if test="informMoney != null" > | ||
26 | + inform_money, | ||
27 | + </if> | ||
28 | + <if test="informPhone != null" > | ||
29 | + inform_phone, | ||
30 | + </if> | ||
31 | + <if test="roomName != null" > | ||
32 | + room_name, | ||
33 | + </if> | ||
34 | + <if test="wmId != null" > | ||
35 | + wm_id, | ||
36 | + </if> | ||
37 | + <if test="id != null" > | ||
38 | + id, | ||
39 | + </if> | ||
40 | + </trim> | ||
41 | + <trim prefix="values (" suffix=")" suffixOverrides="," > | ||
42 | + <if test="informMoney != null" > | ||
43 | + #{informMoney,jdbcType=VARCHAR}, | ||
44 | + </if> | ||
45 | + <if test="informPhone != null" > | ||
46 | + #{informPhone,jdbcType=VARCHAR}, | ||
47 | + </if> | ||
48 | + <if test="roomName != null" > | ||
49 | + #{roomName,jdbcType=VARCHAR}, | ||
50 | + </if> | ||
51 | + <if test="wmId != null" > | ||
52 | + #{wmId,jdbcType=VARCHAR}, | ||
53 | + </if> | ||
54 | + <if test="id != null" > | ||
55 | + #{id,jdbcType=INTEGER}, | ||
56 | + </if> | ||
57 | + </trim> | ||
58 | + </insert> | ||
59 | +</mapper> |
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.WaterMeterSaccMapper" > | ||
4 | + <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.WaterMeterSacc" > | ||
5 | + <id column="wm_id" property="wmId" jdbcType="VARCHAR" /> | ||
6 | + <result column="ardname" property="ardname" jdbcType="VARCHAR" /> | ||
7 | + <result column="unit_price" property="unitPrice" jdbcType="DECIMAL" /> | ||
8 | + <result column="wm_sacc" property="wmSacc" jdbcType="DECIMAL" /> | ||
9 | + </resultMap> | ||
10 | + <sql id="Base_Column_List" > | ||
11 | + wm_id, ardname, unit_price, wm_sacc | ||
12 | + </sql> | ||
13 | + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > | ||
14 | + select | ||
15 | + <include refid="Base_Column_List" /> | ||
16 | + from water_meter_sacc | ||
17 | + where wm_id = #{wmId,jdbcType=VARCHAR} | ||
18 | + </select> | ||
19 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > | ||
20 | + delete from water_meter_sacc | ||
21 | + where wm_id = #{wmId,jdbcType=VARCHAR} | ||
22 | + </delete> | ||
23 | + <insert id="insert" parameterType="com.sunyo.energy.location.model.WaterMeterSacc" > | ||
24 | + insert into water_meter_sacc (wm_id, ardname, unit_price, | ||
25 | + wm_sacc) | ||
26 | + values (#{wmId,jdbcType=VARCHAR}, #{ardname,jdbcType=VARCHAR}, #{unitPrice,jdbcType=DECIMAL}, | ||
27 | + #{wmSacc,jdbcType=DECIMAL}) | ||
28 | + </insert> | ||
29 | + <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.WaterMeterSacc" > | ||
30 | + insert into water_meter_sacc | ||
31 | + <trim prefix="(" suffix=")" suffixOverrides="," > | ||
32 | + <if test="wmId != null" > | ||
33 | + wm_id, | ||
34 | + </if> | ||
35 | + <if test="ardname != null" > | ||
36 | + ardname, | ||
37 | + </if> | ||
38 | + <if test="unitPrice != null" > | ||
39 | + unit_price, | ||
40 | + </if> | ||
41 | + <if test="wmSacc != null" > | ||
42 | + wm_sacc, | ||
43 | + </if> | ||
44 | + </trim> | ||
45 | + <trim prefix="values (" suffix=")" suffixOverrides="," > | ||
46 | + <if test="wmId != null" > | ||
47 | + #{wmId,jdbcType=VARCHAR}, | ||
48 | + </if> | ||
49 | + <if test="ardname != null" > | ||
50 | + #{ardname,jdbcType=VARCHAR}, | ||
51 | + </if> | ||
52 | + <if test="unitPrice != null" > | ||
53 | + #{unitPrice,jdbcType=DECIMAL}, | ||
54 | + </if> | ||
55 | + <if test="wmSacc != null" > | ||
56 | + #{wmSacc,jdbcType=DECIMAL}, | ||
57 | + </if> | ||
58 | + </trim> | ||
59 | + </insert> | ||
60 | + <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.WaterMeterSacc" > | ||
61 | + update water_meter_sacc | ||
62 | + <set > | ||
63 | + <if test="ardname != null" > | ||
64 | + ardname = #{ardname,jdbcType=VARCHAR}, | ||
65 | + </if> | ||
66 | + <if test="unitPrice != null" > | ||
67 | + unit_price = #{unitPrice,jdbcType=DECIMAL}, | ||
68 | + </if> | ||
69 | + <if test="wmSacc != null" > | ||
70 | + wm_sacc = #{wmSacc,jdbcType=DECIMAL}, | ||
71 | + </if> | ||
72 | + </set> | ||
73 | + where wm_id = #{wmId,jdbcType=VARCHAR} | ||
74 | + </update> | ||
75 | + <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.WaterMeterSacc" > | ||
76 | + update water_meter_sacc | ||
77 | + set ardname = #{ardname,jdbcType=VARCHAR}, | ||
78 | + unit_price = #{unitPrice,jdbcType=DECIMAL}, | ||
79 | + wm_sacc = #{wmSacc,jdbcType=DECIMAL} | ||
80 | + where wm_id = #{wmId,jdbcType=VARCHAR} | ||
81 | + </update> | ||
82 | +</mapper> |
-
请 注册 或 登录 后发表评论