feat:修改mybits-plus
parent
1a4acff816
commit
0e4ec8665d
|
@ -0,0 +1,38 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -5,9 +5,8 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-server</artifactId>
|
||||
<artifactId>cloud-modules-enterprise</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>enterpise-client</artifactId>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu;
|
||||
|
||||
/**
|
||||
* @Author:yan
|
||||
* @Package:com.muyu
|
||||
* @Project:Default (Template) Project
|
||||
* @name:${NAME}
|
||||
* @Date:2024/9/29 09:56
|
||||
*/
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -5,9 +5,9 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-server</artifactId>
|
||||
<artifactId>cloud-modules-enterprise</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
|
||||
</parent>
|
||||
|
||||
<artifactId>enterpise-common</artifactId>
|
||||
|
|
|
@ -22,17 +22,17 @@ import lombok.NoArgsConstructor;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Tag(name = "车辆电子围栏中间表")
|
||||
@TableName(value = "car_middle",autoResultMap = true)
|
||||
public class FenceAndGroupMiddle {
|
||||
@Tag(name = "车辆和电子围栏组中间表")
|
||||
@TableName(value = "car_group_middle",autoResultMap = true)
|
||||
public class CarAndGroupMiddle {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@Schema(name = "id")
|
||||
private Integer id;
|
||||
private Long id;
|
||||
/**
|
||||
* 围栏id
|
||||
* 车id
|
||||
*/
|
||||
@Schema(name = "围栏id")
|
||||
private Integer carId;
|
||||
|
@ -40,6 +40,6 @@ public class FenceAndGroupMiddle {
|
|||
* 围栏组id
|
||||
*/
|
||||
@Schema(name = "围栏组id")
|
||||
private Integer groupId;
|
||||
private Long groupId;
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.muyu.domain;
|
|||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.domain.req.FenceGroupUpdateReq;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -30,7 +31,7 @@ public class FenceGroup {
|
|||
*/
|
||||
@TableId(value = "group_id",type = IdType.AUTO)
|
||||
@Schema(name = "围栏组id")
|
||||
private Integer groupId;
|
||||
private Long groupId;
|
||||
/**
|
||||
* 围栏组名称
|
||||
*/
|
||||
|
@ -42,5 +43,18 @@ public class FenceGroup {
|
|||
@Schema(name = "围栏组状态")
|
||||
private Integer groupStates;
|
||||
|
||||
public static FenceGroup carFenceUpdateById(Integer states, FenceGroupUpdateReq fenceGroupBuilder ){
|
||||
return FenceGroup.builder()
|
||||
.groupId(fenceGroupBuilder.getGroupId())
|
||||
.groupStates(states)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static FenceGroup closeCarFenceUpdateById(Integer states, Long groupId ){
|
||||
return FenceGroup.builder()
|
||||
.groupId(groupId)
|
||||
.groupStates(states)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.domain.req
|
||||
* @Project:plues
|
||||
* @name:CarFenceUpdateReq
|
||||
* @Date:2024/9/29 20:22
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "修改围栏的状态", description = "修改围栏的状态")
|
||||
public class FenceGroupUpdateReq {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "group_id", type = IdType.AUTO)
|
||||
@Schema(title = "围栏组Id")
|
||||
private Long groupId;
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -5,9 +5,8 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-server</artifactId>
|
||||
<artifactId>cloud-modules-enterprise</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>enterpise-remote</artifactId>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu;
|
||||
|
||||
/**
|
||||
* @Author:yan
|
||||
* @Package:com.muyu
|
||||
* @Project:Default (Template) Project
|
||||
* @name:${NAME}
|
||||
* @Date:2024/9/29 09:55
|
||||
*/
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -5,12 +5,12 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-server</artifactId>
|
||||
<artifactId>cloud-modules-enterprise</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
|
||||
</parent>
|
||||
|
||||
<artifactId>enterpise-service</artifactId>
|
||||
<artifactId>enterpise-server</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
|
@ -0,0 +1,42 @@
|
|||
package com.muyu.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.service.CarAndFenceGroupMiddleService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆和围栏组中间表
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.controller
|
||||
* @Project:plues
|
||||
* @name:CarAndFenceGroupMiddleController
|
||||
* @Date:2024/9/29 20:09
|
||||
*/
|
||||
@RequestMapping("/carandfencemiddle")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@Log4j2
|
||||
@Tag(name = "车辆和围栏组中间表")
|
||||
public class CarAndFenceGroupMiddleController {
|
||||
@Autowired
|
||||
private CarAndFenceGroupMiddleService carAndFenceGroupMiddleService;
|
||||
|
||||
/**
|
||||
* 根据围栏组和车辆的id添加中间表
|
||||
*/
|
||||
@PostMapping("/addFenceGroupAddCarMiddle")
|
||||
@Operation(summary = "根据围栏组和车辆的id添加中间表",description = "根据围栏组和车辆的id添加中间表")
|
||||
public Result addFenceGroupAddCarMiddle(@RequestParam("carId") Integer carId , @RequestBody List<FenceGroup> fenceGroups ){
|
||||
boolean b = carAndFenceGroupMiddleService.saveBatch(fenceGroups,carId);
|
||||
return Result.success("成功");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.muyu.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.domain.req.FenceGroupUpdateReq;
|
||||
import com.muyu.service.CarFenceUpdateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 围栏组的修改状态
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.controller
|
||||
* @Project:plues
|
||||
* @name:CarFenceUpdateController
|
||||
* @Date:2024/9/30 09:10
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/fenceUpdate")
|
||||
@AllArgsConstructor
|
||||
@Log4j2
|
||||
@Tag(name = "修改围栏组的状态")
|
||||
public class CarFenceUpdateController {
|
||||
@Autowired
|
||||
private CarFenceUpdateService carFenceUpdateService;
|
||||
|
||||
/**
|
||||
* 启动围栏组
|
||||
*/
|
||||
@PutMapping("/activate")
|
||||
@Operation(summary = "启动围栏状态",description = "启动围栏状态")
|
||||
public Result activate(@RequestBody FenceGroupUpdateReq fenceGroupUpdateReq){
|
||||
Integer states = 0;
|
||||
boolean b = carFenceUpdateService.updateById(FenceGroup.carFenceUpdateById(states, fenceGroupUpdateReq));
|
||||
return Result.success("成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改围栏状态为关闭
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/updateFenceGroupById")
|
||||
@Operation(summary = "修改围栏状态为关闭",description = "修改围栏状态为关闭")
|
||||
public Result updateFenceGroupById(@RequestParam("groupId") Long groupId){
|
||||
Integer states = 1;
|
||||
carFenceUpdateService.updateById(FenceGroup.closeCarFenceUpdateById(states,groupId));
|
||||
|
||||
return Result.success("成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.muyu.controller;
|
|||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.domain.req.CarFenceAdd;
|
||||
import com.muyu.domain.req.FenceGroupUpdateReq;
|
||||
import com.muyu.service.CarFenceServiceMybaits;
|
||||
import com.muyu.service.MiddleService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -28,8 +29,6 @@ import java.util.List;
|
|||
@Tag(name = "中间表添加",description = "添加")
|
||||
@Log4j2
|
||||
public class MiddleController {
|
||||
@Autowired
|
||||
private MiddleService middleService;
|
||||
@Autowired
|
||||
private CarFenceServiceMybaits carFenceServiceMybaits;
|
||||
|
||||
|
@ -39,12 +38,10 @@ public class MiddleController {
|
|||
* 添加围栏组 多对多
|
||||
*/
|
||||
@PostMapping("/addCarFence")
|
||||
@Operation(summary = "添加中间",description = "添加中间")
|
||||
@Operation(summary = "添加中间围栏和围栏组",description = "添加中间")
|
||||
public Result addCarFence(@RequestParam("fenceGroupId") Integer fenceGroupId, @RequestBody List<CarFenceAdd> carFences){
|
||||
carFenceServiceMybaits.addFenceGroup(fenceGroupId,carFences);
|
||||
System.out.println("围栏组Id"+fenceGroupId);
|
||||
System.out.println("围栏Id"+carFences);
|
||||
return Result.success("成功");
|
||||
boolean i = carFenceServiceMybaits.saveBatch(carFences,fenceGroupId);
|
||||
return i?Result.success("添加成功"):Result.error("失败");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,17 +52,22 @@ public class MiddleController {
|
|||
@GetMapping("/updateFenceGroupById")
|
||||
@Operation(summary = "修改围栏状态",description = "修改围栏状态")
|
||||
public Result updateFenceGroupById(@RequestParam("groupId") Integer groupId){
|
||||
carFenceServiceMybaits.updateFenceGroupById(groupId);
|
||||
|
||||
return Result.success(carFenceServiceMybaits.updateFenceGroupById(groupId));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动围栏
|
||||
*/
|
||||
@GetMapping("/activate")
|
||||
@PutMapping("/activate")
|
||||
@Operation(summary = "启动围栏状态",description = "启动围栏状态")
|
||||
public Result activate(@RequestParam("groupId") Integer groupId){
|
||||
return Result.success(carFenceServiceMybaits.activate(groupId));
|
||||
public Result activate(@RequestBody FenceGroupUpdateReq fenceGroupUpdateReq){
|
||||
Integer states = 0;
|
||||
FenceGroup fenceGroup = FenceGroup.carFenceUpdateById(states, fenceGroupUpdateReq);
|
||||
boolean b = carFenceServiceMybaits.updateById(fenceGroup);
|
||||
|
||||
return Result.success("成功");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,20 +76,21 @@ public class MiddleController {
|
|||
@GetMapping("/BoundFenceGroup")
|
||||
@Operation(summary = "根据围栏组的id查询绑定的围栏的中间表",description = "根据围栏组的id查询绑定的围栏的中间表")
|
||||
public Result BoundFenceGroup(@RequestParam("groupId") Integer groupId){
|
||||
|
||||
return Result.success(carFenceServiceMybaits.BoundFenceGroup(groupId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据围栏组和车辆的id添加中间表
|
||||
*/
|
||||
@PostMapping("/addFenceGroupAddCarMiddle")
|
||||
@Operation(summary = "根据围栏组和车辆的id添加中间表",description = "根据围栏组和车辆的id添加中间表")
|
||||
public Result addFenceGroupAddCarMiddle(@RequestParam("carId") Integer carId , @RequestBody List<FenceGroup> fenceGroups ){
|
||||
carFenceServiceMybaits.addFenceGroupAddCarMiddle(carId,fenceGroups);
|
||||
carFenceServiceMybaits.BoundFenceGroup(groupId);
|
||||
carFenceServiceMybaits.list(groupId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 根据围栏组和车辆的id添加中间表
|
||||
// */
|
||||
// @PostMapping("/addFenceGroupAddCarMiddle")
|
||||
// @Operation(summary = "根据围栏组和车辆的id添加中间表",description = "根据围栏组和车辆的id添加中间表")
|
||||
// public Result addFenceGroupAddCarMiddle(@RequestParam("carId") Integer carId , @RequestBody List<FenceGroup> fenceGroups ){
|
||||
// boolean b = carFenceServiceMybaits.addFenceGroupAddCarMiddle(carId,fenceGroups);
|
||||
// return Result.success();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取绑定的围栏组
|
||||
*/
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.domain.CarAndGroupMiddle;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 车辆和围栏组中间表
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.mapper
|
||||
* @Project:plues
|
||||
* @name:CarAndFenceGroupMiddleMapper
|
||||
* @Date:2024/9/29 20:12
|
||||
*/
|
||||
@Mapper
|
||||
public interface CarAndFenceGroupMiddleMapper extends BaseMapper<CarAndGroupMiddle> {
|
||||
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
package com.muyu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.CarMiddle;
|
||||
import com.muyu.domain.FenceAndGroupMiddle;
|
||||
import com.muyu.domain.CarAndGroupMiddle;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.domain.req.CarFenceGroup;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
@ -19,7 +20,7 @@ import java.util.List;
|
|||
* * @Date:2024/9/22 19:25
|
||||
*/
|
||||
@Mapper
|
||||
public interface CarFenceServiceMybaitsMapper {
|
||||
public interface CarFenceServiceMybaitsMapper extends BaseMapper<CarMiddle> {
|
||||
|
||||
void fenceAdd(CarFenceGroup carFence);
|
||||
|
||||
|
@ -71,12 +72,12 @@ public interface CarFenceServiceMybaitsMapper {
|
|||
* @param carId
|
||||
* @return
|
||||
*/
|
||||
List<FenceAndGroupMiddle> selectBoundGFenceGroup(@Param("carId") Integer carId);
|
||||
List<CarAndGroupMiddle> selectBoundGFenceGroup(@Param("carId") Integer carId);
|
||||
|
||||
/**
|
||||
* 获取围栏组的数据
|
||||
* @param carGroupId 参数
|
||||
* @return
|
||||
*/
|
||||
FenceGroup selectGroup(@Param("carGroupId") Integer carGroupId);
|
||||
FenceGroup selectGroup(@Param("carGroupId") Long carGroupId);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 围栏组的修改状态
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.mapper
|
||||
* @Project:plues
|
||||
* @name:CarFenceUpdateMapper
|
||||
* @Date:2024/9/30 09:13
|
||||
*/
|
||||
@Mapper
|
||||
public interface CarFenceUpdateMapper extends BaseMapper<FenceGroup> {
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.CarAndGroupMiddle;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆和围栏组中间表
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.service
|
||||
* @Project:plues
|
||||
* @name:CarAndFenceGroupMiddleService
|
||||
* @Date:2024/9/29 20:10
|
||||
*/
|
||||
public interface CarAndFenceGroupMiddleService extends IService<CarAndGroupMiddle> {
|
||||
/**
|
||||
* 根据围栏组和车辆的id添加中间表
|
||||
*/
|
||||
boolean saveBatch(List<FenceGroup> fenceGroups, Integer carId);
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package com.muyu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.CarMiddle;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.domain.req.CarFenceAdd;
|
||||
|
||||
|
@ -14,15 +16,18 @@ import java.util.List;
|
|||
* * @name:CarFenceServiceMybaits
|
||||
* * @Date:2024/9/22 19:24
|
||||
*/
|
||||
public interface CarFenceServiceMybaits {
|
||||
void add(Integer fenceGroupId, List<Integer> carFenceId);
|
||||
public interface CarFenceServiceMybaits extends IService<CarMiddle> {
|
||||
|
||||
|
||||
/**
|
||||
* 添加多对多围栏组
|
||||
*
|
||||
* @param fenceGroupId
|
||||
* @param carFences
|
||||
* @return
|
||||
*/
|
||||
void addFenceGroup(Integer fenceGroupId, List<CarFenceAdd> carFences);
|
||||
boolean saveBatch(List<CarFenceAdd> carFences, Integer fenceGroupId);
|
||||
|
||||
|
||||
/**
|
||||
* 修改围栏状态
|
||||
|
@ -31,19 +36,22 @@ public interface CarFenceServiceMybaits {
|
|||
*/
|
||||
Object updateFenceGroupById(Integer groupId);
|
||||
|
||||
|
||||
/**
|
||||
* 启动围栏
|
||||
*/
|
||||
Object activate(Integer groupId);
|
||||
boolean updateById(FenceGroup FenceGroup);
|
||||
/**
|
||||
* 根据围栏组的id查询绑定的围栏的中间表
|
||||
*/
|
||||
List<CarFence> BoundFenceGroup(Integer groupId);
|
||||
void list(Integer groupId);
|
||||
|
||||
/**
|
||||
* 根据围栏组和车辆的id添加中间表
|
||||
*/
|
||||
void addFenceGroupAddCarMiddle(Integer id, List<FenceGroup> fenceGroups);
|
||||
// /**
|
||||
// * 根据围栏组和车辆的id添加中间表
|
||||
// */
|
||||
// boolean addFenceGroupAddCarMiddle(Integer id, List<FenceGroup> fenceGroups);
|
||||
|
||||
/**
|
||||
* 获取绑定的围栏组
|
||||
|
@ -51,4 +59,6 @@ public interface CarFenceServiceMybaits {
|
|||
*/
|
||||
List<FenceGroup> selectBoundGFenceGroup(Integer carId);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
|
||||
/**
|
||||
* 围栏组的修改状态
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.service
|
||||
* @Project:plues
|
||||
* @name:CarFenceUpdateService
|
||||
* @Date:2024/9/30 09:12
|
||||
*/
|
||||
public interface CarFenceUpdateService extends IService<FenceGroup> {
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.muyu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.CarAndGroupMiddle;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.mapper.CarAndFenceGroupMiddleMapper;
|
||||
import com.muyu.service.CarAndFenceGroupMiddleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆和围栏组中间表
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.service.impl
|
||||
* @Project:plues
|
||||
* @name:CarAndFenceGroupMiddleServiceImpl
|
||||
* @Date:2024/9/29 20:11
|
||||
*/
|
||||
@Service
|
||||
public class CarAndFenceGroupMiddleServiceImpl extends ServiceImpl<CarAndFenceGroupMiddleMapper, CarAndGroupMiddle> implements CarAndFenceGroupMiddleService {
|
||||
@Autowired
|
||||
private CarAndFenceGroupMiddleMapper carAndFenceGroupMiddleMapper;
|
||||
|
||||
/**
|
||||
* 根据围栏组和车辆的id添加中间表
|
||||
*/
|
||||
@Override
|
||||
public boolean saveBatch(List<FenceGroup> fenceGroups, Integer carId) {
|
||||
List<CarAndGroupMiddle> list = fenceGroups.stream().map(fenceGroup -> {
|
||||
CarAndGroupMiddle carAndGroupMiddle = new CarAndGroupMiddle();
|
||||
//获取围栏组的id
|
||||
carAndGroupMiddle.setGroupId(fenceGroup.getGroupId());
|
||||
carAndGroupMiddle.setCarId(carId);
|
||||
return carAndGroupMiddle;
|
||||
}).toList();
|
||||
boolean b = this.saveBatch(list);
|
||||
return b;
|
||||
}
|
||||
}
|
|
@ -1,12 +1,16 @@
|
|||
package com.muyu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.CarMiddle;
|
||||
import com.muyu.domain.FenceAndGroupMiddle;
|
||||
import com.muyu.domain.CarAndGroupMiddle;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.domain.req.CarFenceAdd;
|
||||
import com.muyu.mapper.CarFenceServiceMybaitsMapper;
|
||||
import com.muyu.service.CarFenceServiceMybaits;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -22,40 +26,34 @@ import java.util.List;
|
|||
* * @Date:2024/9/22 19:24
|
||||
*/
|
||||
@Service
|
||||
public class CarFenceServiceMybaitsImpl implements CarFenceServiceMybaits {
|
||||
@Log4j2
|
||||
public class CarFenceServiceMybaitsImpl extends ServiceImpl<CarFenceServiceMybaitsMapper,CarMiddle> implements CarFenceServiceMybaits {
|
||||
@Autowired
|
||||
private CarFenceServiceMybaitsMapper carFenceServiceMybaitsMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 添加多对多围栏组
|
||||
* @param fenceGroupId
|
||||
* @param carFenceId
|
||||
*/
|
||||
@Override
|
||||
public void add(Integer fenceGroupId, List<Integer> carFenceId) {
|
||||
|
||||
for (Integer integer : carFenceId) {
|
||||
Integer addMiddle = carFenceServiceMybaitsMapper.addGroup(fenceGroupId,integer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加多对多围栏组
|
||||
*
|
||||
* @param fenceGroupId
|
||||
* @param carFences
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void addFenceGroup(Integer fenceGroupId, List<CarFenceAdd> carFences) {
|
||||
for (CarFenceAdd carFence : carFences) {
|
||||
Integer id = carFence.getId();
|
||||
Integer addMiddle = carFenceServiceMybaitsMapper.addFenceGroup(fenceGroupId,id);
|
||||
}
|
||||
public boolean saveBatch(List<CarFenceAdd> carFences, Integer fenceGroupId) {
|
||||
List<CarMiddle> list = carFences.stream().map(carFenceAdd -> {
|
||||
CarMiddle carMiddle = new CarMiddle();
|
||||
carMiddle.setCarFenceId(carFenceAdd.getId());
|
||||
carMiddle.setCarGroupId(fenceGroupId);
|
||||
return carMiddle;
|
||||
}).toList();
|
||||
boolean b = this.saveBatch(list);
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改围栏组状态
|
||||
* @param groupId
|
||||
|
@ -75,6 +73,11 @@ public class CarFenceServiceMybaitsImpl implements CarFenceServiceMybaits {
|
|||
carFenceServiceMybaitsMapper.activate(groupId);
|
||||
return null;
|
||||
}
|
||||
// @Override
|
||||
// public void updateById(FenceGroup groupId) {
|
||||
//
|
||||
// this.updateById(groupId);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 根据围栏组的id查询绑定的围栏的中间表
|
||||
|
@ -93,21 +96,35 @@ public class CarFenceServiceMybaitsImpl implements CarFenceServiceMybaits {
|
|||
return carFences;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据围栏组和车辆的id添加中间表
|
||||
*/
|
||||
@Override
|
||||
public void addFenceGroupAddCarMiddle(Integer id, List<FenceGroup> fenceGroups) {
|
||||
public void list(Integer groupId) {
|
||||
|
||||
//遍历集合
|
||||
for (FenceGroup fenceGroup : fenceGroups) {
|
||||
//获取围栏组的id
|
||||
Integer groupId = fenceGroup.getGroupId();
|
||||
carFenceServiceMybaitsMapper.addFenceGroupAddCarMiddle(id,groupId);
|
||||
}
|
||||
CarMiddle carMiddle = carFenceServiceMybaitsMapper.selectById(groupId);
|
||||
|
||||
Integer carFenceId = carMiddle.getCarFenceId();
|
||||
|
||||
System.out.println(carFenceId);
|
||||
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 根据围栏组和车辆的id添加中间表
|
||||
// */
|
||||
// @Override
|
||||
// public boolean addFenceGroupAddCarMiddle(Integer id, List<FenceGroup> fenceGroups) {
|
||||
// //遍历集合
|
||||
// List<CarAndGroupMiddle> list = fenceGroups.stream().map(fenceGroup -> {
|
||||
// CarAndGroupMiddle carAndGroupMiddle = new CarAndGroupMiddle();
|
||||
// //获取围栏组的id
|
||||
// carAndGroupMiddle.setGroupId(fenceGroup.getGroupId());
|
||||
// carAndGroupMiddle.setCarId(id);
|
||||
// return carAndGroupMiddle;
|
||||
// }).toList();
|
||||
//
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取绑定的围栏组
|
||||
* @param carId
|
||||
|
@ -115,18 +132,28 @@ public class CarFenceServiceMybaitsImpl implements CarFenceServiceMybaits {
|
|||
@Override
|
||||
public List<FenceGroup> selectBoundGFenceGroup(Integer carId) {
|
||||
/*根据id查询围栏组的id*/
|
||||
List<FenceAndGroupMiddle> list = carFenceServiceMybaitsMapper.selectBoundGFenceGroup(carId);
|
||||
List<CarAndGroupMiddle> list = carFenceServiceMybaitsMapper.selectBoundGFenceGroup(carId);
|
||||
ArrayList<FenceGroup> fenceGroups = new ArrayList<>();
|
||||
|
||||
/*循环*/
|
||||
for (FenceAndGroupMiddle fenceAndGroupMiddle : list) {
|
||||
for (CarAndGroupMiddle fenceAndGroupMiddle : list) {
|
||||
/**
|
||||
* 获取围栏组的id
|
||||
*/
|
||||
Integer carGroupId = fenceAndGroupMiddle.getGroupId();
|
||||
Long carGroupId = fenceAndGroupMiddle.getGroupId();
|
||||
//获取围栏组的数据 并 存入list
|
||||
fenceGroups.add(carFenceServiceMybaitsMapper.selectGroup(carGroupId));
|
||||
}
|
||||
return fenceGroups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateById(FenceGroup fenceGroup) {
|
||||
Long groupId = fenceGroup.getGroupId();
|
||||
boolean b = this.updateById(fenceGroup);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.CarFence;
|
||||
import com.muyu.domain.FenceGroup;
|
||||
import com.muyu.mapper.CarFenceUpdateMapper;
|
||||
import com.muyu.service.CarFenceUpdateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 围栏组的修改状态
|
||||
* @Author:yan
|
||||
* @Package:com.muyu.service.impl
|
||||
* @Project:plues
|
||||
* @name:CarFenceUpdateServiceImpl
|
||||
* @Date:2024/9/30 09:12
|
||||
* 围栏组的修改状态
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class CarFenceUpdateServiceImpl extends ServiceImpl<CarFenceUpdateMapper, FenceGroup> implements CarFenceUpdateService {
|
||||
@Autowired
|
||||
private CarFenceUpdateMapper carFenceUpdateMapper;
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue