顾挽-智慧校园-11-14

This commit is contained in:
ovo 2024-11-14 18:37:28 +08:00
parent 66548134db
commit 6902b671ed
15 changed files with 198 additions and 23 deletions

View File

@ -280,6 +280,12 @@
<version>1.45</version> <version>1.45</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join-boot-starter</artifactId>
<version>1.5.0</version>
</dependency>
</dependencies> </dependencies>
<!-- 阿里云maven仓库 --> <!-- 阿里云maven仓库 -->

View File

@ -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;
}

View File

@ -4,8 +4,14 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.shapelight.common.base.BasePageDTO;
import net.shapelight.common.utils.R; 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.entity.MobileDeviceGroup;
import net.shapelight.modules.mobile.service.MobileDeviceGroupService;
import org.apache.ibatis.annotations.Delete;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@ -14,36 +20,46 @@ import java.util.Map;
@RestController @RestController
@RequestMapping("mobile/device/group/") @RequestMapping("mobile/device/group/")
@Api("话机设备组管理") @Api("话机设备组管理")
@RequiredArgsConstructor
public class DeviceGroupController { public class DeviceGroupController {
@PostMapping("list") private final MobileDeviceGroupService mobileDeviceGroupService;
@GetMapping("list")
@ApiOperation("话机设备组列表") @ApiOperation("话机设备组列表")
@ApiImplicitParams({ public R list(@RequestParam(defaultValue = "1") Long page,
@ApiImplicitParam(name="limit",value = "每页条数",paramType = "query",dataType = "String",required = true), @RequestParam(defaultValue = "1") Long size,
@ApiImplicitParam(name="page",value = "页码",paramType = "query",dataType = "String",required = true), @RequestParam(required = false) Long groupId,
@ApiImplicitParam(name = "groupName", value = "设备组名称", paramType = "query", dataType = "String"), @RequestParam(required = false) Integer status) {
@ApiImplicitParam(name = "status", value = "设备组状态", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "cellName", value = "学校名称", paramType = "query", dataType = "String"), DeviceGruopQueryDto deviceGruopQueryDto = new DeviceGruopQueryDto();
@ApiImplicitParam(name = "deptId", value = "设备组区域名称", paramType = "query", dataType = "String") deviceGruopQueryDto.setCurrent(page);
}) deviceGruopQueryDto.setSize(size);
public R list(@RequestBody Map<String, Object> params) { deviceGruopQueryDto.setGroupId(groupId);
return R.ok(); deviceGruopQueryDto.setStatus(status);
return R.ok().put("data", mobileDeviceGroupService.list(deviceGruopQueryDto));
} }
@PostMapping("add") @PostMapping("add")
@ApiOperation("设备组新增") @ApiOperation("设备组新增")
public R add(@RequestBody MobileDeviceGroup mobileDeviceGroup) { public R add(@RequestBody MobileDeviceGroupAddDto mobileDeviceGroupAddDto) {
return R.ok(); return R.ok();
} }
@PostMapping("remove") @DeleteMapping("remove")
@ApiOperation("设备组删除") @ApiOperation("设备组删除")
@ApiImplicitParam(name = "groupId",value = "设备组ID",paramType = "query",dataType = "List",required = true) @ApiImplicitParam(name = "groupId",value = "设备组ID",paramType = "query",dataType = "List",required = true)
public R remove(@RequestBody List<Long> groupId) { public R remove(@RequestBody List<Long> groupId) {
return R.ok(); return R.ok();
} }
@PostMapping("update") @PutMapping("update")
@ApiOperation("设备组更新") @ApiOperation("设备组更新")
public R update(@RequestBody MobileDeviceGroup mobileDeviceGroup) { public R update(@RequestBody MobileDeviceGroup mobileDeviceGroup) {
return R.ok(); return R.ok();

View File

@ -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;
}

View File

@ -0,0 +1,11 @@
package net.shapelight.modules.mobile.dto;
public class MobileDeviceGroupAddDto {
/**
* 设备组名称
*/
private String name;
/**
*
*/
}

View File

@ -57,7 +57,7 @@ public class MobileDeviceGroup implements Serializable {
* 描述 * 描述
*/ */
@ApiModelProperty(name = "描述",required = true) @ApiModelProperty(name = "描述",required = true)
private String describe; private String description;
/** /**
* 学校名称 * 学校名称

View File

@ -30,9 +30,9 @@ public class MobilePackageOrder implements Serializable {
@ApiModelProperty("订单ID") @ApiModelProperty("订单ID")
private Long orderId; private Long orderId;
/** /**
* 学生ID * 家长ID
*/ */
@ApiModelProperty("学生ID") @ApiModelProperty("家长ID")
private Long personId; private Long personId;
/** /**
* 套餐ID * 套餐ID

View File

@ -2,6 +2,8 @@ package net.shapelight.modules.mobile.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.mobile.entity.MobileCallLogs; import net.shapelight.modules.mobile.entity.MobileCallLogs;
import org.apache.ibatis.annotations.Mapper;
import com.github.yulichang.base.MPJBaseMapper;
/** /**
* @author zhangbo * @author zhangbo
@ -9,7 +11,8 @@ import net.shapelight.modules.mobile.entity.MobileCallLogs;
* @createDate 2024-11-14 09:51:55 * @createDate 2024-11-14 09:51:55
* @Entity net.shapelight.modules.mobile.entity.MobileCallLogs * @Entity net.shapelight.modules.mobile.entity.MobileCallLogs
*/ */
public interface MobileCallLogsMapper extends BaseMapper<MobileCallLogs> { @Mapper
public interface MobileCallLogsMapper extends MPJBaseMapper<MobileCallLogs> {
} }

View File

@ -1,7 +1,9 @@
package net.shapelight.modules.mobile.mapper; package net.shapelight.modules.mobile.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import net.shapelight.modules.mobile.entity.MobileDeviceGroup; import net.shapelight.modules.mobile.entity.MobileDeviceGroup;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/** /**
* @author zhangbo * @author zhangbo
@ -9,7 +11,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @createDate 2024-11-13 11:50:36 * @createDate 2024-11-13 11:50:36
* @Entity net.shapelight.modules.mobile.entity.MobileDeviceGroup * @Entity net.shapelight.modules.mobile.entity.MobileDeviceGroup
*/ */
public interface MobileDeviceGroupMapper extends BaseMapper<MobileDeviceGroup> { @Mapper
public interface MobileDeviceGroupMapper extends MPJBaseMapper<MobileDeviceGroup> {
} }

View File

@ -1,7 +1,9 @@
package net.shapelight.modules.mobile.mapper; package net.shapelight.modules.mobile.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper;
import net.shapelight.modules.mobile.entity.MobileDevice; import net.shapelight.modules.mobile.entity.MobileDevice;
import org.apache.ibatis.annotations.Mapper;
/** /**
* @author zhangbo * @author zhangbo
@ -9,7 +11,8 @@ import net.shapelight.modules.mobile.entity.MobileDevice;
* @createDate 2024-11-13 14:36:39 * @createDate 2024-11-13 14:36:39
* @Entity net.shapelight.modules.mobile.entity.MobileDevice * @Entity net.shapelight.modules.mobile.entity.MobileDevice
*/ */
public interface MobileDeviceMapper extends BaseMapper<MobileDevice> { @Mapper
public interface MobileDeviceMapper extends MPJBaseMapper<MobileDevice> {
} }

View File

@ -1,7 +1,9 @@
package net.shapelight.modules.mobile.mapper; package net.shapelight.modules.mobile.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper;
import net.shapelight.modules.mobile.entity.MobilePackage; import net.shapelight.modules.mobile.entity.MobilePackage;
import org.apache.ibatis.annotations.Mapper;
/** /**
* @author zhangbo * @author zhangbo
@ -9,7 +11,8 @@ import net.shapelight.modules.mobile.entity.MobilePackage;
* @createDate 2024-11-14 09:50:19 * @createDate 2024-11-14 09:50:19
* @Entity net.shapelight.modules.mobile.entity.MobilePackage * @Entity net.shapelight.modules.mobile.entity.MobilePackage
*/ */
public interface MobilePackageMapper extends BaseMapper<MobilePackage> { @Mapper
public interface MobilePackageMapper extends MPJBaseMapper<MobilePackage> {
} }

View File

@ -1,7 +1,9 @@
package net.shapelight.modules.mobile.mapper; package net.shapelight.modules.mobile.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper;
import net.shapelight.modules.mobile.entity.MobilePackageOrder; import net.shapelight.modules.mobile.entity.MobilePackageOrder;
import org.apache.ibatis.annotations.Mapper;
/** /**
* @author zhangbo * @author zhangbo
@ -9,7 +11,8 @@ import net.shapelight.modules.mobile.entity.MobilePackageOrder;
* @createDate 2024-11-14 09:51:08 * @createDate 2024-11-14 09:51:08
* @Entity net.shapelight.modules.mobile.entity.MobilePackageOrder * @Entity net.shapelight.modules.mobile.entity.MobilePackageOrder
*/ */
public interface MobilePackageOrderMapper extends BaseMapper<MobilePackageOrder> { @Mapper
public interface MobilePackageOrderMapper extends MPJBaseMapper<MobilePackageOrder> {
} }

View File

@ -1,7 +1,11 @@
package net.shapelight.modules.mobile.service; package net.shapelight.modules.mobile.service;
import net.shapelight.modules.mobile.dto.DeviceGruopQueryDto;
import net.shapelight.modules.mobile.entity.MobileDeviceGroup; import net.shapelight.modules.mobile.entity.MobileDeviceGroup;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import net.shapelight.modules.mobile.vo.MobileDeviceGroupVo;
import java.util.List;
/** /**
* @author zhangbo * @author zhangbo
@ -9,5 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @createDate 2024-11-13 11:50:36 * @createDate 2024-11-13 11:50:36
*/ */
public interface MobileDeviceGroupService extends IService<MobileDeviceGroup> { public interface MobileDeviceGroupService extends IService<MobileDeviceGroup> {
List<MobileDeviceGroupVo> list(DeviceGruopQueryDto deviceGruopQueryDto);
} }

View File

@ -1,20 +1,61 @@
package net.shapelight.modules.mobile.service.impl; 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.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.entity.MobileDeviceGroup;
import net.shapelight.modules.mobile.mapper.MobileDeviceMapper;
import net.shapelight.modules.mobile.service.MobileDeviceGroupService; import net.shapelight.modules.mobile.service.MobileDeviceGroupService;
import net.shapelight.modules.mobile.mapper.MobileDeviceGroupMapper; 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 org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/** /**
* @author zhangbo * @author zhangbo
* @description 针对表mobile_device_group的数据库操作Service实现 * @description 针对表mobile_device_group的数据库操作Service实现
* @createDate 2024-11-13 11:50:36 * @createDate 2024-11-13 11:50:36
*/ */
@Service @Service
@RequiredArgsConstructor
public class MobileDeviceGroupServiceImpl extends ServiceImpl<MobileDeviceGroupMapper, MobileDeviceGroup> public class MobileDeviceGroupServiceImpl extends ServiceImpl<MobileDeviceGroupMapper, MobileDeviceGroup>
implements MobileDeviceGroupService{ 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;
}
} }

View File

@ -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;
}