| | |
| | | package com.ycl.platform.controller; |
| | | |
| | | import annotation.Log; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ycl.platform.domain.entity.CalculateMoneyRule; |
| | | import com.ycl.platform.domain.entity.TContract; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.query.ContractQuery; |
| | | import com.ycl.platform.domain.query.YwUnitQuery; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.service.ITContractService; |
| | | import com.ycl.system.AjaxResult; |
| | | import com.ycl.system.Result; |
| | | import com.ycl.system.controller.BaseController; |
| | | import com.ycl.system.page.TableDataInfo; |
| | | import com.ycl.utils.poi.ExcelUtil; |
| | | import enumeration.BusinessType; |
| | | import io.swagger.annotations.ApiOperation; |
| | | 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 org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @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); |
| | | public Result page(ContractQuery query) { |
| | | return tContractService.selectAll(query); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:contract:query')") |
| | | @GetMapping("/selectMoneyRules") |
| | | public AjaxResult selectMoneyRules(Integer contractId) { |
| | | return success(tContractService.selectMoneyRules(contractId)); |
| | | } |
| | | |
| | | /** |
| | | * 导出【请填写功能名称】列表 |
| | | * 合同导入模板 |
| | | */ |
| | | @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, "【请填写功能名称】数据"); |
| | | @PreAuthorize("@ss.hasPermi('system:contract:importTemplate')") |
| | | @Log(title = "导入模板", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importTemplate") |
| | | public void importTemplate(HttpServletResponse response) { |
| | | tContractService.importTemplate(response); |
| | | } |
| | | |
| | | /** |
| | | * 合同导入 |
| | | * |
| | | * @return 导入结果 |
| | | */ |
| | | @Log(title = "合同导入", businessType = BusinessType.IMPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user:import')") |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(TContract tContract) { |
| | | return tContractService.importData(tContract.getFile(), tContract); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @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')") |
| | | @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')") |
| | | @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')") |
| | | @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)); |
| | | } |
| | | } |