作者 shenhailong

公寓绑定水表信息

1 package com.sunyo.energy.location.controller; 1 package com.sunyo.energy.location.controller;
2 2
  3 +import com.sunyo.energy.location.controller.response.ResultJson;
3 import com.sunyo.energy.location.model.WaterMeter; 4 import com.sunyo.energy.location.model.WaterMeter;
4 import com.sunyo.energy.location.service.WaterMeterService; 5 import com.sunyo.energy.location.service.WaterMeterService;
5 import io.swagger.annotations.ApiOperation; 6 import io.swagger.annotations.ApiOperation;
@@ -9,8 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping; @@ -9,8 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RequestParam; 10 import org.springframework.web.bind.annotation.RequestParam;
10 import org.springframework.web.bind.annotation.ResponseBody; 11 import org.springframework.web.bind.annotation.ResponseBody;
11 12
12 -import java.util.List;  
13 -  
14 @Controller 13 @Controller
15 @RequestMapping("/water_meter") 14 @RequestMapping("/water_meter")
16 public class WaterMeterController { 15 public class WaterMeterController {
@@ -27,5 +26,13 @@ public class WaterMeterController { @@ -27,5 +26,13 @@ public class WaterMeterController {
27 return waterMeterService.findRealTime(wmId); 26 return waterMeterService.findRealTime(wmId);
28 } 27 }
29 28
  29 + @ApiOperation(value = "查询所有水表编号")
  30 + @RequestMapping("/waterMeterAll")
  31 + @ResponseBody
  32 + public ResultJson waterMeterAll(@RequestParam(value = "wmId", required = false) String wmId){
  33 +
  34 + return waterMeterService.waterMeterAll(wmId);
  35 + }
  36 +
30 37
31 } 38 }
@@ -6,6 +6,9 @@ import org.apache.ibatis.annotations.Param; @@ -6,6 +6,9 @@ import org.apache.ibatis.annotations.Param;
6 import java.util.List; 6 import java.util.List;
7 7
8 public interface WaterMeterMapper { 8 public interface WaterMeterMapper {
  9 +
  10 + List<WaterMeter> waterMeterAll(String wmId);
  11 +
9 int insert(WaterMeter record); 12 int insert(WaterMeter record);
10 13
11 int insertSelective(WaterMeter record); 14 int insertSelective(WaterMeter record);
@@ -45,5 +45,35 @@ public class Location { @@ -45,5 +45,35 @@ public class Location {
45 } 45 }
46 46
47 47
  48 + public String getEeid() {
  49 + return eeid;
  50 + }
  51 +
  52 + public void setEeid(String eeid) {
  53 + this.eeid = eeid;
  54 + }
  55 +
  56 + public String getWmid() {
  57 + return wmid;
  58 + }
  59 +
  60 + public void setWmid(String wmid) {
  61 + this.wmid = wmid;
  62 + }
48 63
  64 + public Integer getType() {
  65 + return type;
  66 + }
  67 +
  68 + public void setType(Integer type) {
  69 + this.type = type;
  70 + }
  71 +
  72 + public List<Location> getChildren() {
  73 + return children;
  74 + }
  75 +
  76 + public void setChildren(List<Location> children) {
  77 + this.children = children;
  78 + }
49 } 79 }
@@ -12,5 +12,7 @@ public interface WaterMeterService { @@ -12,5 +12,7 @@ public interface WaterMeterService {
12 12
13 ResultJson payWater(String payFees, String wmId, String userId, String realName); 13 ResultJson payWater(String payFees, String wmId, String userId, String realName);
14 14
  15 + ResultJson waterMeterAll(String wmId);
  16 +
15 17
16 } 18 }
@@ -23,6 +23,7 @@ import javax.servlet.http.HttpSession; @@ -23,6 +23,7 @@ import javax.servlet.http.HttpSession;
23 import java.math.BigDecimal; 23 import java.math.BigDecimal;
24 import java.util.Date; 24 import java.util.Date;
25 import java.util.HashMap; 25 import java.util.HashMap;
  26 +import java.util.List;
26 import java.util.Map; 27 import java.util.Map;
27 28
28 29
@@ -152,6 +153,21 @@ public class WaterMeterServiceImp implements WaterMeterService { @@ -152,6 +153,21 @@ public class WaterMeterServiceImp implements WaterMeterService {
152 } 153 }
153 } 154 }
154 155
  156 + @Override
  157 + public ResultJson waterMeterAll(String wmId) {
  158 + ResultJson<Object> resultJson = new ResultJson<>();
  159 + try {
  160 +
  161 + List<WaterMeter> waterMeterList = waterMeterMapper.waterMeterAll(wmId);
  162 +
  163 + return new ResultJson("200","success", waterMeterList);
  164 + }catch (Exception e){
  165 + e.printStackTrace();
  166 + resultJson.setCode("203");
  167 + return resultJson;
  168 + }
  169 + }
  170 +
155 /** 171 /**
156 * 总水量 换算 172 * 总水量 换算
157 * @param payFees 173 * @param payFees
@@ -120,6 +120,9 @@ @@ -120,6 +120,9 @@
120 <if test="type != null" > 120 <if test="type != null" >
121 type = #{type,jdbcType=INTEGER}, 121 type = #{type,jdbcType=INTEGER},
122 </if> 122 </if>
  123 + <if test="wmid != null" >
  124 + wm_id = #{wmid,jdbcType=VARCHAR},
  125 + </if>
123 </set> 126 </set>
124 where id = #{id,jdbcType=INTEGER} 127 where id = #{id,jdbcType=INTEGER}
125 </update> 128 </update>
@@ -17,6 +17,11 @@ @@ -17,6 +17,11 @@
17 <result column="reamke3" property="reamke3" jdbcType="VARCHAR" /> 17 <result column="reamke3" property="reamke3" jdbcType="VARCHAR" />
18 <result column="reamke4" property="reamke4" jdbcType="VARCHAR" /> 18 <result column="reamke4" property="reamke4" jdbcType="VARCHAR" />
19 </resultMap> 19 </resultMap>
  20 +
  21 + <select id="waterMeterAll" parameterType="string" resultMap="BaseResultMap">
  22 + select * from water_meter where wm_id like concat('%',#{value},'%')
  23 + </select>
  24 +
20 <insert id="insert" parameterType="com.sunyo.energy.location.model.WaterMeter" > 25 <insert id="insert" parameterType="com.sunyo.energy.location.model.WaterMeter" >
21 insert into water_meter (wm_id, wm_sacc, wm_lacc, 26 insert into water_meter (wm_id, wm_sacc, wm_lacc,
22 wm_rdtime, wm_fmstate, wm_errmessage, 27 wm_rdtime, wm_fmstate, wm_errmessage,