package com.ycl.platform.controller;
|
|
import annotation.Log;
|
import com.ycl.platform.domain.entity.TContract;
|
import com.ycl.platform.service.ITContractService;
|
import com.ycl.system.AjaxResult;
|
import com.ycl.system.controller.BaseController;
|
import com.ycl.utils.poi.ExcelUtil;
|
import enumeration.BusinessType;
|
import jakarta.servlet.http.HttpServletResponse;
|
import lombok.AllArgsConstructor;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
|
/**
|
* 【请填写功能名称】Controller
|
*
|
* @author ruoyi
|
* @date 2024-03-12
|
*/
|
@RestController
|
@RequestMapping("/system/contract")
|
@AllArgsConstructor
|
public class TContractController extends BaseController {
|
|
private final ITContractService tContractService;
|
|
|
/**
|
* 合同导入模板
|
*/
|
@PreAuthorize("@ss.hasPermi('system:contract:importTemplate')")
|
@Log(title = "导入模板", businessType = BusinessType.IMPORT)
|
@PostMapping("/importTemplate")
|
public void importTemplate(HttpServletResponse response) {
|
tContractService.importTemplate(response);
|
}
|
|
/**
|
* 合同导入
|
*
|
* @param file 导入文件
|
* @param unitId 运维单位
|
* @param startTime 开始时间
|
* @param endTime 结束时间
|
* @return 导入结果
|
*/
|
@Log(title = "合同导入", businessType = BusinessType.IMPORT)
|
@PreAuthorize("@ss.hasPermi('system:user:import')")
|
@PostMapping("/importData")
|
public AjaxResult importData(MultipartFile file, String unitId, String startTime, String endTime) {
|
ExcelUtil<TContract> util = new ExcelUtil<>(TContract.class);
|
return success();
|
}
|
|
/**
|
* 获取【请填写功能名称】详细信息
|
*/
|
@PreAuthorize("@ss.hasPermi('system:contract:query')")
|
@GetMapping(value = "/{id}")
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
return success(tContractService.getById(id));
|
}
|
|
/**
|
* 新增【请填写功能名称】
|
*/
|
@PreAuthorize("@ss.hasPermi('system:contract:add')")
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
@PostMapping
|
public AjaxResult add(@RequestBody TContract tContract) {
|
return toAjax(tContractService.save(tContract));
|
}
|
|
/**
|
* 修改【请填写功能名称】
|
*/
|
@PreAuthorize("@ss.hasPermi('system:contract:edit')")
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
@PutMapping
|
public AjaxResult edit(@RequestBody TContract tContract) {
|
return toAjax(tContractService.updateById(tContract));
|
}
|
|
/**
|
* 删除【请填写功能名称】
|
*/
|
@PreAuthorize("@ss.hasPermi('system:contract:remove')")
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
@DeleteMapping("/{ids}")
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
return toAjax(tContractService.removeById(ids));
|
}
|
}
|