设备统计
This commit is contained in:
parent
4d06c03d8c
commit
0ba32fdb55
|
@ -1,163 +0,0 @@
|
|||
package org.jeecg.modules.zh.deviceinfo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.zh.deviceinfo.entity.DeviceInfo;
|
||||
import org.jeecg.modules.zh.deviceinfo.service.IDeviceInfo2Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Description: 设备信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-07-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="设备信息")
|
||||
@RestController
|
||||
@RequestMapping("/deviceinfo/deviceInfo")
|
||||
@Slf4j
|
||||
public class DeviceInfoController extends JeecgController<DeviceInfo, IDeviceInfo2Service> {
|
||||
@Autowired
|
||||
private IDeviceInfo2Service deviceInfoService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param deviceInfo
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "设备信息-分页列表查询")
|
||||
@ApiOperation(value="设备信息-分页列表查询", notes="设备信息-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<DeviceInfo>> queryPageList(DeviceInfo deviceInfo,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<DeviceInfo> queryWrapper = QueryGenerator.initQueryWrapper(deviceInfo, req.getParameterMap());
|
||||
Page<DeviceInfo> page = new Page<DeviceInfo>(pageNo, pageSize);
|
||||
// IPage<DeviceInfo> pageList = deviceInfoService.page(page, queryWrapper);
|
||||
IPage<DeviceInfo> pageList = deviceInfoService.queryDeviceInfoWithRelatedTables(page, deviceInfo, req.getParameterMap());
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param deviceInfo
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "设备信息-添加")
|
||||
@ApiOperation(value="设备信息-添加", notes="设备信息-添加")
|
||||
@RequiresPermissions("deviceinfo:bl_device_info:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody DeviceInfo deviceInfo) {
|
||||
deviceInfoService.save(deviceInfo);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param deviceInfo
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "设备信息-编辑")
|
||||
@ApiOperation(value="设备信息-编辑", notes="设备信息-编辑")
|
||||
@RequiresPermissions("deviceinfo:bl_device_info:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody DeviceInfo deviceInfo) {
|
||||
deviceInfoService.updateById(deviceInfo);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "设备信息-通过id删除")
|
||||
@ApiOperation(value="设备信息-通过id删除", notes="设备信息-通过id删除")
|
||||
@RequiresPermissions("deviceinfo:bl_device_info:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
deviceInfoService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "设备信息-批量删除")
|
||||
@ApiOperation(value="设备信息-批量删除", notes="设备信息-批量删除")
|
||||
@RequiresPermissions("deviceinfo:bl_device_info:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.deviceInfoService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "设备信息-通过id查询")
|
||||
@ApiOperation(value="设备信息-通过id查询", notes="设备信息-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<DeviceInfo> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
DeviceInfo deviceInfo = deviceInfoService.getById(id);
|
||||
if(deviceInfo==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(deviceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param deviceInfo
|
||||
*/
|
||||
@RequiresPermissions("deviceinfo:bl_device_info:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, DeviceInfo deviceInfo) {
|
||||
return super.exportXls(request, deviceInfo, DeviceInfo.class, "设备信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("deviceinfo:bl_device_info:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, DeviceInfo.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package org.jeecg.modules.zh.deviceinfo.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.zh.deviceinfo.entity.DeviceInfo;
|
||||
|
||||
/**
|
||||
* @Description: 设备信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-07-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DeviceInfo2Mapper extends BaseMapper<DeviceInfo> {
|
||||
|
||||
IPage<DeviceInfo> selectDeviceInfoWithRelatedTables(Page<DeviceInfo> page, @Param(Constants.WRAPPER) QueryWrapper<DeviceInfo> queryWrapper);
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.zh.deviceinfo.mapper.DeviceInfo2Mapper">
|
||||
|
||||
<select id="selectDeviceInfoWithRelatedTables" resultType="org.jeecg.modules.zh.deviceinfo.entity.DeviceInfo">
|
||||
SELECT
|
||||
di.*,
|
||||
hi.name as housingestateName
|
||||
FROM
|
||||
bl_device_info di
|
||||
LEFT JOIN bl_housingestate_info hi ON di.housingestate_id = hi.housingestate_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -1,20 +0,0 @@
|
|||
package org.jeecg.modules.zh.deviceinfo.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.zh.deviceinfo.entity.DeviceInfo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 设备信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-07-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDeviceInfo2Service extends IService<DeviceInfo> {
|
||||
|
||||
IPage<DeviceInfo> queryDeviceInfoWithRelatedTables(Page<DeviceInfo> page, DeviceInfo deviceInfo, Map<String, String[]> parameterMap);
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package org.jeecg.modules.zh.deviceinfo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.zh.deviceinfo.entity.DeviceInfo;
|
||||
import org.jeecg.modules.zh.deviceinfo.mapper.DeviceInfo2Mapper;
|
||||
import org.jeecg.modules.zh.deviceinfo.service.IDeviceInfo2Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 设备信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-07-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DeviceInfo2ServiceImpl extends ServiceImpl<DeviceInfo2Mapper, DeviceInfo> implements IDeviceInfo2Service {
|
||||
|
||||
@Override
|
||||
public IPage<DeviceInfo> queryDeviceInfoWithRelatedTables(Page<DeviceInfo> page, DeviceInfo deviceInfo, Map<String, String[]> parameterMap) {
|
||||
// 构建基础查询条件
|
||||
QueryWrapper<DeviceInfo> queryWrapper = QueryGenerator.initQueryWrapper(deviceInfo, parameterMap);
|
||||
String[] housingestateNames = parameterMap.get("housingestateName");
|
||||
if(housingestateNames!=null){
|
||||
String housingestateName = housingestateNames[0];
|
||||
if(StringUtils.isNotBlank(housingestateName)){
|
||||
queryWrapper.like("hi.name",housingestateName);
|
||||
}
|
||||
}
|
||||
// 执行拼表查询
|
||||
return baseMapper.selectDeviceInfoWithRelatedTables(page, queryWrapper);
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ public class Hy implements Serializable {
|
|||
private String type;
|
||||
private String housingestateId;
|
||||
private String housingestateName;
|
||||
private String content;
|
||||
private String beginTime;
|
||||
private String endTime;
|
||||
|
||||
|
|
|
@ -90,6 +90,13 @@
|
|||
|
||||
<select id="querySheBeiTdcsList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
|
||||
select
|
||||
b.name as housingestateName,
|
||||
c.content,
|
||||
a.imei,
|
||||
a.cn
|
||||
from (
|
||||
select
|
||||
housingestate_id,
|
||||
imei,
|
||||
count(*) as cn
|
||||
from bl_order_info
|
||||
|
@ -98,9 +105,12 @@
|
|||
<if test="housingestateId!=null and housingestateId!=''">
|
||||
and housingestate_id = #{housingestateId}
|
||||
</if>
|
||||
group by imei
|
||||
group by housingestate_id,imei
|
||||
order by cn desc
|
||||
limit 10
|
||||
) a
|
||||
left join bl_housingestate_info b on a.housingestate_id = b.housingestate_id
|
||||
left join bl_device_info c on a.imei = c.imei
|
||||
</select>
|
||||
|
||||
<select id="queryAllSheBeiTdcsList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
package org.jeecg.modules.zh.view.shebei.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.modules.zh.view.shebei.entity.Shebei;
|
||||
import org.jeecg.modules.zh.view.shebei.service.IShebeiService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Description: 设备信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-07-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="设备信息")
|
||||
@RestController
|
||||
@RequestMapping("/zh/shebei")
|
||||
@Slf4j
|
||||
public class ShebeiController extends JeecgController<Shebei, IShebeiService> {
|
||||
@Autowired
|
||||
private IShebeiService deviceInfoService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param shebei
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "设备信息-分页列表查询")
|
||||
@ApiOperation(value="设备信息-分页列表查询", notes="设备信息-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Shebei>> queryPageList(Shebei shebei,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Page<Shebei> page = new Page<Shebei>(pageNo, pageSize);
|
||||
IPage<Shebei> pageList = deviceInfoService.queryDeviceInfo(page, shebei);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.jeecg.modules.zh.deviceinfo.entity;
|
||||
package org.jeecg.modules.zh.view.shebei.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
|
@ -27,7 +27,7 @@ import java.util.Date;
|
|||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="bl_device_info对象", description="设备信息")
|
||||
public class DeviceInfo implements Serializable {
|
||||
public class Shebei implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
|
@ -91,4 +91,14 @@ public class DeviceInfo implements Serializable {
|
|||
|
||||
@TableField(exist = false)
|
||||
private String housingestateName;
|
||||
/**注册会员数*/
|
||||
@Excel(name = "注册会员数", width = 15)
|
||||
@ApiModelProperty(value = "注册会员数")
|
||||
@TableField(exist = false)
|
||||
private String hyCount;
|
||||
/**投递次数*/
|
||||
@Excel(name = "投递次数", width = 15)
|
||||
@ApiModelProperty(value = "投递次数")
|
||||
@TableField(exist = false)
|
||||
private String tdcsCount;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.zh.view.shebei.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.zh.view.shebei.entity.Shebei;
|
||||
|
||||
/**
|
||||
* @Description: 设备信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-07-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ShebeiMapper extends BaseMapper<Shebei> {
|
||||
|
||||
IPage<Shebei> queryDeviceInfo(Page<Shebei> page, @Param("params") Shebei shebei);
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.zh.view.shebei.mapper.ShebeiMapper">
|
||||
|
||||
<select id="queryDeviceInfo" resultType="org.jeecg.modules.zh.view.shebei.entity.Shebei">
|
||||
SELECT
|
||||
a.device_id as deviceId,
|
||||
a.imei,
|
||||
a.iccid,
|
||||
a.is_online as isOnline,
|
||||
a.content,
|
||||
a.lnglat,
|
||||
a.box_num as boxNum,
|
||||
a.in_warehouse as inWarehouse,
|
||||
b.name as housingestateName,
|
||||
(select count(*) from bl_user_info b where a.imei = b.imei) as hyCount,
|
||||
(select count(*) from bl_order_info b where a.imei = b.imei) as tdcsCount
|
||||
FROM bl_device_info a
|
||||
LEFT JOIN bl_housingestate_info b ON a.housingestate_id = b.housingestate_id
|
||||
<where>
|
||||
<if test="params.housingestateId != null and params.housingestateId != ''">
|
||||
AND a.housingestate_id = #{params.housingestateId}
|
||||
</if>
|
||||
<if test="params.imei != null and params.imei != ''">
|
||||
AND a.imei LIKE concat('%',#{params.imei},'%')
|
||||
</if>
|
||||
<if test="params.isOnline != null and params.isOnline != ''">
|
||||
AND a.is_online = #{params.isOnline}
|
||||
</if>
|
||||
<if test="params.inWarehouse != null and params.inWarehouse != ''">
|
||||
AND a.in_warehouse = #{params.inWarehouse}
|
||||
</if>
|
||||
</where>
|
||||
order by a.device_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,18 @@
|
|||
package org.jeecg.modules.zh.view.shebei.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.zh.view.shebei.entity.Shebei;
|
||||
|
||||
/**
|
||||
* @Description: 设备信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-07-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IShebeiService extends IService<Shebei> {
|
||||
|
||||
IPage<Shebei> queryDeviceInfo(Page<Shebei> page, Shebei shebei);
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package org.jeecg.modules.zh.view.shebei.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.zh.view.shebei.entity.Shebei;
|
||||
import org.jeecg.modules.zh.view.shebei.mapper.ShebeiMapper;
|
||||
import org.jeecg.modules.zh.view.shebei.service.IShebeiService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description: 设备信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-07-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ShebeiServiceImpl extends ServiceImpl<ShebeiMapper, Shebei> implements IShebeiService {
|
||||
|
||||
@Override
|
||||
public IPage<Shebei> queryDeviceInfo(Page<Shebei> page, Shebei shebei) {
|
||||
return baseMapper.queryDeviceInfo(page, shebei);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue