7 changed files with 258 additions and 43 deletions
@ -0,0 +1,102 @@ |
|||
package org.dromara.sample.manage.controller; |
|||
|
|||
import cn.hutool.core.lang.Dict; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.satoken.utils.LoginHelper; |
|||
import org.dromara.common.sdk.common.HttpResultResponse; |
|||
import org.dromara.common.sdk.common.PaginationData; |
|||
import org.dromara.sample.manage.model.dto.DeviceProDTO; |
|||
import org.dromara.sample.manage.model.entity.DeviceProEntity; |
|||
import org.dromara.sample.manage.model.entity.DeviceProUserEntity; |
|||
import org.dromara.sample.manage.service.IDeviceProService; |
|||
import org.dromara.system.api.model.LoginUser; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
@RestController |
|||
@Slf4j |
|||
@RequestMapping("${url.manage.prefix}${url.manage.version}/device/group") |
|||
@Tag(name = "无人机设备项目模块") |
|||
public class DeviceProController { |
|||
|
|||
|
|||
@Autowired |
|||
private IDeviceProService deviceProService; |
|||
|
|||
//1、查询项目组
|
|||
|
|||
/** |
|||
* 查询项目组 |
|||
* @param page |
|||
* @param pageSize |
|||
* @return |
|||
*/ |
|||
@Operation(summary = "查询项目组", description = "查询项目组") |
|||
@GetMapping("/page") |
|||
public HttpResultResponse<PaginationData<DeviceProEntity>> pageDevicePro( |
|||
@RequestParam(name = "pageNum", defaultValue = "1") Long page, |
|||
@RequestParam(name = "pageSize", defaultValue = "10") Long pageSize, |
|||
DeviceProDTO deviceProDTO) { |
|||
Page<DeviceProEntity> pageQuery = new Page<>(page, pageSize); |
|||
PaginationData<DeviceProEntity> devices = deviceProService.listDeviceProEntityMap(pageQuery,deviceProDTO); |
|||
|
|||
return HttpResultResponse.success(devices); |
|||
} |
|||
|
|||
//2、添加项目组
|
|||
/** |
|||
* 新增/更新项目 |
|||
* @param deviceProEntity |
|||
* @return |
|||
*/ |
|||
@Operation(summary = "新增/更新项目。", description = "新增/更新项目。") |
|||
@PostMapping("/update") |
|||
public HttpResultResponse<Boolean> updateDevicePro(@RequestBody DeviceProEntity deviceProEntity) { |
|||
return HttpResultResponse.success(deviceProService.updateDevicePro(deviceProEntity)); |
|||
} |
|||
|
|||
|
|||
//3、删除项目组
|
|||
@Operation(summary = "删除项目组。", description = "删除项目组。") |
|||
@DeleteMapping("/delete") |
|||
public HttpResultResponse<Boolean> deleteDevicePro(@RequestBody List<Long> ids) { |
|||
return HttpResultResponse.success(deviceProService.deleteIds(ids)); |
|||
} |
|||
|
|||
/** |
|||
* 新增/更新项目人员。 |
|||
* @param userEntity |
|||
* @return |
|||
*/ |
|||
@Operation(summary = "新增/更新项目人员。", description = "新增/更新项目人员。") |
|||
@PostMapping("/{proId}/update") |
|||
public HttpResultResponse<Boolean> updateDeviceProUser(@RequestBody List<DeviceProUserEntity> userEntity,@PathVariable Long proId) { |
|||
return HttpResultResponse.success(deviceProService.updateDeviceProUser(userEntity,proId)); |
|||
} |
|||
|
|||
/** |
|||
* 设备绑定项目组 |
|||
*/ |
|||
@Operation(summary = "设备绑定项目组", description = "设备绑定项目组") |
|||
@PostMapping("/bind") |
|||
public HttpResultResponse<Boolean> updateDevice(Dict dict) { |
|||
return HttpResultResponse.success(deviceProService.updateDevice(dict)); |
|||
} |
|||
|
|||
/** |
|||
* 根据人员获取项目组(feign调用接口) |
|||
*/ |
|||
@GetMapping("/user") |
|||
public List<Integer> listDeviceGroup(@RequestParam("userId") Long userId) { |
|||
log.info("----------------------------开始调用feign接口查询项目组----------------------------"); |
|||
List<Integer> result = deviceProService.listDeviceGroup(userId); |
|||
log.info("----------------------------调用feign接口查询项目组结束----------------------------"); |
|||
return result; |
|||
} |
|||
} |
Loading…
Reference in new issue