| | |
| | | import com.ycl.platform.service.ITContractService; |
| | | import com.ycl.system.AjaxResult; |
| | | import com.ycl.system.controller.BaseController; |
| | | import com.ycl.system.page.TableDataInfo; |
| | | import com.ycl.utils.poi.ExcelUtil; |
| | | import enumeration.BusinessType; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | |
| | | import java.util.List; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * 【请填写功能名称】Controller |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/contract") |
| | | public class TContractController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ITContractService tContractService; |
| | | @AllArgsConstructor |
| | | public class TContractController extends BaseController { |
| | | |
| | | private final ITContractService tContractService; |
| | | |
| | | |
| | | /** |
| | | * 查询【请填写功能名称】列表 |
| | | * 合同导入模板 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:contract:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(TContract tContract) |
| | | { |
| | | startPage(); |
| | | List<TContract> list = tContractService.selectTContractList(tContract); |
| | | return getDataTable(list); |
| | | @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 导入结果 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:contract:export')") |
| | | @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, TContract tContract) |
| | | { |
| | | List<TContract> list = tContractService.selectTContractList(tContract); |
| | | ExcelUtil<TContract> util = new ExcelUtil<TContract>(TContract.class); |
| | | util.exportExcel(response, list, "【请填写功能名称】数据"); |
| | | @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')") |
| | | @PreAuthorize("@ss.hasPermi('system:contract:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | | return success(tContractService.selectTContractById(id)); |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return success(tContractService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 新增【请填写功能名称】 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:contract:add')") |
| | | @PreAuthorize("@ss.hasPermi('system:contract:add')") |
| | | @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody TContract tContract) |
| | | { |
| | | return toAjax(tContractService.insertTContract(tContract)); |
| | | public AjaxResult add(@RequestBody TContract tContract) { |
| | | return toAjax(tContractService.save(tContract)); |
| | | } |
| | | |
| | | /** |
| | | * 修改【请填写功能名称】 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:contract:edit')") |
| | | @PreAuthorize("@ss.hasPermi('system:contract:edit')") |
| | | @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody TContract tContract) |
| | | { |
| | | return toAjax(tContractService.updateTContract(tContract)); |
| | | public AjaxResult edit(@RequestBody TContract tContract) { |
| | | return toAjax(tContractService.updateById(tContract)); |
| | | } |
| | | |
| | | /** |
| | | * 删除【请填写功能名称】 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:contract:remove')") |
| | | @PreAuthorize("@ss.hasPermi('system:contract:remove')") |
| | | @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | return toAjax(tContractService.deleteTContractByIds(ids)); |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | | return toAjax(tContractService.removeById(ids)); |
| | | } |
| | | } |