package com.by4cloud.platformx.device.controller;
|
|
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.collection.CollUtil;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.by4cloud.platformx.common.core.util.R;
|
import com.by4cloud.platformx.common.log.annotation.SysLog;
|
import com.by4cloud.platformx.device.dto.DeviceTechnicalAgreemntQueryDTO;
|
import com.by4cloud.platformx.device.entity.DeviceTechnicalAgreemnt;
|
import com.by4cloud.platformx.device.entity.PurchaseWinningLetterEntity;
|
import com.by4cloud.platformx.device.service.DeviceTechnicalAgreementService;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import com.by4cloud.platformx.common.excel.annotation.ResponseExcel;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import org.springdoc.api.annotations.ParameterObject;
|
import org.springframework.http.HttpHeaders;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.Operation;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.List;
|
import java.util.Objects;
|
|
/**
|
* 设备技术协议
|
*
|
* @author syt
|
* @date 2025-03-25 15:48:53
|
*/
|
@RestController
|
@RequiredArgsConstructor
|
@RequestMapping("/deviceTechnicalAgreement" )
|
@Tag(description = "deviceTechnicalAgreement" , name = "设备技术协议管理" )
|
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
public class DeviceTechnicalAgreementController {
|
|
private final DeviceTechnicalAgreementService deviceTechnicalAgreementService;
|
|
/**
|
* 分页查询
|
* @param page 分页对象
|
* @param queryDTO 设备技术协议
|
* @return
|
*/
|
@Operation(summary = "分页查询" , description = "分页查询" )
|
@GetMapping("/page" )
|
@PreAuthorize("@pms.hasPermission('device_deviceTechnicalAgreement_view')" )
|
public R getDeviceTechnicalAgreementPage(@ParameterObject Page page, @ParameterObject DeviceTechnicalAgreemntQueryDTO queryDTO) {
|
return R.ok(deviceTechnicalAgreementService.pageNew(page, queryDTO));
|
}
|
|
|
/**
|
* 通过id查询设备技术协议
|
* @param id id
|
* @return R
|
*/
|
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
@GetMapping("/{id}" )
|
@PreAuthorize("@pms.hasPermission('device_deviceTechnicalAgreement_view')" )
|
public R getById(@PathVariable("id" ) Long id) {
|
return R.ok(deviceTechnicalAgreementService.getById(id));
|
}
|
|
/**
|
* 新增设备技术协议
|
* @param deviceTechnicalAgreement 设备技术协议
|
* @return R
|
*/
|
@Operation(summary = "新增设备技术协议" , description = "新增设备技术协议" )
|
@SysLog("新增设备技术协议" )
|
@PostMapping
|
@PreAuthorize("@pms.hasPermission('device_deviceTechnicalAgreement_add')" )
|
public R save(@RequestBody DeviceTechnicalAgreemnt deviceTechnicalAgreement) {
|
return R.ok(deviceTechnicalAgreementService.save(deviceTechnicalAgreement));
|
}
|
|
/**
|
* 修改设备技术协议
|
* @param deviceTechnicalAgreement 设备技术协议
|
* @return R
|
*/
|
@Operation(summary = "修改设备技术协议" , description = "修改设备技术协议" )
|
@SysLog("修改设备技术协议" )
|
@PutMapping
|
@PreAuthorize("@pms.hasPermission('device_deviceTechnicalAgreement_edit')" )
|
public R updateById(@RequestBody DeviceTechnicalAgreemnt deviceTechnicalAgreement) {
|
return R.ok(deviceTechnicalAgreementService.updateById(deviceTechnicalAgreement));
|
}
|
|
/**
|
* 通过id删除设备技术协议
|
* @param ids id列表
|
* @return R
|
*/
|
@Operation(summary = "通过id删除设备技术协议" , description = "通过id删除设备技术协议" )
|
@SysLog("通过id删除设备技术协议" )
|
@DeleteMapping
|
@PreAuthorize("@pms.hasPermission('device_deviceTechnicalAgreement_del')" )
|
public R removeById(@RequestBody Long[] ids) {
|
return R.ok(deviceTechnicalAgreementService.removeBatchByIds(CollUtil.toList(ids)));
|
}
|
|
|
/**
|
* 导出excel 表格
|
* @param deviceTechnicalAgreement 查询条件
|
* @param ids 导出指定ID
|
* @return excel 文件流
|
*/
|
@ResponseExcel
|
@GetMapping("/export")
|
@PreAuthorize("@pms.hasPermission('device_deviceTechnicalAgreement_export')" )
|
public List<DeviceTechnicalAgreemnt> export(DeviceTechnicalAgreemnt deviceTechnicalAgreement,Long[] ids) {
|
return deviceTechnicalAgreementService.list(Wrappers.lambdaQuery(deviceTechnicalAgreement).in(ArrayUtil.isNotEmpty(ids), DeviceTechnicalAgreemnt::getId, ids));
|
}
|
|
/**
|
* 获取下拉列表
|
* @return
|
*/
|
@GetMapping("/getDropdownnList")
|
public R<List<DeviceTechnicalAgreemnt>> getDropdownnList() {
|
return R.ok(deviceTechnicalAgreementService.list());
|
}
|
}
|