Commit a0e46451 authored by zhuangzhuang's avatar zhuangzhuang

5.30--修改仓库,tdl 预警逻辑

parent 919fccbc
...@@ -22,8 +22,6 @@ public class AddWarehouseVo { ...@@ -22,8 +22,6 @@ public class AddWarehouseVo {
private String type;//类型 private String type;//类型
private String alarmType;
private String hardwareLevel;//硬件等级 private String hardwareLevel;//硬件等级
private Double areaIndoor;//室内平面面积 private Double areaIndoor;//室内平面面积
...@@ -122,14 +120,6 @@ public class AddWarehouseVo { ...@@ -122,14 +120,6 @@ public class AddWarehouseVo {
this.type = type; this.type = type;
} }
public String getAlarmType() {
return alarmType;
}
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getHardwareLevel() { public String getHardwareLevel() {
return hardwareLevel; return hardwareLevel;
} }
......
...@@ -26,8 +26,6 @@ public class ResultWarehouseVo { ...@@ -26,8 +26,6 @@ public class ResultWarehouseVo {
private String type;//类型 private String type;//类型
private String alarmType;
private String hardwareLevel;//硬件等级 private String hardwareLevel;//硬件等级
private Double areaIndoor;//室内平面面积 private Double areaIndoor;//室内平面面积
...@@ -144,14 +142,6 @@ public class ResultWarehouseVo { ...@@ -144,14 +142,6 @@ public class ResultWarehouseVo {
this.type = type; this.type = type;
} }
public String getAlarmType() {
return alarmType;
}
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getHardwareLevel() { public String getHardwareLevel() {
return hardwareLevel; return hardwareLevel;
} }
......
...@@ -21,8 +21,6 @@ public class UpdateWarehouseVo { ...@@ -21,8 +21,6 @@ public class UpdateWarehouseVo {
private String type;//类型 private String type;//类型
private String alarmType;
private String hardwareLevel;//硬件等级 private String hardwareLevel;//硬件等级
private Double areaIndoor;//室内平面面积 private Double areaIndoor;//室内平面面积
...@@ -123,14 +121,6 @@ public class UpdateWarehouseVo { ...@@ -123,14 +121,6 @@ public class UpdateWarehouseVo {
this.type = type; this.type = type;
} }
public String getAlarmType() {
return alarmType;
}
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getHardwareLevel() { public String getHardwareLevel() {
return hardwareLevel; return hardwareLevel;
} }
......
...@@ -25,5 +25,5 @@ public interface AlarmMapper { ...@@ -25,5 +25,5 @@ public interface AlarmMapper {
List<AlarmTypeVo> getForTransportation(String companyName); List<AlarmTypeVo> getForTransportation(String companyName);
ResultAlarmVo getAlarmByWarehouseNo(@Param("warehouseNo") String warehouseNo); ResultAlarmVo getAlarmByWarehouseNo(@Param("warehouseNo") String warehouseNo ,@Param("gatewaySN")String gatewaySN,@Param("TDLSN")String TDLSN);
} }
...@@ -3,6 +3,7 @@ package com.example.tdl.service; ...@@ -3,6 +3,7 @@ package com.example.tdl.service;
import com.example.tdl.domain.vo.*; import com.example.tdl.domain.vo.*;
import com.example.tdl.mapper.AlarmMapper; import com.example.tdl.mapper.AlarmMapper;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -46,8 +47,8 @@ public class AlarmService { ...@@ -46,8 +47,8 @@ public class AlarmService {
return alarmMapper.getForTransportation(companyName); return alarmMapper.getForTransportation(companyName);
} }
public ResultAlarmVo getAlarmByWarehouseNo(String warehouseNo){ public ResultAlarmVo getAlarmByWarehouseNo(String warehouseNo,String SN, String TDLSN){
return alarmMapper.getAlarmByWarehouseNo(warehouseNo); return alarmMapper.getAlarmByWarehouseNo(warehouseNo,SN, TDLSN);
} }
} }
...@@ -50,7 +50,7 @@ public class PicUploadController { ...@@ -50,7 +50,7 @@ public class PicUploadController {
}) })
@RequestMapping(value = "/upload",method = RequestMethod.POST) @RequestMapping(value = "/upload",method = RequestMethod.POST)
public String upload(MultipartFile multipartFile, @RequestParam(value = "imageType",required = true) String imageType) { public String upload(MultipartFile multipartFile, @RequestParam(value = "imageType",required = true) String imageType) {
if (multipartFile.isEmpty() || StringUtils.isBlank(multipartFile.getOriginalFilename())) { if (multipartFile == null ||multipartFile.isEmpty() || StringUtils.isBlank(multipartFile.getOriginalFilename())) {
fb.setCode(0); fb.setCode(0);
fb.setMessage("图片不能为空"); fb.setMessage("图片不能为空");
return gson.toJson(fb); return gson.toJson(fb);
...@@ -86,7 +86,7 @@ public class PicUploadController { ...@@ -86,7 +86,7 @@ public class PicUploadController {
fb.setMessage("https://tdlcloud.oss-cn-shanghai.aliyuncs.com/pic/companyLog/" + url); fb.setMessage("https://tdlcloud.oss-cn-shanghai.aliyuncs.com/pic/companyLog/" + url);
}else if("palte".equals(imageType)){ }else if("palte".equals(imageType)){
fb.setMessage("https://tdlcloud.oss-cn-shanghai.aliyuncs.com/pic/palteImage/" + url); fb.setMessage("https://tdlcloud.oss-cn-shanghai.aliyuncs.com/pic/palteImage/" + url);
}else if ("wareHouse".equals(imageType)){ }else if ("warehouse".equals(imageType)){
fb.setMessage("https://tdlcloud.oss-cn-shanghai.aliyuncs.com/pic/wareHouseImage/" + url); fb.setMessage("https://tdlcloud.oss-cn-shanghai.aliyuncs.com/pic/wareHouseImage/" + url);
}else if("circuit".equals(imageType)){ }else if("circuit".equals(imageType)){
fb.setMessage("https://tdlcloud.oss-cn-shanghai.aliyuncs.com/pic/userImage/" + url); fb.setMessage("https://tdlcloud.oss-cn-shanghai.aliyuncs.com/pic/userImage/" + url);
......
...@@ -144,6 +144,24 @@ public class WarehouseController { ...@@ -144,6 +144,24 @@ public class WarehouseController {
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo userRedisVo = gson.fromJson(datum,UserRedisVo.class); UserRedisVo userRedisVo = gson.fromJson(datum,UserRedisVo.class);
if(StringUtils.isEmpty(warehouseTermVo.getCity())){
warehouseTermVo.setCity(null);
}
if(StringUtils.isEmpty(warehouseTermVo.getCountry())){
warehouseTermVo.setCountry(null);
}
if(StringUtils.isEmpty(warehouseTermVo.getHardwareLevel())){
warehouseTermVo.setHardwareLevel(null);
}
if(StringUtils.isEmpty(warehouseTermVo.getProperty())){
warehouseTermVo.setProperty(null);
}
if(StringUtils.isEmpty(warehouseTermVo.getType())){
warehouseTermVo.setType(null);
}
if(StringUtils.isEmpty(warehouseTermVo.getWarehouseName())){
warehouseTermVo.setWarehouseName(null);
}
warehouseTermVo.setCompanyName(userRedisVo.getCompanyName()); warehouseTermVo.setCompanyName(userRedisVo.getCompanyName());
return warehouseService.getAllByTerm(warehouseTermVo); return warehouseService.getAllByTerm(warehouseTermVo);
} }
...@@ -170,18 +188,30 @@ public class WarehouseController { ...@@ -170,18 +188,30 @@ public class WarehouseController {
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo userRedisVo = gson.fromJson(datum,UserRedisVo.class); UserRedisVo userRedisVo = gson.fromJson(datum,UserRedisVo.class);
warehouseTermVo.setCompanyName(userRedisVo.getCompanyName()); warehouseTermVo.setCompanyName(userRedisVo.getCompanyName());
if(StringUtils.isEmpty(warehouseTermVo.getCity())){
warehouseTermVo.setCity(null);
}
if(StringUtils.isEmpty(warehouseTermVo.getCompanyName())){
warehouseTermVo.setCompanyName(null);
}
if(StringUtils.isEmpty(warehouseTermVo.getCountry())){
warehouseTermVo.setCountry(null);
}
if(StringUtils.isEmpty(warehouseTermVo.getgSN())){
warehouseTermVo.setgSN(null);
}
List<SimpleWarehouseVo> simpleWarehouseVos = warehouseService.getByWarehouse(warehouseTermVo); List<SimpleWarehouseVo> simpleWarehouseVos = warehouseService.getByWarehouse(warehouseTermVo);
for( int i = 0,length= simpleWarehouseVos.size();i<length;i++ ){ for( int i = 0,length= simpleWarehouseVos.size();i<length;i++ ){
//判断是否已经绑定设备 //判断是否已经绑定设备
if(simpleWarehouseVos.get(i).getCount() == 0){ if(simpleWarehouseVos.get(i).getCount() == 0){
simpleWarehouseVos.get(i).setTemp("~"); simpleWarehouseVos.get(i).setTemp("~");
simpleWarehouseVos.get(i).setTemp("~"); simpleWarehouseVos.get(i).setHumidity("~");
continue; continue;
} }
List<DeviceVo> list = warehouseService.getDevice(simpleWarehouseVos.get(i).getWarehouseNo()); List<DeviceVo> list = warehouseService.getDevice(simpleWarehouseVos.get(i).getWarehouseNo());
if(list.size() == 0){ if(list.size() == 0){
simpleWarehouseVos.get(i).setTemp("~"); simpleWarehouseVos.get(i).setTemp("~");
simpleWarehouseVos.get(i).setTemp("~"); simpleWarehouseVos.get(i).setHumidity("~");
continue; continue;
} }
String sql = ""; String sql = "";
...@@ -199,13 +229,13 @@ public class WarehouseController { ...@@ -199,13 +229,13 @@ public class WarehouseController {
} }
if(StringUtils.isEmpty(sql)){ if(StringUtils.isEmpty(sql)){
simpleWarehouseVos.get(i).setTemp("~"); simpleWarehouseVos.get(i).setTemp("~");
simpleWarehouseVos.get(i).setTemp("~"); simpleWarehouseVos.get(i).setHumidity("~");
continue; continue;
} }
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database)); QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
if(queryResult.getResults().get(0).getSeries()== null){ if(queryResult.getResults().get(0).getSeries()== null){
simpleWarehouseVos.get(i).setTemp("~"); simpleWarehouseVos.get(i).setTemp("~");
simpleWarehouseVos.get(i).setTemp("~"); simpleWarehouseVos.get(i).setHumidity("~");
continue; continue;
} }
//解析温湿度数据 //解析温湿度数据
...@@ -404,16 +434,6 @@ public class WarehouseController { ...@@ -404,16 +434,6 @@ public class WarehouseController {
fb.setMessage("请输入正确的仓库类型"); fb.setMessage("请输入正确的仓库类型");
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(addWarehouseVo.getAlarmType())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"alarmType"));
return gson.toJson(fb);
}
if(alarmService.getAllByAlarmType(user.getCompanyName(),addWarehouseVo.getAlarmType()) == null){
fb.setCode(0);
fb.setMessage("预警类型不存在");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addWarehouseVo.getHardwareLevel())){ if (StringUtils.isEmpty(addWarehouseVo.getHardwareLevel())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("硬件等级不能为空"); fb.setMessage("硬件等级不能为空");
...@@ -471,7 +491,6 @@ public class WarehouseController { ...@@ -471,7 +491,6 @@ public class WarehouseController {
map.put("regionName",addWarehouseVo.getRegionName()); map.put("regionName",addWarehouseVo.getRegionName());
map.put("property",addWarehouseVo.getProperty()); map.put("property",addWarehouseVo.getProperty());
map.put("type",addWarehouseVo.getType()); map.put("type",addWarehouseVo.getType());
map.put("alarmType",addWarehouseVo.getAlarmType());
map.put("hardwareLevel",addWarehouseVo.getHardwareLevel()); map.put("hardwareLevel",addWarehouseVo.getHardwareLevel());
map.put("areaIndoor",addWarehouseVo.getAreaIndoor()); map.put("areaIndoor",addWarehouseVo.getAreaIndoor());
map.put("areaRack",addWarehouseVo.getAreaRack()); map.put("areaRack",addWarehouseVo.getAreaRack());
...@@ -604,11 +623,7 @@ public class WarehouseController { ...@@ -604,11 +623,7 @@ public class WarehouseController {
fb.setMessage("请输入正确的仓库仓库类型"); fb.setMessage("请输入正确的仓库仓库类型");
return gson.toJson(fb); return gson.toJson(fb);
} }
if (StringUtils.isEmpty(updateWarehouseVo.getAlarmType())){
fb.setCode(0);
fb.setMessage("预警类型不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateWarehouseVo.getHardwareLevel())){ if (StringUtils.isEmpty(updateWarehouseVo.getHardwareLevel())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("硬件等级不能为空"); fb.setMessage("硬件等级不能为空");
...@@ -667,7 +682,6 @@ public class WarehouseController { ...@@ -667,7 +682,6 @@ public class WarehouseController {
map.put("regionName",updateWarehouseVo.getRegionName()); map.put("regionName",updateWarehouseVo.getRegionName());
map.put("property",updateWarehouseVo.getProperty()); map.put("property",updateWarehouseVo.getProperty());
map.put("type",updateWarehouseVo.getType()); map.put("type",updateWarehouseVo.getType());
map.put("alarmType",updateWarehouseVo.getAlarmType());
map.put("hardwareLevel",updateWarehouseVo.getHardwareLevel()); map.put("hardwareLevel",updateWarehouseVo.getHardwareLevel());
map.put("areaIndoor",updateWarehouseVo.getAreaIndoor()); map.put("areaIndoor",updateWarehouseVo.getAreaIndoor());
map.put("areaRack",updateWarehouseVo.getAreaRack()); map.put("areaRack",updateWarehouseVo.getAreaRack());
...@@ -731,6 +745,8 @@ public class WarehouseController { ...@@ -731,6 +745,8 @@ public class WarehouseController {
return gson.toJson(fb); return gson.toJson(fb);
} }
@ApiOperation(value="添加网关",notes = "添加网关,传值:" + @ApiOperation(value="添加网关",notes = "添加网关,传值:" +
"warehouseNo:仓库编号" + "warehouseNo:仓库编号" +
"SN:网关编号") "SN:网关编号")
...@@ -847,7 +863,7 @@ public class WarehouseController { ...@@ -847,7 +863,7 @@ public class WarehouseController {
warehouseNo=(String) jsonObject.get("warehouseNo"); warehouseNo=(String) jsonObject.get("warehouseNo");
List<WarehouseGatewayDateVo> warehouseGatewayDateVoList=new ArrayList<>(); List<WarehouseGatewayDateVo> warehouseGatewayDateVoList=new ArrayList<>();
List<GatewayOnLineVo> gatewayOnLineVos=gatewayService.getByWarehouseNo(warehouseNo); List<GatewayOnLineVo> gatewayOnLineVos=gatewayService.getByWarehouseNo(warehouseNo);
ResultAlarmVo resultAlarmVo=alarmService.getAlarmByWarehouseNo(warehouseNo);
for (int a=0;a<gatewayOnLineVos.size();a++){ for (int a=0;a<gatewayOnLineVos.size();a++){
WarehouseGatewayDateVo warehouseGatewayDateVo=new WarehouseGatewayDateVo(); WarehouseGatewayDateVo warehouseGatewayDateVo=new WarehouseGatewayDateVo();
warehouseGatewayDateVo.setgSN(gatewayOnLineVos.get(a).getSN()); warehouseGatewayDateVo.setgSN(gatewayOnLineVos.get(a).getSN());
...@@ -857,10 +873,10 @@ public class WarehouseController { ...@@ -857,10 +873,10 @@ public class WarehouseController {
List<String> tdls=tdlDeviceService.getByGatewaySN(gatewayOnLineVos.get(a).getSN(),gatewayOnLineVos.get(a).getType()); List<String> tdls=tdlDeviceService.getByGatewaySN(gatewayOnLineVos.get(a).getSN(),gatewayOnLineVos.get(a).getType());
List<WarehouseDataVo> warehouseDataVos=new ArrayList<>(); List<WarehouseDataVo> warehouseDataVos=new ArrayList<>();
for (int b=0;b<tdls.size();b++){ for (int b=0;b<tdls.size();b++){
String sqls ="SELECT \"tdl\",\"T\", \"h\" FROM \"tdl_policy\".\""+device+"\" WHERE (\"tdl\" = '"+tdls.get(b)+"') ORDER BY time DESC "; String sqls ="SELECT \"tdl\",\"T\", \"h\" FROM \"tdl_policy\".\""+device+"\" WHERE (\"tdl\" = '"+tdls.get(b)+"') ORDER BY time ";
QueryResult queryResults = influxDBTemplate.query(new Query(sqls, database)); QueryResult queryResults = influxDBTemplate.query(new Query(sqls, database));
WarehouseDataVo warehouseDataVo=new WarehouseDataVo(); WarehouseDataVo warehouseDataVo=new WarehouseDataVo();
ResultAlarmVo resultAlarmVo=alarmService.getAlarmByWarehouseNo(warehouseNo,gatewayOnLineVos.get(a).getSN(),tdls.get(b).replace("TDL-","").trim());
List<WarehouseTDLDetailVo> warehouseTDLDetailVos=new ArrayList<>(); List<WarehouseTDLDetailVo> warehouseTDLDetailVos=new ArrayList<>();
List<WarehouseTimeAndDataVo> warehouseTimeAndDataVos = new ArrayList<>(); List<WarehouseTimeAndDataVo> warehouseTimeAndDataVos = new ArrayList<>();
List<WarehouseTimeAndDataVo> warehouseTimeAndDataVos1 = new ArrayList<>(); List<WarehouseTimeAndDataVo> warehouseTimeAndDataVos1 = new ArrayList<>();
...@@ -937,8 +953,8 @@ public class WarehouseController { ...@@ -937,8 +953,8 @@ public class WarehouseController {
List<GraphicDataVo> graphicDataList = new ArrayList<>(); List<GraphicDataVo> graphicDataList = new ArrayList<>();
List<TdlDataVo.HistoryDataVo> historyDataList = new ArrayList<>(); List<TdlDataVo.HistoryDataVo> historyDataList = new ArrayList<>();
//获取TDL数据 //获取TDL数据
// String sql = "SELECT \"T\",\"h\" FROM \"tdl_policy\".\""+deviceMessageVo.getType()+"_"+deviceMessageVo.getSN()+"\" where \"tdl\" = \'TDL-"+searchTdlVo.getTdlSN()+"\' order by time "; String sql = "SELECT \"T\",\"h\" FROM \"tdl_policy\".\""+deviceMessageVo.getType()+"_"+deviceMessageVo.getSN()+"\" where \"tdl\" = \'TDL-"+searchTdlVo.getTDLSN()+"\' order by time ";
String sql = "SELECT \"T\",\"h\" FROM \"tdl_policy\".\"WTD93LG_17110194\" where \"tdl\" = \'TDL-1706190193608\' order by time "; // String sql = "SELECT \"T\",\"h\" FROM \"tdl_policy\".\"WTD93LG_17110194\" where \"tdl\" = \'TDL-1706190193608\' order by time ";
QueryResult queryResult = influxDBTemplate.query(new Query(sql,database)); QueryResult queryResult = influxDBTemplate.query(new Query(sql,database));
if(queryResult.getResults().get(0).getSeries()== null){ if(queryResult.getResults().get(0).getSeries()== null){
tdlDataVo.setGraphicDataList(graphicDataList); tdlDataVo.setGraphicDataList(graphicDataList);
......
spring.datasource.url=jdbc:mysql://housetest-mysql:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false spring.datasource.url=jdbc:mysql://housetest-mysql:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root
spring.datasource.password=37774020
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
tdl.redis.host=housetest-redis tdl.redis.host=housetest-redis
......
...@@ -80,7 +80,9 @@ ...@@ -80,7 +80,9 @@
<select id="getAlarmByWarehouseNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultAlarmVo"> <select id="getAlarmByWarehouseNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultAlarmVo">
SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,a.remark SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,a.remark
FROM warehouse w INNER JOIN alarm a ON w.alarm_id=a.id FROM tdl_gateway_log tgl INNER JOIN alarm a ON tgl.alarm_id=a.id
where w.warehouseNo=#{warehouseNo,jdbcType=VARCHAR} where warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
AND gatewaySN=#{gatewaySN,jdbcType=VARCHAR}
AND TDLSN=#{TDLSN,jdbcType=VARCHAR}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -110,9 +110,7 @@ ...@@ -110,9 +110,7 @@
<!--根据仓库编号查询网关信息--> <!--根据仓库编号查询网关信息-->
<select id="getByWarehouseNo" parameterType="String" resultType="com.example.tdl.domain.vo.GatewayOnLineVo"> <select id="getByWarehouseNo" parameterType="String" resultType="com.example.tdl.domain.vo.GatewayOnLineVo">
SELECT SN,type from gateway SELECT gatewaySN SN, gatewayType type from tdl_gateway_log where warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
WHERE id IN (SELECT gateway_id from gateway_warehouse where warehouse_id=(
SELECT id from warehouse WHERE warehouseNo=#{warehouseNo,jdbcType=VARCHAR}))
</select> </select>
......
...@@ -3,23 +3,22 @@ ...@@ -3,23 +3,22 @@
<mapper namespace="com.example.tdl.mapper.WarehouseMapper"> <mapper namespace="com.example.tdl.mapper.WarehouseMapper">
<!--查询所有仓库信息--> <!--查询所有仓库信息-->
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultWarehouseVo"> <select id="getAll" resultType="com.example.tdl.domain.vo.ResultWarehouseVo">
select warehouseNo,w.img,warehouseName,c.country,c.city,CONCAT_WS("-",c.country,c.city) regions ,w.addressDetail,r.regionName,lng,lat,a.alarmType,property, select w.warehouseNo,w.img,warehouseName,ct.country,ct.city,CONCAT_WS("-",ct.country,ct.city) regions ,w.addressDetail,r.regionName,lng,lat,property,
type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,companyName,w.remark type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,companyName,w.remark
from warehouse w,alarm a,region r,city ct ,company c from warehouse w,region r,city ct ,company c
where c.id = w.company_id where c.id = w.company_id
and a.id = w.alarm_id
and r.id = w.region_id and r.id = w.region_id
and ct.id = w.city_id and ct.id = w.city_id
and c.companyName=#{companyName,jdbcType=VARCHAR} and c.companyName=#{companyName,jdbcType=VARCHAR}
order by createTime desc
</select> </select>
<!-- 根据条件查询仓库信息--> <!-- 根据条件查询仓库信息-->
<select id="getAllByTerm" resultType="com.example.tdl.domain.vo.ResultWarehouseVo" parameterType="com.example.tdl.domain.vo.WarehouseTermVo"> <select id="getAllByTerm" resultType="com.example.tdl.domain.vo.ResultWarehouseVo" parameterType="com.example.tdl.domain.vo.WarehouseTermVo">
select warehouseNo,w.img,warehouseName,c.country,c.city,CONCAT_WS("-",c.country,c.city) regions ,w.addressDetail,r.regionName,lng,lat,a.alarmType,property, select warehouseNo,w.img,warehouseName,ct.country,ct.city,CONCAT_WS("-",ct.country,ct.city) regions ,w.addressDetail,r.regionName,lng,lat,property,
type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,companyName,w.remark type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,companyName,w.remark
from warehouse w,alarm a,region r,city ct ,company c from warehouse w,region r,city ct ,company c
where c.id = w.company_id where c.id = w.company_id
and a.id = w.alarm_id
and r.id = w.region_id and r.id = w.region_id
and ct.id = w.city_id and ct.id = w.city_id
and c.companyName=#{companyName,jdbcType=VARCHAR} and c.companyName=#{companyName,jdbcType=VARCHAR}
...@@ -41,6 +40,7 @@ ...@@ -41,6 +40,7 @@
<if test="hardwareLevel!=null"> <if test="hardwareLevel!=null">
AND hardwareLevel=#{hardwareLevel,jdbcType=VARCHAR} AND hardwareLevel=#{hardwareLevel,jdbcType=VARCHAR}
</if> </if>
order by createTime desc
</select> </select>
<select id="getWarehouseNo" resultType="java.lang.Integer" parameterType="String"> <select id="getWarehouseNo" resultType="java.lang.Integer" parameterType="String">
...@@ -48,11 +48,10 @@ ...@@ -48,11 +48,10 @@
</select> </select>
<select id="getByWarehouseName" parameterType="String" resultType="com.example.tdl.domain.vo.ResultWarehouseVo"> <select id="getByWarehouseName" parameterType="String" resultType="com.example.tdl.domain.vo.ResultWarehouseVo">
select warehouseNo,w.img,warehouseName,c.country,c.city,CONCAT_WS("-",c.country,c.city) regions ,w.addressDetail,r.regionName,lng,lat,a.alarmType,property, select warehouseNo,w.img,warehouseName,ct.country,ct.city,CONCAT_WS("-",ct.country,ct.city) regions ,w.addressDetail,r.regionName,lng,lat,property,
type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,companyName,w.remark type,hardwareLevel,areaIndoor,areaRack,areaOutdoor,areaPlanIndoor,office,timeZone,warehouseInfo,companyName,w.remark
from warehouse w,alarm a,region r,city ct ,company c from warehouse w,region r,city ct ,company c
where c.id = w.company_id where c.id = w.company_id
and a.id = w.alarm_id
and r.id = w.region_id and r.id = w.region_id
and ct.id = w.city_id and ct.id = w.city_id
and c.companyName=#{companyName,jdbcType=VARCHAR} and c.companyName=#{companyName,jdbcType=VARCHAR}
...@@ -73,7 +72,6 @@ ...@@ -73,7 +72,6 @@
#{regionName,mode=IN,jdbcType=VARCHAR}, #{regionName,mode=IN,jdbcType=VARCHAR},
#{property,mode=IN,jdbcType=VARCHAR}, #{property,mode=IN,jdbcType=VARCHAR},
#{type,mode=IN,jdbcType=BIGINT}, #{type,mode=IN,jdbcType=BIGINT},
#{alarmType,mode=IN,jdbcType=BIGINT},
#{hardwareLevel,mode=IN,jdbcType=BIGINT}, #{hardwareLevel,mode=IN,jdbcType=BIGINT},
#{areaIndoor,mode=IN,jdbcType=VARCHAR}, #{areaIndoor,mode=IN,jdbcType=VARCHAR},
#{areaRack,mode=IN,jdbcType=VARCHAR}, #{areaRack,mode=IN,jdbcType=VARCHAR},
...@@ -107,7 +105,6 @@ ...@@ -107,7 +105,6 @@
#{regionName,mode=IN,jdbcType=VARCHAR}, #{regionName,mode=IN,jdbcType=VARCHAR},
#{property,mode=IN,jdbcType=VARCHAR}, #{property,mode=IN,jdbcType=VARCHAR},
#{type,mode=IN,jdbcType=BIGINT}, #{type,mode=IN,jdbcType=BIGINT},
#{alarmType,mode=IN,jdbcType=BIGINT},
#{hardwareLevel,mode=IN,jdbcType=BIGINT}, #{hardwareLevel,mode=IN,jdbcType=BIGINT},
#{areaIndoor,mode=IN,jdbcType=VARCHAR}, #{areaIndoor,mode=IN,jdbcType=VARCHAR},
#{areaRack,mode=IN,jdbcType=VARCHAR}, #{areaRack,mode=IN,jdbcType=VARCHAR},
...@@ -181,10 +178,7 @@ ...@@ -181,10 +178,7 @@
</insert> </insert>
<select id = "getGateway" parameterType="String" resultType="com.example.tdl.domain.vo.GatewaySNVo"> <select id = "getGateway" parameterType="String" resultType="com.example.tdl.domain.vo.GatewaySNVo">
select g.SN from gateway_warehouse gw,warehouse w,gateway g select DISTINCT gatewaySN SN from tdl_gateway_log WHERE warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
where gw.gateway_id=g.id
and gw.warehouse_id = w.id
and w.warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
</select> </select>
<select id="getByWarehouseNoAndSN" resultType="java.lang.Integer" parameterType="String"> <select id="getByWarehouseNoAndSN" resultType="java.lang.Integer" parameterType="String">
...@@ -211,7 +205,7 @@ ...@@ -211,7 +205,7 @@
</select> </select>
<select id="getByWarehouse" parameterType="com.example.tdl.domain.vo.WareHouseByTermVo" resultType="com.example.tdl.domain.vo.SimpleWarehouseVo"> <select id="getByWarehouse" parameterType="com.example.tdl.domain.vo.WareHouseByTermVo" resultType="com.example.tdl.domain.vo.SimpleWarehouseVo">
select warehouseNo, warehouseName,CONCAT_WS("-",c.country,c.city) regions,c.country,c.city, (select count(id) from tdldevice t where t.warehouse_id = w.id ) count,property,type,hardwareLevel,areaPlanIndoor select warehouseNo, warehouseName,CONCAT_WS("-",ct.country,ct.city) regions,ct.country,ct.city, (select count(id) from tdldevice t where t.warehouse_id = w.id ) count,property,type,hardwareLevel,areaPlanIndoor
from warehouse w ,company c ,city ct from warehouse w ,company c ,city ct
where c.id=w.company_id where c.id=w.company_id
and ct.id = w.city_id and ct.id = w.city_id
...@@ -229,14 +223,10 @@ ...@@ -229,14 +223,10 @@
</select> </select>
<select id="getDevice" parameterType="String" resultType="com.example.tdl.domain.vo.DeviceVo"> <select id="getDevice" parameterType="String" resultType="com.example.tdl.domain.vo.DeviceVo">
select w.warehouseNo,GROUP_CONCAT(CONCAT("TDL-",t.TDLSN)) tdl,t.TDLSN,g.SN,g.type,CONCAT(g.type,"_",g.SN) device,startTime,endTime select w.warehouseNo,GROUP_CONCAT(CONCAT("TDL-",TDLSN)) tdl,gatewaySN SN,gatewaytype type,CONCAT(gatewaytype,"_",gatewaySN) device,tgl.createTime,tgl.endTime
from gateway_warehouse gw,gateway g,tdldevice t,warehouse w,use_warehouse_log u from tdl_gateway_log tgl,warehouse w
where gw.warehouse_id = w.id where tgl.warehouseNo = w.warehouseNo
and gw.gateway_id = g.id and w.warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
and t.warehouse_id = w.id
and t.gateway_id = g.id
and u.warehouseNo = w.warehouseNo
and w.warehouseNo= #{warehouseNo,jdbcType=VARCHAR}
</select> </select>
<update id="updateImg"> <update id="updateImg">
...@@ -253,8 +243,8 @@ ...@@ -253,8 +243,8 @@
</select> </select>
<select id="getWarehouseDetailByNo" parameterType="String" resultType="com.example.tdl.domain.vo.WarehouseDetailVo"> <select id="getWarehouseDetailByNo" parameterType="String" resultType="com.example.tdl.domain.vo.WarehouseDetailVo">
SELECT warehouseNo,warehouseName,c.country,c.city,addressDetail,(SELECT COUNT(id) from gateway_warehouse WHERE warehouse_id=w.id) gatewayCounts, SELECT warehouseNo,warehouseName,c.country,c.city,addressDetail,(SELECT COUNT(DISTINCT gatewaySN) from tdl_gateway_log WHERE warehouseNo=w.warehouseNo) gatewayCounts,
(SELECT COUNT(id) FROM tdldevice WHERE warehouse_id=w.id) tdlCounts,,property,type,hardwareLevel,areaPlanIndoor (SELECT COUNT(TDLSN) from tdl_gateway_log WHERE warehouseNo=w.warehouseNo) tdlCounts,property,type,hardwareLevel,areaPlanIndoor
from warehouse w INNER JOIN city c ON w.city_id=c.id from warehouse w INNER JOIN city c ON w.city_id=c.id
where warehouseNo=#{warehouseNo,jdbcType=VARCHAR} where warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
</select> </select>
...@@ -263,11 +253,11 @@ ...@@ -263,11 +253,11 @@
<select id="getDeviceMessage" parameterType="com.example.tdl.domain.vo.SearchTdlVo" resultType="com.example.tdl.domain.vo.DeviceMessageVo"> <select id="getDeviceMessage" parameterType="com.example.tdl.domain.vo.SearchTdlVo" resultType="com.example.tdl.domain.vo.DeviceMessageVo">
SELECT t.TDLName,g.SN,g.type,w.warehouseName,w.addressDetail,(SELECT regionName from region where w.region_id=id) regionName, SELECT t.TDLName,g.SN,g.type,w.warehouseName,w.addressDetail,(SELECT regionName from region where w.region_id=id) regionName,
a.alarmType,a.temMax,a.temMin,a.humidityMax,a.humidityMin a.alarmType,a.temMax,a.temMin,a.humidityMax,a.humidityMin
from gateway_warehouse gw INNER JOIN warehouse w ON gw.warehouse_id=w.id,gateway g,tdldevice t,alarm a from tdl_gateway_log tgl INNER JOIN warehouse w ON tgl.warehouseNo=w.warehouseNo,gateway g,tdldevice t,alarm a
where t.gateway_id=g.id where tgl.alarm_id=a.id
AND gw.gateway_id=g.id and tgl.gatewaySN=g.SN
AND w.alarm_id=a.id AND tgl.TDLSN=t.TDLSN
AND warehouseNo=#{warehouseNo,jdbcType=VARCHAR} AND w.warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
AND g.SN=#{SN,jdbcType=VARCHAR} AND g.SN=#{SN,jdbcType=VARCHAR}
AND t.TDLSN=#{TDLSN,jdbcType=VARCHAR} AND t.TDLSN=#{TDLSN,jdbcType=VARCHAR}
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment