11 changed files with 230 additions and 19 deletions
			
			
		- 
					20APIService/pom.xml
- 
					1pom.xml
- 
					5storeroom/pom.xml
- 
					40storeroom/src/main/java/com/storeroom/modules/device/controller/DeviceController.java
- 
					53storeroom/src/main/java/com/storeroom/modules/device/repository/DeviceInfoRepository.java
- 
					9storeroom/src/main/java/com/storeroom/modules/device/repository/DeviceTypeReposityory.java
- 
					30storeroom/src/main/java/com/storeroom/modules/device/service/DeviceService.java
- 
					16storeroom/src/main/java/com/storeroom/modules/device/service/dto/DeviceQueryCriteria.java
- 
					23storeroom/src/main/java/com/storeroom/modules/device/service/dto/DeviceQueryDto.java
- 
					47storeroom/src/main/java/com/storeroom/modules/device/service/impl/DeviceImpl.java
- 
					5system/pom.xml
| @ -0,0 +1,20 @@ | |||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||
|  | <project xmlns="http://maven.apache.org/POM/4.0.0" | ||||
|  |          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|  |          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||
|  |     <parent> | ||||
|  |         <artifactId>yxk_StoreroomSystem</artifactId> | ||||
|  |         <groupId>com.storeroom</groupId> | ||||
|  |         <version>1.0</version> | ||||
|  |     </parent> | ||||
|  |     <modelVersion>4.0.0</modelVersion> | ||||
|  | 
 | ||||
|  |     <artifactId>APIService</artifactId> | ||||
|  |     <name>第三方接口服务</name> | ||||
|  | 
 | ||||
|  |     <properties> | ||||
|  |         <maven.compiler.source>17</maven.compiler.source> | ||||
|  |         <maven.compiler.target>17</maven.compiler.target> | ||||
|  |     </properties> | ||||
|  | 
 | ||||
|  | </project> | ||||
| @ -0,0 +1,40 @@ | |||||
|  | package com.storeroom.modules.device.controller; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | import com.storeroom.annotaion.rest.AnonymousGetMapping; | ||||
|  | import com.storeroom.exception.BaseException; | ||||
|  | import com.storeroom.modules.device.service.DeviceService; | ||||
|  | import com.storeroom.modules.device.service.dto.DeviceQueryCriteria; | ||||
|  | import com.storeroom.utils.ApiResponse; | ||||
|  | import com.storeroom.utils.StringUtils; | ||||
|  | import io.swagger.annotations.Api; | ||||
|  | import io.swagger.annotations.ApiOperation; | ||||
|  | import lombok.RequiredArgsConstructor; | ||||
|  | import org.springframework.data.domain.Pageable; | ||||
|  | import org.springframework.web.bind.annotation.RequestMapping; | ||||
|  | import org.springframework.web.bind.annotation.RestController; | ||||
|  | 
 | ||||
|  | @RestController | ||||
|  | @RequiredArgsConstructor | ||||
|  | @Api(tags = "设备管理") | ||||
|  | @RequestMapping("/api/device/") | ||||
|  | public class DeviceController { | ||||
|  | 
 | ||||
|  |     private final DeviceService deviceService; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  |     @ApiOperation("通过id获取设备列表") | ||||
|  |     @AnonymousGetMapping("list") | ||||
|  |     public ApiResponse<Object> list(String storeroomId, String deviceTypeId, Pageable pageable) { | ||||
|  |         if (!StringUtils.isEmpty(storeroomId) && !StringUtils.isEmpty(deviceTypeId)) { | ||||
|  |             return ApiResponse.success(deviceService.queryAll(pageable)); | ||||
|  |         } | ||||
|  |         if (StringUtils.isEmpty(storeroomId) && !StringUtils.isEmpty(deviceTypeId)) { | ||||
|  |             return ApiResponse.success(deviceService.queryDeviceType(deviceTypeId, pageable)); | ||||
|  |         } | ||||
|  |         if (StringUtils.isEmpty(deviceTypeId) && !StringUtils.isEmpty(storeroomId)) { | ||||
|  |             return ApiResponse.success(deviceService.queryStoreroomDevice(storeroomId, pageable)); | ||||
|  |         } | ||||
|  |         return ApiResponse.success(deviceService.queryAll(pageable)); | ||||
|  |     } | ||||
|  | } | ||||
| @ -0,0 +1,9 @@ | |||||
|  | package com.storeroom.modules.device.repository; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | import com.storeroom.modules.device.domain.DeviceType; | ||||
|  | import org.springframework.data.jpa.repository.JpaRepository; | ||||
|  | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||||
|  | 
 | ||||
|  | public interface DeviceTypeReposityory extends JpaRepository<DeviceType,String>, JpaSpecificationExecutor<DeviceType> { | ||||
|  | } | ||||
| @ -0,0 +1,16 @@ | |||||
|  | package com.storeroom.modules.device.service.dto; | ||||
|  | 
 | ||||
|  | import com.storeroom.annotaion.Query; | ||||
|  | import lombok.Data; | ||||
|  | 
 | ||||
|  | import java.io.Serializable; | ||||
|  | 
 | ||||
|  | @Data | ||||
|  | public class DeviceQueryCriteria implements Serializable { | ||||
|  | 
 | ||||
|  |     @Query | ||||
|  |     private String storeroomId; | ||||
|  | 
 | ||||
|  |     @Query | ||||
|  |     private String deviceTypeId; | ||||
|  | } | ||||
| @ -0,0 +1,23 @@ | |||||
|  | package com.storeroom.modules.device.service.dto; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | import com.storeroom.annotaion.Query; | ||||
|  | import com.storeroom.modules.device.domain.DeviceType; | ||||
|  | import com.storeroom.modules.device.domain.Storeroom; | ||||
|  | import lombok.Data; | ||||
|  | import lombok.Getter; | ||||
|  | import lombok.Setter; | ||||
|  | 
 | ||||
|  | import java.io.Serializable; | ||||
|  | 
 | ||||
|  | @Data | ||||
|  | @Getter | ||||
|  | @Setter | ||||
|  | public class DeviceQueryDto implements Serializable { | ||||
|  | 
 | ||||
|  |     @Query | ||||
|  |     private Storeroom storeroomDto; | ||||
|  | 
 | ||||
|  |     @Query | ||||
|  |     private DeviceType deviceType; | ||||
|  | } | ||||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue