顾挽-智慧校园-11-14
This commit is contained in:
parent
66548134db
commit
6902b671ed
6
pom.xml
6
pom.xml
|
@ -280,6 +280,12 @@
|
|||
<version>1.45</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||
<version>1.5.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<!-- 阿里云maven仓库 -->
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package net.shapelight.common.base;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
public class BasePageDTO {
|
||||
|
||||
private Long current;
|
||||
|
||||
private Long size;
|
||||
}
|
|
@ -4,8 +4,14 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.shapelight.common.base.BasePageDTO;
|
||||
import net.shapelight.common.utils.R;
|
||||
import net.shapelight.modules.mobile.dto.DeviceGruopQueryDto;
|
||||
import net.shapelight.modules.mobile.dto.MobileDeviceGroupAddDto;
|
||||
import net.shapelight.modules.mobile.entity.MobileDeviceGroup;
|
||||
import net.shapelight.modules.mobile.service.MobileDeviceGroupService;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -14,36 +20,46 @@ import java.util.Map;
|
|||
@RestController
|
||||
@RequestMapping("mobile/device/group/")
|
||||
@Api("话机设备组管理")
|
||||
@RequiredArgsConstructor
|
||||
public class DeviceGroupController {
|
||||
|
||||
@PostMapping("list")
|
||||
private final MobileDeviceGroupService mobileDeviceGroupService;
|
||||
|
||||
@GetMapping("list")
|
||||
@ApiOperation("话机设备组列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="limit",value = "每页条数",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name="page",value = "页码",paramType = "query",dataType = "String",required = true),
|
||||
@ApiImplicitParam(name = "groupName", value = "设备组名称", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "status", value = "设备组状态", paramType = "query", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "cellName", value = "学校名称", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "deptId", value = "设备组区域名称", paramType = "query", dataType = "String")
|
||||
})
|
||||
public R list(@RequestBody Map<String, Object> params) {
|
||||
return R.ok();
|
||||
public R list(@RequestParam(defaultValue = "1") Long page,
|
||||
@RequestParam(defaultValue = "1") Long size,
|
||||
@RequestParam(required = false) Long groupId,
|
||||
@RequestParam(required = false) Integer status) {
|
||||
|
||||
DeviceGruopQueryDto deviceGruopQueryDto = new DeviceGruopQueryDto();
|
||||
deviceGruopQueryDto.setCurrent(page);
|
||||
deviceGruopQueryDto.setSize(size);
|
||||
deviceGruopQueryDto.setGroupId(groupId);
|
||||
deviceGruopQueryDto.setStatus(status);
|
||||
|
||||
|
||||
|
||||
return R.ok().put("data", mobileDeviceGroupService.list(deviceGruopQueryDto));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("add")
|
||||
@ApiOperation("设备组新增")
|
||||
public R add(@RequestBody MobileDeviceGroup mobileDeviceGroup) {
|
||||
public R add(@RequestBody MobileDeviceGroupAddDto mobileDeviceGroupAddDto) {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("remove")
|
||||
@DeleteMapping("remove")
|
||||
@ApiOperation("设备组删除")
|
||||
@ApiImplicitParam(name = "groupId",value = "设备组ID",paramType = "query",dataType = "List",required = true)
|
||||
public R remove(@RequestBody List<Long> groupId) {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("update")
|
||||
@PutMapping("update")
|
||||
@ApiOperation("设备组更新")
|
||||
public R update(@RequestBody MobileDeviceGroup mobileDeviceGroup) {
|
||||
return R.ok();
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package net.shapelight.modules.mobile.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.shapelight.common.base.BasePageDTO;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class DeviceGruopQueryDto extends BasePageDTO {
|
||||
/**
|
||||
* 设备组id
|
||||
*/
|
||||
private Long groupId;
|
||||
/**
|
||||
* 设备组状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package net.shapelight.modules.mobile.dto;
|
||||
|
||||
public class MobileDeviceGroupAddDto {
|
||||
/**
|
||||
* 设备组名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
}
|
|
@ -57,7 +57,7 @@ public class MobileDeviceGroup implements Serializable {
|
|||
* 描述
|
||||
*/
|
||||
@ApiModelProperty(name = "描述",required = true)
|
||||
private String describe;
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 学校名称
|
||||
|
|
|
@ -30,9 +30,9 @@ public class MobilePackageOrder implements Serializable {
|
|||
@ApiModelProperty("订单ID")
|
||||
private Long orderId;
|
||||
/**
|
||||
* 学生ID
|
||||
* 家长ID
|
||||
*/
|
||||
@ApiModelProperty("学生ID")
|
||||
@ApiModelProperty("家长ID")
|
||||
private Long personId;
|
||||
/**
|
||||
* 套餐ID
|
||||
|
|
|
@ -2,6 +2,8 @@ package net.shapelight.modules.mobile.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.shapelight.modules.mobile.entity.MobileCallLogs;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
|
||||
/**
|
||||
* @author zhangbo
|
||||
|
@ -9,7 +11,8 @@ import net.shapelight.modules.mobile.entity.MobileCallLogs;
|
|||
* @createDate 2024-11-14 09:51:55
|
||||
* @Entity net.shapelight.modules.mobile.entity.MobileCallLogs
|
||||
*/
|
||||
public interface MobileCallLogsMapper extends BaseMapper<MobileCallLogs> {
|
||||
@Mapper
|
||||
public interface MobileCallLogsMapper extends MPJBaseMapper<MobileCallLogs> {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package net.shapelight.modules.mobile.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import net.shapelight.modules.mobile.entity.MobileDeviceGroup;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author zhangbo
|
||||
|
@ -9,7 +11,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
* @createDate 2024-11-13 11:50:36
|
||||
* @Entity net.shapelight.modules.mobile.entity.MobileDeviceGroup
|
||||
*/
|
||||
public interface MobileDeviceGroupMapper extends BaseMapper<MobileDeviceGroup> {
|
||||
@Mapper
|
||||
public interface MobileDeviceGroupMapper extends MPJBaseMapper<MobileDeviceGroup> {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package net.shapelight.modules.mobile.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import net.shapelight.modules.mobile.entity.MobileDevice;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author zhangbo
|
||||
|
@ -9,7 +11,8 @@ import net.shapelight.modules.mobile.entity.MobileDevice;
|
|||
* @createDate 2024-11-13 14:36:39
|
||||
* @Entity net.shapelight.modules.mobile.entity.MobileDevice
|
||||
*/
|
||||
public interface MobileDeviceMapper extends BaseMapper<MobileDevice> {
|
||||
@Mapper
|
||||
public interface MobileDeviceMapper extends MPJBaseMapper<MobileDevice> {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package net.shapelight.modules.mobile.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import net.shapelight.modules.mobile.entity.MobilePackage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author zhangbo
|
||||
|
@ -9,7 +11,8 @@ import net.shapelight.modules.mobile.entity.MobilePackage;
|
|||
* @createDate 2024-11-14 09:50:19
|
||||
* @Entity net.shapelight.modules.mobile.entity.MobilePackage
|
||||
*/
|
||||
public interface MobilePackageMapper extends BaseMapper<MobilePackage> {
|
||||
@Mapper
|
||||
public interface MobilePackageMapper extends MPJBaseMapper<MobilePackage> {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package net.shapelight.modules.mobile.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import net.shapelight.modules.mobile.entity.MobilePackageOrder;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author zhangbo
|
||||
|
@ -9,7 +11,8 @@ import net.shapelight.modules.mobile.entity.MobilePackageOrder;
|
|||
* @createDate 2024-11-14 09:51:08
|
||||
* @Entity net.shapelight.modules.mobile.entity.MobilePackageOrder
|
||||
*/
|
||||
public interface MobilePackageOrderMapper extends BaseMapper<MobilePackageOrder> {
|
||||
@Mapper
|
||||
public interface MobilePackageOrderMapper extends MPJBaseMapper<MobilePackageOrder> {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package net.shapelight.modules.mobile.service;
|
||||
|
||||
import net.shapelight.modules.mobile.dto.DeviceGruopQueryDto;
|
||||
import net.shapelight.modules.mobile.entity.MobileDeviceGroup;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import net.shapelight.modules.mobile.vo.MobileDeviceGroupVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangbo
|
||||
|
@ -9,5 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
* @createDate 2024-11-13 11:50:36
|
||||
*/
|
||||
public interface MobileDeviceGroupService extends IService<MobileDeviceGroup> {
|
||||
|
||||
List<MobileDeviceGroupVo> list(DeviceGruopQueryDto deviceGruopQueryDto);
|
||||
}
|
||||
|
|
|
@ -1,20 +1,61 @@
|
|||
package net.shapelight.modules.mobile.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.shapelight.modules.mobile.dto.DeviceGruopQueryDto;
|
||||
import net.shapelight.modules.mobile.entity.MobileDevice;
|
||||
import net.shapelight.modules.mobile.entity.MobileDeviceGroup;
|
||||
import net.shapelight.modules.mobile.mapper.MobileDeviceMapper;
|
||||
import net.shapelight.modules.mobile.service.MobileDeviceGroupService;
|
||||
import net.shapelight.modules.mobile.mapper.MobileDeviceGroupMapper;
|
||||
import net.shapelight.modules.mobile.vo.MobileDeviceGroupVo;
|
||||
import net.shapelight.modules.ten.entity.TenCellEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author zhangbo
|
||||
* @description 针对表【mobile_device_group】的数据库操作Service实现
|
||||
* @createDate 2024-11-13 11:50:36
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MobileDeviceGroupServiceImpl extends ServiceImpl<MobileDeviceGroupMapper, MobileDeviceGroup>
|
||||
implements MobileDeviceGroupService{
|
||||
|
||||
private final MobileDeviceGroupMapper mobileDeviceGroupMapper;
|
||||
|
||||
private final MobileDeviceMapper mobileDeviceMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<MobileDeviceGroupVo> list(DeviceGruopQueryDto deviceGruopQueryDto) {
|
||||
List<MobileDeviceGroupVo> mobileDeviceGroupVos = mobileDeviceGroupMapper.selectJoinPage(
|
||||
new Page<>(deviceGruopQueryDto.getCurrent(), deviceGruopQueryDto.getSize()),
|
||||
MobileDeviceGroupVo.class,
|
||||
new MPJLambdaWrapper<MobileDeviceGroup>()
|
||||
.select(MobileDeviceGroup::getGroupId, MobileDeviceGroup::getGroupName,
|
||||
MobileDeviceGroup::getDeviceCount, MobileDeviceGroup::getCellId,
|
||||
MobileDeviceGroup::getDescription, MobileDeviceGroup::getStatus)
|
||||
.select(TenCellEntity::getProvince, TenCellEntity::getCity)
|
||||
.leftJoin(TenCellEntity.class, TenCellEntity::getCellId, MobileDeviceGroup::getCellId)
|
||||
.eq(Objects.nonNull(deviceGruopQueryDto.getGroupId()),
|
||||
MobileDeviceGroup::getGroupId, deviceGruopQueryDto.getGroupId())
|
||||
.eq(Objects.nonNull(deviceGruopQueryDto.getStatus()),
|
||||
MobileDeviceGroup::getStatus, deviceGruopQueryDto.getStatus())).getRecords();
|
||||
|
||||
for (MobileDeviceGroupVo mobileDeviceGroupVo : mobileDeviceGroupVos) {
|
||||
Integer count = (int) mobileDeviceMapper.selectList(new LambdaQueryWrapper<MobileDevice>().eq(MobileDevice::getGroupId, mobileDeviceGroupVo.getGroupId())).stream().count();
|
||||
mobileDeviceGroupVo.setNowDeviceCount(count);
|
||||
}
|
||||
return mobileDeviceGroupVos;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package net.shapelight.modules.mobile.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MobileDeviceGroupVo {
|
||||
/**
|
||||
* 设备组id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long groupId;
|
||||
/**
|
||||
* 设备组名称
|
||||
*/
|
||||
private String groupName;
|
||||
/**
|
||||
* 当前设备数量
|
||||
*/
|
||||
private Integer nowDeviceCount;
|
||||
/**
|
||||
* 最大设备数量
|
||||
*/
|
||||
private Integer deviceCount;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long cellId;
|
||||
/**
|
||||
* 所在省份
|
||||
*/
|
||||
private String province;
|
||||
/**
|
||||
* 所在城市
|
||||
*/
|
||||
private String city;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue