package com.ltkj.web.controller.system; import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ltkj.common.annotation.Log; import com.ltkj.common.core.controller.BaseController; import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.common.enums.BusinessType; import com.ltkj.hosp.domain.TjHarmTypeLog; import com.ltkj.hosp.service.ITjHarmTypeLogService; import com.ltkj.common.utils.poi.ExcelUtil; import com.ltkj.common.core.page.TableDataInfo; /** * 问诊危害因素关联Controller * * @author ltkj_赵佳豪&李格 * @date 2023-12-06 */ @RestController @RequestMapping("/hosp/harmTypeLog") public class TjHarmTypeLogController extends BaseController { @Autowired private ITjHarmTypeLogService tjHarmTypeLogService; /** * 查询问诊危害因素关联列表 */ @GetMapping("/list") public TableDataInfo list(TjHarmTypeLog tjHarmTypeLog) { startPage(); List list = tjHarmTypeLogService.list(); return getDataTable(list); } /** * 导出问诊危害因素关联列表 */ @Log(title = "问诊危害因素关联", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, TjHarmTypeLog tjHarmTypeLog) { List list = tjHarmTypeLogService.selectTjHarmTypeLogList(tjHarmTypeLog); ExcelUtil util = new ExcelUtil(TjHarmTypeLog.class); util.exportExcel(response, list, "问诊危害因素关联数据"); } /** * 获取问诊危害因素关联详细信息 */ @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(tjHarmTypeLogService.getById(id)); } /** * 新增问诊危害因素关联 */ @Log(title = "问诊危害因素关联", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TjHarmTypeLog tjHarmTypeLog) { return toAjax(tjHarmTypeLogService.save(tjHarmTypeLog)); } /** * 修改问诊危害因素关联 */ @Log(title = "问诊危害因素关联", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TjHarmTypeLog tjHarmTypeLog) { return toAjax(tjHarmTypeLogService.updateById(tjHarmTypeLog)); } /** * 删除问诊危害因素关联 */ @Log(title = "问诊危害因素关联", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(tjHarmTypeLogService.removeByIds(Arrays.asList(ids))); } }