lige
2023-12-22 602bb92d63137912a7c90c4ed1ca81aba988c7b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package com.ltkj.web.controller.system;
 
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ltkj.hosp.domain.TjDwGrouping;
import com.ltkj.hosp.service.ITjDwGroupingService;
import com.ltkj.hosp.service.ITjGroupingProService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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.TjDwDept;
import com.ltkj.hosp.service.ITjDwDeptService;
import com.ltkj.common.utils.poi.ExcelUtil;
import com.ltkj.common.core.page.TableDataInfo;
 
/**
 * 体检单位部门Controller
 *
 * @author ltkj_赵佳豪&李格
 * @date 2023-08-07
 */
@RestController
@RequestMapping("/hosp/dwdept")
@Api(tags = "PC端--团体--体检单位部门接口集")
public class TjDwDeptController extends BaseController {
    @Autowired
    private ITjDwDeptService dwDeptService;
    @Autowired
    private ITjDwGroupingService dwGroupingService;
    @Autowired
    private ITjGroupingProService groupingProService;
 
    /**
     * 查询体检单位部门列表
     */
//    @PreAuthorize("@ss.hasPermi('hosp:dept:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询单位部门列表")
    public TableDataInfo list(TjDwDept tjDwDept) {
        startPage();
        List<TjDwDept> list = dwDeptService.selectTjDwDeptList(tjDwDept);
        return getDataTable(list);
    }
 
    /**
     * 导出体检单位部门列表
     */
//    @PreAuthorize("@ss.hasPermi('hosp:dept:export')")
    @Log(title = "体检单位部门", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TjDwDept tjDwDept) {
        List<TjDwDept> list = dwDeptService.selectTjDwDeptList(tjDwDept);
        ExcelUtil<TjDwDept> util = new ExcelUtil<TjDwDept>(TjDwDept.class);
        util.exportExcel(response, list, "体检单位部门数据");
    }
 
    /**
     * 获取体检单位部门详细信息
     */
//    @PreAuthorize("@ss.hasPermi('hosp:dept:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "查询单位部门详情信息")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(dwDeptService.selectTjDwDeptById(id));
    }
 
 
    @GetMapping(value = "/getDwDeptList")
    @ApiOperation(value = "查询单位下所有的部门列表信息")
    public AjaxResult getDwDeptList(@RequestParam String dwId) {
            return success(dwDeptService.list(new LambdaQueryWrapper<TjDwDept>().eq(TjDwDept::getDwId,dwId)));
    }
 
    /**
     * 新增体检单位部门
     */
//    @PreAuthorize("@ss.hasPermi('hosp:dept:add')")
    @Log(title = "体检单位部门", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation(value = "新增单位部门信息")
    public AjaxResult add(@RequestBody TjDwDept tjDwDept) {
        return toAjax(dwDeptService.save(tjDwDept));
    }
 
    /**
     * 修改体检单位部门
     */
//    @PreAuthorize("@ss.hasPermi('hosp:dept:edit')")
//    @Log(title = "体检单位部门", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation(value = "修改单位部门信息")
    public AjaxResult edit(@RequestBody TjDwDept tjDwDept) {
        return toAjax(dwDeptService.updateById(tjDwDept));
    }
 
    /**
     * 删除体检单位部门
     */
//    @PreAuthorize("@ss.hasPermi('hosp:dept:remove')")
//    @Log(title = "体检单位部门", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation(value = "删除单位部门信息")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(dwDeptService.removeByIds(Arrays.asList(ids)));
    }
 
 
    @GetMapping(value = "/getTjDwGroupingsByDwAndDwDept")
    @ApiOperation(value = "根据单位id和部门ID查询单位分组信息")
    public AjaxResult getTjDwGroupingsByDwAndDwDept(@RequestParam @ApiParam(value = "单位id") String dwId, @RequestParam @ApiParam(value = "部门id") String deptId) {
        return success(dwGroupingService.list(new LambdaQueryWrapper<TjDwGrouping>().eq(TjDwGrouping::getDwId,dwId).eq(TjDwGrouping::getDwDeptId,deptId)));
    }
 
}