package com.ltkj.web.controller.system; import com.ltkj.common.annotation.Log; import com.ltkj.common.core.controller.BaseController; import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.common.core.page.TableDataInfo; import com.ltkj.common.enums.BusinessType; import com.ltkj.common.utils.poi.ExcelUtil; import com.ltkj.hosp.domain.TjContract; import com.ltkj.hosp.service.ITjContractService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 合同Controller * * @author ltkj_赵佳豪&李格 * @date 2023-02-17 */ @RestController @RequestMapping("/hosp/contract") @Api(tags = "合同管理") public class TjContractController extends BaseController { @Autowired private ITjContractService tjContractService; /** * 查询合同列表 */ @GetMapping("/list") @ApiOperation("查询合同列表") public TableDataInfo list(TjContract tjContract) { startPage(); List list = tjContractService.selectTjContractList(tjContract); return getDataTable(list); } /** * 导出合同列表 */ @Log(title = "合同", businessType = BusinessType.EXPORT) @PostMapping("/export") @ApiOperation("导出合同列表") public void export(HttpServletResponse response, TjContract tjContract) { List list = tjContractService.selectTjContractList(tjContract); ExcelUtil util = new ExcelUtil(TjContract.class); util.exportExcel(response, list, "合同数据"); } /** * 获取合同详细信息 */ @GetMapping(value = "/{id}") @ApiOperation("获取合同详细信息") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(tjContractService.selectTjContractById(id)); } /** * 新增合同 */ @Log(title = "合同", businessType = BusinessType.INSERT) @PostMapping @ApiOperation("新增合同") public AjaxResult add(@RequestBody TjContract tjContract) { return toAjax(tjContractService.save(tjContract)); } /** * 修改合同 */ @Log(title = "合同", businessType = BusinessType.UPDATE) @PutMapping @ApiOperation("修改合同") public AjaxResult edit(@RequestBody TjContract tjContract) { return toAjax(tjContractService.updateById(tjContract)); } /** * 删除合同 */ @Log(title = "合同", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") @ApiOperation("删除合同") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(tjContractService.deleteTjContractByIds(ids)); } }