优化首页查询,显示工点信息

This commit is contained in:
weidong 2024-07-02 20:12:31 +08:00
parent aeb9b1a933
commit 38a1f1c64b
3 changed files with 9 additions and 7 deletions

View File

@ -112,9 +112,12 @@ public class IndexController extends BasicController{
Page pageable = new Page<>(page == null ? 1 : page, limit == null ? 10 : limit); Page pageable = new Page<>(page == null ? 1 : page, limit == null ? 10 : limit);
MPJQueryWrapper<GnssStatus> queryWrapper = new MPJQueryWrapper<>(); MPJQueryWrapper<GnssStatus> queryWrapper = new MPJQueryWrapper<>();
queryWrapper.selectAll(GnssStatus.class) queryWrapper.selectAll(GnssStatus.class)
.select("d.name as name","d.devicetype as devicetype")
.leftJoin("gnssdevices d on t.deviceid = d.deviceid") .leftJoin("gnssdevices d on t.deviceid = d.deviceid")
.ne("d.tenantid",Tenant.SAAS_PROVIDER_ID) .ne("d.tenantid",Tenant.SAAS_PROVIDER_ID)
.eq("opmode",GnssDevice.OP_MODE_USE); .eq("opmode",GnssDevice.OP_MODE_USE)
.orderByDesc("updatetime");
String query = (String) session.getAttribute("query"); String query = (String) session.getAttribute("query");
if(query != null){ if(query != null){
if(query.equals("offline")){ if(query.equals("offline")){
@ -136,7 +139,7 @@ public class IndexController extends BasicController{
session.setAttribute("query",query); session.setAttribute("query",query);
} }
IPage<GnssStatus> cs = statusMapper.selectPage(pageable, queryWrapper); IPage<GnssStatusJoin> cs = statusMapper.selectJoinPage(pageable, GnssStatusJoin.class, queryWrapper);
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("code", 0); jsonObject.put("code", 0);
jsonObject.put("msg", ""); jsonObject.put("msg", "");

View File

@ -2,9 +2,9 @@
#spring.datasource.url=jdbc:mysql://192.168.101.54:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true #spring.datasource.url=jdbc:mysql://192.168.101.54:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true
#spring.datasource.username=beidou #spring.datasource.username=beidou
#spring.datasource.password=Passw0rd#123! #spring.datasource.password=Passw0rd#123!
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true #spring.datasource.url=jdbc:mysql://127.0.0.1:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true
#spring.datasource.url=jdbc:mysql://139.9.51.237:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true spring.datasource.url=jdbc:mysql://139.9.51.237:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true
spring.datasource.username=admin spring.datasource.username=radmin
spring.datasource.password=DBMgr_2022 spring.datasource.password=DBMgr_2022
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.hbm2ddl.auto=update spring.jpa.properties.hibernate.hbm2ddl.auto=update

View File

@ -39,11 +39,10 @@
cols: [[ cols: [[
{field: 'deviceid', title: '设备号', sort: true}, {field: 'deviceid', title: '设备号', sort: true},
{field: 'devicetype', title: '设备类型',templet: '#typeTrans'}, {field: 'devicetype', title: '设备类型',templet: '#typeTrans'},
{field: 'name', title: '工点'},
{field: 'updatetime', title: '更新时间', templet: "<div>{{layui.util.toDateString(d.updatetime, 'yyyy-MM-dd HH:mm:ss')}}</div>"}, {field: 'updatetime', title: '更新时间', templet: "<div>{{layui.util.toDateString(d.updatetime, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
{field: 'state', title: '状态',templet: '#stateTrans'}, {field: 'state', title: '状态',templet: '#stateTrans'},
{field: 'warning', title: '告警',templet: '#warningTrans'}, {field: 'warning', title: '告警',templet: '#warningTrans'},
{field: 'longitude', title: '经度'},
{field: 'latitude', title: '维度'},
{field: 'voltage', title: '电压'}, {field: 'voltage', title: '电压'},
{field: 'temperature', title: '温度'}, {field: 'temperature', title: '温度'},
{field: 'humidity', title: '湿度'}, {field: 'humidity', title: '湿度'},