作者 shenhailong

公寓绑定水表信息

package com.sunyo.energy.location.controller;
import com.sunyo.energy.location.controller.response.ResultJson;
import com.sunyo.energy.location.model.WaterMeter;
import com.sunyo.energy.location.service.WaterMeterService;
import io.swagger.annotations.ApiOperation;
... ... @@ -9,8 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
@Controller
@RequestMapping("/water_meter")
public class WaterMeterController {
... ... @@ -27,5 +26,13 @@ public class WaterMeterController {
return waterMeterService.findRealTime(wmId);
}
@ApiOperation(value = "查询所有水表编号")
@RequestMapping("/waterMeterAll")
@ResponseBody
public ResultJson waterMeterAll(@RequestParam(value = "wmId", required = false) String wmId){
return waterMeterService.waterMeterAll(wmId);
}
}
... ...
... ... @@ -6,6 +6,9 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface WaterMeterMapper {
List<WaterMeter> waterMeterAll(String wmId);
int insert(WaterMeter record);
int insertSelective(WaterMeter record);
... ...
... ... @@ -45,5 +45,35 @@ public class Location {
}
public String getEeid() {
return eeid;
}
public void setEeid(String eeid) {
this.eeid = eeid;
}
public String getWmid() {
return wmid;
}
public void setWmid(String wmid) {
this.wmid = wmid;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public List<Location> getChildren() {
return children;
}
public void setChildren(List<Location> children) {
this.children = children;
}
}
\ No newline at end of file
... ...
... ... @@ -12,5 +12,7 @@ public interface WaterMeterService {
ResultJson payWater(String payFees, String wmId, String userId, String realName);
ResultJson waterMeterAll(String wmId);
}
... ...
... ... @@ -23,6 +23,7 @@ import javax.servlet.http.HttpSession;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
... ... @@ -152,6 +153,21 @@ public class WaterMeterServiceImp implements WaterMeterService {
}
}
@Override
public ResultJson waterMeterAll(String wmId) {
ResultJson<Object> resultJson = new ResultJson<>();
try {
List<WaterMeter> waterMeterList = waterMeterMapper.waterMeterAll(wmId);
return new ResultJson("200","success", waterMeterList);
}catch (Exception e){
e.printStackTrace();
resultJson.setCode("203");
return resultJson;
}
}
/**
* 总水量 换算
* @param payFees
... ...
... ... @@ -120,6 +120,9 @@
<if test="type != null" >
type = #{type,jdbcType=INTEGER},
</if>
<if test="wmid != null" >
wm_id = #{wmid,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
... ...
... ... @@ -17,6 +17,11 @@
<result column="reamke3" property="reamke3" jdbcType="VARCHAR" />
<result column="reamke4" property="reamke4" jdbcType="VARCHAR" />
</resultMap>
<select id="waterMeterAll" parameterType="string" resultMap="BaseResultMap">
select * from water_meter where wm_id like concat('%',#{value},'%')
</select>
<insert id="insert" parameterType="com.sunyo.energy.location.model.WaterMeter" >
insert into water_meter (wm_id, wm_sacc, wm_lacc,
wm_rdtime, wm_fmstate, wm_errmessage,
... ...