diff --git a/pom.xml b/pom.xml
index 8d6a3fe..e02e5ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -280,6 +280,12 @@
1.45
+
+ com.github.yulichang
+ mybatis-plus-join-boot-starter
+ 1.5.0
+
+
diff --git a/shapelight-admin/src/main/java/net/shapelight/common/base/BasePageDTO.java b/shapelight-admin/src/main/java/net/shapelight/common/base/BasePageDTO.java
new file mode 100644
index 0000000..c787340
--- /dev/null
+++ b/shapelight-admin/src/main/java/net/shapelight/common/base/BasePageDTO.java
@@ -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;
+}
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/controler/DeviceGroupController.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/controler/DeviceGroupController.java
index 5fe448e..2a3db2f 100644
--- a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/controler/DeviceGroupController.java
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/controler/DeviceGroupController.java
@@ -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 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 groupId) {
return R.ok();
}
- @PostMapping("update")
+ @PutMapping("update")
@ApiOperation("设备组更新")
public R update(@RequestBody MobileDeviceGroup mobileDeviceGroup) {
return R.ok();
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/dto/DeviceGruopQueryDto.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/dto/DeviceGruopQueryDto.java
new file mode 100644
index 0000000..d85ab12
--- /dev/null
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/dto/DeviceGruopQueryDto.java
@@ -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;
+
+}
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/dto/MobileDeviceGroupAddDto.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/dto/MobileDeviceGroupAddDto.java
new file mode 100644
index 0000000..bb42e8e
--- /dev/null
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/dto/MobileDeviceGroupAddDto.java
@@ -0,0 +1,11 @@
+package net.shapelight.modules.mobile.dto;
+
+public class MobileDeviceGroupAddDto {
+ /**
+ * 设备组名称
+ */
+ private String name;
+ /**
+ *
+ */
+}
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/entity/MobileDeviceGroup.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/entity/MobileDeviceGroup.java
index 7f47ae9..347d188 100644
--- a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/entity/MobileDeviceGroup.java
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/entity/MobileDeviceGroup.java
@@ -57,7 +57,7 @@ public class MobileDeviceGroup implements Serializable {
* 描述
*/
@ApiModelProperty(name = "描述",required = true)
- private String describe;
+ private String description;
/**
* 学校名称
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/entity/MobilePackageOrder.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/entity/MobilePackageOrder.java
index 6336635..0ea7a50 100644
--- a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/entity/MobilePackageOrder.java
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/entity/MobilePackageOrder.java
@@ -30,9 +30,9 @@ public class MobilePackageOrder implements Serializable {
@ApiModelProperty("订单ID")
private Long orderId;
/**
- * 学生ID
+ * 家长ID
*/
- @ApiModelProperty("学生ID")
+ @ApiModelProperty("家长ID")
private Long personId;
/**
* 套餐ID
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobileCallLogsMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobileCallLogsMapper.java
index 86cb6a0..8948217 100644
--- a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobileCallLogsMapper.java
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobileCallLogsMapper.java
@@ -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 {
+@Mapper
+public interface MobileCallLogsMapper extends MPJBaseMapper {
}
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobileDeviceGroupMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobileDeviceGroupMapper.java
index 2837d7b..2429202 100644
--- a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobileDeviceGroupMapper.java
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobileDeviceGroupMapper.java
@@ -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 {
+@Mapper
+public interface MobileDeviceGroupMapper extends MPJBaseMapper {
}
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobileDeviceMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobileDeviceMapper.java
index 6f307ce..3e74a80 100644
--- a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobileDeviceMapper.java
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobileDeviceMapper.java
@@ -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 {
+@Mapper
+public interface MobileDeviceMapper extends MPJBaseMapper {
}
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobilePackageMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobilePackageMapper.java
index 6e60a93..6dce84f 100644
--- a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobilePackageMapper.java
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobilePackageMapper.java
@@ -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 {
+@Mapper
+public interface MobilePackageMapper extends MPJBaseMapper {
}
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobilePackageOrderMapper.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobilePackageOrderMapper.java
index b2a0669..f4e439f 100644
--- a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobilePackageOrderMapper.java
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/mapper/MobilePackageOrderMapper.java
@@ -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 {
+@Mapper
+public interface MobilePackageOrderMapper extends MPJBaseMapper {
}
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/service/MobileDeviceGroupService.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/service/MobileDeviceGroupService.java
index 56c67a8..6f2220b 100644
--- a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/service/MobileDeviceGroupService.java
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/service/MobileDeviceGroupService.java
@@ -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 {
-
+ List list(DeviceGruopQueryDto deviceGruopQueryDto);
}
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/service/impl/MobileDeviceGroupServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/service/impl/MobileDeviceGroupServiceImpl.java
index 6d0d293..e35bc29 100644
--- a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/service/impl/MobileDeviceGroupServiceImpl.java
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/service/impl/MobileDeviceGroupServiceImpl.java
@@ -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
implements MobileDeviceGroupService{
+ private final MobileDeviceGroupMapper mobileDeviceGroupMapper;
+
+ private final MobileDeviceMapper mobileDeviceMapper;
+
+
+ @Override
+ public List list(DeviceGruopQueryDto deviceGruopQueryDto) {
+ List mobileDeviceGroupVos = mobileDeviceGroupMapper.selectJoinPage(
+ new Page<>(deviceGruopQueryDto.getCurrent(), deviceGruopQueryDto.getSize()),
+ MobileDeviceGroupVo.class,
+ new MPJLambdaWrapper()
+ .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().eq(MobileDevice::getGroupId, mobileDeviceGroupVo.getGroupId())).stream().count();
+ mobileDeviceGroupVo.setNowDeviceCount(count);
+ }
+ return mobileDeviceGroupVos;
+
+ }
}
diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/mobile/vo/MobileDeviceGroupVo.java b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/vo/MobileDeviceGroupVo.java
new file mode 100644
index 0000000..e53d9fa
--- /dev/null
+++ b/shapelight-admin/src/main/java/net/shapelight/modules/mobile/vo/MobileDeviceGroupVo.java
@@ -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;
+
+
+}