合并了mybatisplus分页的修改
This commit is contained in:
parent
6e82c17f72
commit
555c88d4b9
@ -13,10 +13,11 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
|||||||
* @date 2023/1/31 20:33
|
* @date 2023/1/31 20:33
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication(scanBasePackages = {"com.imdroid"})
|
@SpringBootApplication(scanBasePackages = {"com.imdroid"})
|
||||||
@MapperScan({"com.imdroid.secapi.dto","com.imdroid.beidou.entity"})
|
@MapperScan({"com.imdroid.secapi","com.imdroid.beidou.entity"})
|
||||||
@ComponentScan({"io.dt20.*", "com.imdroid.*"})
|
@ComponentScan({"io.dt20.*", "com.imdroid.*"})
|
||||||
@EntityScan({"io.dt20.common.persistence", "com.imdroid.*"})
|
@EntityScan({"io.dt20.common.persistence", "com.imdroid.*"})
|
||||||
@EnableJpaRepositories({"io.dt20.common.repo", "com.imdroid.*"})
|
@EnableJpaRepositories({"io.dt20.common.repo", "com.imdroid.*"})
|
||||||
|
|
||||||
public class SideSlopeRtcmApp {
|
public class SideSlopeRtcmApp {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@ -39,14 +39,14 @@ public class GnssDeviceController extends BasicController{
|
|||||||
|
|
||||||
/**** 推送页面 *****/
|
/**** 推送页面 *****/
|
||||||
@RequestMapping("/page/gnss_dev_cfg")
|
@RequestMapping("/page/gnss_dev_cfg")
|
||||||
public String gnssDevCfg(Model m, HttpSession session)throws Exception {
|
public String gnssDevCfg(Model m, HttpSession session) {
|
||||||
initModel(m, session);
|
initModel(m, session);
|
||||||
|
|
||||||
return "/page/gnss_dev_cfg";
|
return "/page/gnss_dev_cfg";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/page/table/gnss_add_dev")
|
@RequestMapping("/page/table/gnss_add_dev")
|
||||||
public String gnssUpdateDev(Model m)throws Exception {
|
public String gnssUpdateDev(Model m){
|
||||||
//以下用于下拉框数据
|
//以下用于下拉框数据
|
||||||
List<GnssGroup> gnssGroups = gnssGroupMapper.selectList(null);
|
List<GnssGroup> gnssGroups = gnssGroupMapper.selectList(null);
|
||||||
List<GnssGroupCalc> gnssGroupCalcs = gnssGroupCalcMapper.selectList(null);
|
List<GnssGroupCalc> gnssGroupCalcs = gnssGroupCalcMapper.selectList(null);
|
||||||
@ -64,7 +64,7 @@ public class GnssDeviceController extends BasicController{
|
|||||||
/**** 推送数据 *****/
|
/**** 推送数据 *****/
|
||||||
@RequestMapping("/gnss/device/list")
|
@RequestMapping("/gnss/device/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public JSONObject list(HttpSession session, int page, int limit, String searchParams) {
|
public JSONObject list(int page, int limit, String searchParams) {
|
||||||
Page<GnssDevice> pageable = new Page<>(page, limit);
|
Page<GnssDevice> pageable = new Page<>(page, limit);
|
||||||
QueryWrapper<GnssDevice> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<GnssDevice> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
@ -149,11 +149,10 @@ public class GnssDeviceController extends BasicController{
|
|||||||
*
|
*
|
||||||
* @param deviceInstallVO 设备安装信息
|
* @param deviceInstallVO 设备安装信息
|
||||||
* @return HttpResult
|
* @return HttpResult
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("/gnss/device/install")
|
@PostMapping("/gnss/device/install")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public HttpResult install(@Validated DeviceInstallVO deviceInstallVO) throws Exception {
|
public HttpResult install(@Validated DeviceInstallVO deviceInstallVO) {
|
||||||
QueryWrapper<GnssDevice> wrapper = new QueryWrapper<>();
|
QueryWrapper<GnssDevice> wrapper = new QueryWrapper<>();
|
||||||
wrapper.eq("deviceid",deviceInstallVO.getDeviceId());
|
wrapper.eq("deviceid",deviceInstallVO.getDeviceId());
|
||||||
GnssDevice gnssDevice = gnssDeviceMapper.selectOne(wrapper);
|
GnssDevice gnssDevice = gnssDeviceMapper.selectOne(wrapper);
|
||||||
@ -182,7 +181,7 @@ public class GnssDeviceController extends BasicController{
|
|||||||
if (gnssDevice == null) {
|
if (gnssDevice == null) {
|
||||||
return HttpResult.fail("设备不存在");
|
return HttpResult.fail("设备不存在");
|
||||||
}
|
}
|
||||||
GnssStatus gnssStatus = gnssStatusMapper.getByDeviceId(gnssDevice.getDeviceid());
|
GnssStatusJoin gnssStatus = gnssStatusMapper.queryByDeviceId(gnssDevice.getDeviceid());
|
||||||
DeviceStatusVO deviceStatusVO = new DeviceStatusVO(gnssDevice, gnssStatus);
|
DeviceStatusVO deviceStatusVO = new DeviceStatusVO(gnssDevice, gnssStatus);
|
||||||
return HttpResult.success(deviceStatusVO);
|
return HttpResult.success(deviceStatusVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,8 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class GnssGroupController {
|
public class GnssGroupController {
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -24,22 +22,22 @@ public class GnssGroupController {
|
|||||||
|
|
||||||
/********* 推送页面 *********/
|
/********* 推送页面 *********/
|
||||||
@RequestMapping("/page/table/gnss_add_group")
|
@RequestMapping("/page/table/gnss_add_group")
|
||||||
public String gnssAddGroup()throws Exception {
|
public String gnssAddGroup() {
|
||||||
return "/page/table/gnss_add_group";
|
return "/page/table/gnss_add_group";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/page/table/gnss_add_group_calc")
|
@RequestMapping("/page/table/gnss_add_group_calc")
|
||||||
public String gnssAddCalcGroup()throws Exception {
|
public String gnssAddCalcGroup() {
|
||||||
return "/page/table/gnss_add_group_calc";
|
return "/page/table/gnss_add_group_calc";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/page/table/gnss_add_group_fwd")
|
@RequestMapping("/page/table/gnss_add_group_fwd")
|
||||||
public String gnssAddPushGroup()throws Exception {
|
public String gnssAddPushGroup() {
|
||||||
return "/page/table/gnss_add_group_fwd";
|
return "/page/table/gnss_add_group_fwd";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/page/gnss_group_cfg")
|
@RequestMapping("/page/gnss_group_cfg")
|
||||||
public String gnssGroupCfg()throws Exception {
|
public String gnssGroupCfg() {
|
||||||
return "/page/gnss_group_cfg";
|
return "/page/gnss_group_cfg";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +98,7 @@ public class GnssGroupController {
|
|||||||
|
|
||||||
@PostMapping("/gnss/group/update_calc")
|
@PostMapping("/gnss/group/update_calc")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String updateCalc(@RequestBody JSONObject object) throws Exception {
|
public String updateCalc(@RequestBody JSONObject object) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
GnssGroupCalc group = JSONObject.toJavaObject(object,GnssGroupCalc.class);
|
GnssGroupCalc group = JSONObject.toJavaObject(object,GnssGroupCalc.class);
|
||||||
if(null != gnssGroupCalcMapper.selectById(group.getId())) {
|
if(null != gnssGroupCalcMapper.selectById(group.getId())) {
|
||||||
@ -116,7 +114,7 @@ public class GnssGroupController {
|
|||||||
|
|
||||||
@PostMapping("/gnss/group/delete_calc")
|
@PostMapping("/gnss/group/delete_calc")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String deleteCalc(@RequestParam int del_id) throws Exception {
|
public String deleteCalc(@RequestParam int del_id) {
|
||||||
int num = gnssGroupCalcMapper.deleteById(del_id);
|
int num = gnssGroupCalcMapper.deleteById(del_id);
|
||||||
if (num == 0) {
|
if (num == 0) {
|
||||||
return HttpResult.failed();
|
return HttpResult.failed();
|
||||||
@ -140,7 +138,7 @@ public class GnssGroupController {
|
|||||||
|
|
||||||
@PostMapping("/gnss/group/update_fwd")
|
@PostMapping("/gnss/group/update_fwd")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String updateFwd(@RequestBody JSONObject object) throws Exception {
|
public String updateFwd(@RequestBody JSONObject object) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
GnssGroupFwd group = JSONObject.toJavaObject(object,GnssGroupFwd.class);
|
GnssGroupFwd group = JSONObject.toJavaObject(object,GnssGroupFwd.class);
|
||||||
if(null != gnssGroupFwdMapper.selectById(group.getId())) {
|
if(null != gnssGroupFwdMapper.selectById(group.getId())) {
|
||||||
@ -156,7 +154,7 @@ public class GnssGroupController {
|
|||||||
|
|
||||||
@PostMapping("/gnss/group/delete_fwd")
|
@PostMapping("/gnss/group/delete_fwd")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String deleteFwd(@RequestParam int del_id) throws Exception {
|
public String deleteFwd(@RequestParam int del_id) {
|
||||||
int num = gnssGroupFwdMapper.deleteById(del_id);
|
int num = gnssGroupFwdMapper.deleteById(del_id);
|
||||||
if (num == 0) {
|
if (num == 0) {
|
||||||
return HttpResult.failed();
|
return HttpResult.failed();
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package com.imdroid.beidou.controller;
|
package com.imdroid.beidou.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.yulichang.query.MPJQueryWrapper;
|
||||||
import com.imdroid.secapi.dto.GnssStatus;
|
import com.imdroid.secapi.dto.GnssStatus;
|
||||||
|
import com.imdroid.secapi.dto.GnssStatusJoin;
|
||||||
import com.imdroid.secapi.dto.GnssStatusMapper;
|
import com.imdroid.secapi.dto.GnssStatusMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -21,7 +22,7 @@ public class GnssStatusController extends BasicController{
|
|||||||
|
|
||||||
/**** 推送页面 *****/
|
/**** 推送页面 *****/
|
||||||
@RequestMapping("/page/gnss_status")
|
@RequestMapping("/page/gnss_status")
|
||||||
public String gnssStatus(Model m, HttpSession session)throws Exception {
|
public String gnssStatus(Model m, HttpSession session) {
|
||||||
initModel(m, session);
|
initModel(m, session);
|
||||||
|
|
||||||
return "/page/gnss_status";
|
return "/page/gnss_status";
|
||||||
@ -31,9 +32,13 @@ public class GnssStatusController extends BasicController{
|
|||||||
/**** 推送数据 *****/
|
/**** 推送数据 *****/
|
||||||
@RequestMapping("/gnss/status/list")
|
@RequestMapping("/gnss/status/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public JSONObject list(HttpSession session, int page, int limit, String searchParams) {
|
public JSONObject list(int page, int limit, String searchParams) {
|
||||||
Page<GnssStatus> pageable = new Page<>(page, limit);
|
Page<GnssStatus> pageable = new Page<>(page, limit);
|
||||||
QueryWrapper<GnssStatus> queryWrapper = new QueryWrapper<>();
|
|
||||||
|
MPJQueryWrapper queryWrapper = new MPJQueryWrapper<GnssStatus>()
|
||||||
|
.selectAll(GnssStatus.class)
|
||||||
|
.select("d.devicetype as devicetype","d.tenantid as tenantid")
|
||||||
|
.leftJoin("gnssdevices d on t.deviceid = d.deviceid");
|
||||||
|
|
||||||
// 条件查询
|
// 条件查询
|
||||||
if(searchParams != null) {
|
if(searchParams != null) {
|
||||||
@ -55,7 +60,8 @@ public class GnssStatusController extends BasicController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IPage<GnssStatus> cs = gnssStatusMapper.selectPage(pageable, queryWrapper);
|
//分页查询 (需要启用 mybatis plus 分页插件)
|
||||||
|
IPage<GnssStatusJoin> cs = gnssStatusMapper.selectJoinPage(new Page<>(page, limit), GnssStatusJoin.class, queryWrapper);
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("code", 0);
|
jsonObject.put("code", 0);
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package com.imdroid.beidou.data.vo.device;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.imdroid.secapi.dto.GnssDevice;
|
import com.imdroid.secapi.dto.GnssDevice;
|
||||||
import com.imdroid.secapi.dto.GnssStatus;
|
import com.imdroid.secapi.dto.GnssStatusJoin;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
@ -44,8 +44,8 @@ public class DeviceStatusVO {
|
|||||||
private Integer rxbytes;
|
private Integer rxbytes;
|
||||||
private Integer b562bytes;
|
private Integer b562bytes;
|
||||||
private Integer d3xxbytes;
|
private Integer d3xxbytes;
|
||||||
private Integer satelliteInView;
|
private Integer satelliteinview;
|
||||||
private Integer satelliteInUse;
|
private Integer satelliteinuse;
|
||||||
|
|
||||||
private Short dtuState;
|
private Short dtuState;
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ public class DeviceStatusVO {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeviceStatusVO(GnssDevice gnssDevice, GnssStatus gnssStatus) {
|
public DeviceStatusVO(GnssDevice gnssDevice, GnssStatusJoin gnssStatus) {
|
||||||
this.id = gnssDevice.getId();
|
this.id = gnssDevice.getId();
|
||||||
this.deviceId = gnssDevice.getDeviceid();
|
this.deviceId = gnssDevice.getDeviceid();
|
||||||
this.name = gnssDevice.getName();
|
this.name = gnssDevice.getName();
|
||||||
@ -75,8 +75,8 @@ public class DeviceStatusVO {
|
|||||||
this.rxbytes = gnssStatus.getRxbytes();
|
this.rxbytes = gnssStatus.getRxbytes();
|
||||||
this.d3xxbytes = gnssStatus.getD3xxbytes();
|
this.d3xxbytes = gnssStatus.getD3xxbytes();
|
||||||
this.b562bytes = gnssStatus.getB562bytes();
|
this.b562bytes = gnssStatus.getB562bytes();
|
||||||
this.satelliteInView = gnssStatus.getSatelliteinview();
|
this.satelliteinview = gnssStatus.getSatelliteinview();
|
||||||
this.satelliteInUse = gnssStatus.getSatelliteinuse();
|
this.satelliteinuse = gnssStatus.getSatelliteinuse();
|
||||||
this.dtuState = gnssStatus.getState();
|
this.dtuState = gnssStatus.getState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user