package com.ruoyi.web.controller.smartor; 
 | 
  
 | 
import com.ruoyi.common.annotation.Log; 
 | 
import com.ruoyi.common.core.controller.BaseController; 
 | 
import com.ruoyi.common.core.domain.AjaxResult; 
 | 
import com.ruoyi.common.core.domain.entity.SysUser; 
 | 
import com.ruoyi.common.core.page.TableDataInfo; 
 | 
import com.ruoyi.common.enums.BusinessType; 
 | 
import com.ruoyi.common.utils.poi.ExcelUtil; 
 | 
import com.smartor.domain.TemplateDept; 
 | 
import com.smartor.service.ITemplateDeptService; 
 | 
import io.swagger.annotations.Api; 
 | 
import io.swagger.annotations.ApiOperation; 
 | 
import lombok.extern.slf4j.Slf4j; 
 | 
import org.springframework.beans.factory.annotation.Autowired; 
 | 
import org.springframework.web.bind.annotation.*; 
 | 
  
 | 
import javax.servlet.http.HttpServletResponse; 
 | 
import java.util.List; 
 | 
  
 | 
/** 
 | 
 * 模板科室关联Controller 
 | 
 * 
 | 
 * @author lihu 
 | 
 * @date 2024-09-18 
 | 
 */ 
 | 
@Slf4j 
 | 
@Api("模板科室关联") 
 | 
@RestController 
 | 
@RequestMapping("/smartor/td") 
 | 
public class TemplateDeptController extends BaseController { 
 | 
    @Autowired 
 | 
    private ITemplateDeptService templateDeptService; 
 | 
  
 | 
    /** 
 | 
     * 查询模板科室关联列表 
 | 
     */ 
 | 
    @ApiOperation("查询模板科室关联列表") 
 | 
    //@PreAuthorize("@ss.hasPermi('smartor:dept:list')") 
 | 
    @GetMapping("/list") 
 | 
    public TableDataInfo list(TemplateDept templateDept) { 
 | 
        startPage(); 
 | 
        List<TemplateDept> list = templateDeptService.selectTemplateDeptList(templateDept); 
 | 
        return getDataTable(list); 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 导出模板科室关联列表 
 | 
     */ 
 | 
    @ApiOperation("导出模板科室关联列表") 
 | 
    //@PreAuthorize("@ss.hasPermi('smartor:dept:export')") 
 | 
    @Log(title = "模板科室关联", businessType = BusinessType.EXPORT) 
 | 
    @PostMapping("/export") 
 | 
    public void export(HttpServletResponse response, TemplateDept templateDept) { 
 | 
        List<TemplateDept> list = templateDeptService.selectTemplateDeptList(templateDept); 
 | 
        ExcelUtil<TemplateDept> util = new ExcelUtil<TemplateDept>(TemplateDept.class); 
 | 
        util.exportExcel(response, list, "模板科室关联数据"); 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 获取模板科室关联详细信息 
 | 
     */ 
 | 
    @ApiOperation("获取模板科室关联详细信息") 
 | 
    //@PreAuthorize("@ss.hasPermi('smartor:dept:query')") 
 | 
    @GetMapping(value = "/getInfo/{id}") 
 | 
    public AjaxResult getInfo(@PathVariable("id") Long id) { 
 | 
        return success(templateDeptService.selectTemplateDeptById(id)); 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 新增模板科室关联 
 | 
     */ 
 | 
    //@PreAuthorize("@ss.hasPermi('smartor:dept:add')") 
 | 
    @ApiOperation("新增模板科室关联") 
 | 
    @Log(title = "模板科室关联", businessType = BusinessType.INSERT) 
 | 
    @PostMapping("/add") 
 | 
    public AjaxResult add(@RequestBody List<TemplateDept> templateDepts) { 
 | 
        SysUser user = getLoginUser().getUser(); 
 | 
        return toAjax(templateDeptService.insertTemplateDept(templateDepts,user.getGuid())); 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 修改模板科室关联 
 | 
     */ 
 | 
    @ApiOperation("修改模板科室关联") 
 | 
    //@PreAuthorize("@ss.hasPermi('smartor:dept:edit')") 
 | 
    @Log(title = "模板科室关联", businessType = BusinessType.UPDATE) 
 | 
    @PostMapping("/edit") 
 | 
    public AjaxResult edit(@RequestBody TemplateDept templateDept) { 
 | 
        return toAjax(templateDeptService.updateTemplateDept(templateDept)); 
 | 
    } 
 | 
  
 | 
    /** 
 | 
     * 删除模板科室关联 
 | 
     */ 
 | 
    @ApiOperation("删除模板科室关联") 
 | 
    //@PreAuthorize("@ss.hasPermi('smartor:dept:remove')") 
 | 
    @Log(title = "模板科室关联", businessType = BusinessType.DELETE) 
 | 
    @GetMapping("/remove/{id}") 
 | 
    public AjaxResult remove(@PathVariable("id") Long id) { 
 | 
        log.info("删除的ID为:{}",id); 
 | 
        return toAjax(templateDeptService.deleteTemplateDeptById(id)); 
 | 
    } 
 | 
} 
 |