| | |
| | | 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.constant.MaxSizeContant; |
| | | import com.by4cloud.platformx.device.entity.Contract; |
| | | import com.by4cloud.platformx.device.service.ContractService; |
| | | import com.by4cloud.platformx.device.service.JcMaxSizeService; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import com.by4cloud.platformx.common.excel.annotation.ResponseExcel; |
| | | import io.swagger.v3.oas.annotations.security.SecurityRequirement; |
| | |
| | | public class ContractController { |
| | | |
| | | private final ContractService contractService; |
| | | private final JcMaxSizeService maxSizeService; |
| | | |
| | | /** |
| | | * 分页查询 |
| | |
| | | @GetMapping("/{id}" ) |
| | | @PreAuthorize("@pms.hasPermission('platformx_contract_view')" ) |
| | | public R getById(@PathVariable("id" ) Long id) { |
| | | return R.ok(contractService.getById(id)); |
| | | return R.ok(contractService.getDetailById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping |
| | | @PreAuthorize("@pms.hasPermission('platformx_contract_add')" ) |
| | | public R save(@RequestBody Contract contract) { |
| | | return R.ok(contractService.save(contract)); |
| | | contract.setNumber(maxSizeService.nextNo(MaxSizeContant.CONTRACT_NUM)); |
| | | return R.ok(contractService.saveDeep(contract)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PutMapping |
| | | @PreAuthorize("@pms.hasPermission('platformx_contract_edit')" ) |
| | | public R updateById(@RequestBody Contract contract) { |
| | | return R.ok(contractService.updateById(contract)); |
| | | return R.ok(contractService.updateDeep(contract)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @DeleteMapping |
| | | @PreAuthorize("@pms.hasPermission('platformx_contract_del')" ) |
| | | public R removeById(@RequestBody Long[] ids) { |
| | | return R.ok(contractService.removeBatchByIds(CollUtil.toList(ids))); |
| | | return R.ok(contractService.removeDeep(ids)); |
| | | } |
| | | |
| | | |