|
|
@@ -1,116 +0,0 @@
|
|
|
-package com.fs.company;
|
|
|
-
|
|
|
-import com.fs.common.annotation.Log;
|
|
|
-import com.fs.common.core.controller.BaseController;
|
|
|
-import com.fs.common.core.domain.AjaxResult;
|
|
|
-import com.fs.common.core.page.TableDataInfo;
|
|
|
-import com.fs.common.enums.BusinessType;
|
|
|
-import com.fs.common.utils.poi.ExcelUtil;
|
|
|
-import com.fs.company.domain.CompanyDept;
|
|
|
-import com.fs.company.service.ICompanyDeptService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-
|
|
|
-@RestController
|
|
|
-@RequestMapping("/company/companyDept")
|
|
|
-public class CompanyDeptController extends BaseController
|
|
|
-{
|
|
|
- @Autowired
|
|
|
- private ICompanyDeptService companyDeptService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询部门列表
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('company:companyDept:list')")
|
|
|
- @GetMapping("/list")
|
|
|
- public TableDataInfo list(CompanyDept companyDept)
|
|
|
- {
|
|
|
- startPage();
|
|
|
- List<CompanyDept> list = companyDeptService.selectCompanyDeptList(companyDept);
|
|
|
- return getDataTable(list);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 导出部门列表
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('company:companyDept:export')")
|
|
|
- @Log(title = "部门", businessType = BusinessType.EXPORT)
|
|
|
- @GetMapping("/export")
|
|
|
- public AjaxResult export(CompanyDept companyDept)
|
|
|
- {
|
|
|
- List<CompanyDept> list = companyDeptService.selectCompanyDeptList(companyDept);
|
|
|
- ExcelUtil<CompanyDept> util = new ExcelUtil<CompanyDept>(CompanyDept.class);
|
|
|
- return util.exportExcel(list, "companyDept");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取部门详细信息
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('company:companyDept:query')")
|
|
|
- @GetMapping(value = "/{deptId}")
|
|
|
- public AjaxResult getInfo(@PathVariable("deptId") Long deptId)
|
|
|
- {
|
|
|
- return AjaxResult.success(companyDeptService.selectCompanyDeptById(deptId));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增部门
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('company:companyDept:add')")
|
|
|
- @Log(title = "部门", businessType = BusinessType.INSERT)
|
|
|
- @PostMapping
|
|
|
- public AjaxResult add(@RequestBody CompanyDept companyDept)
|
|
|
- {
|
|
|
- return toAjax(companyDeptService.insertCompanyDept(companyDept));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 修改部门
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('company:companyDept:edit')")
|
|
|
- @Log(title = "部门", businessType = BusinessType.UPDATE)
|
|
|
- @PutMapping
|
|
|
- public AjaxResult edit(@RequestBody CompanyDept companyDept)
|
|
|
- {
|
|
|
- return toAjax(companyDeptService.updateCompanyDept(companyDept));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除部门
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('company:companyDept:remove')")
|
|
|
- @Log(title = "部门", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{deptIds}")
|
|
|
- public AjaxResult remove(@PathVariable Long[] deptIds)
|
|
|
- {
|
|
|
- return toAjax(companyDeptService.deleteCompanyDeptByIds(deptIds));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取部门下拉树列表
|
|
|
- */
|
|
|
- @GetMapping("/treeselect")
|
|
|
- public AjaxResult treeselect(CompanyDept dept)
|
|
|
- {
|
|
|
- dept.setStatus("0");
|
|
|
- List<CompanyDept> depts = companyDeptService.selectCompanyDeptList(dept);
|
|
|
- return AjaxResult.success(companyDeptService.buildDeptTreeSelect(depts));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取部门下拉树列表
|
|
|
- */
|
|
|
- @GetMapping("/treeselectByCompanyId/{companyId}")
|
|
|
- public AjaxResult treeselectByCompanyId(@PathVariable("companyId") Long companyId)
|
|
|
- {
|
|
|
- CompanyDept dept = new CompanyDept();
|
|
|
- dept.setStatus("0");
|
|
|
- dept.setCompanyId(companyId);
|
|
|
- List<CompanyDept> depts = companyDeptService.selectCompanyDeptList(dept);
|
|
|
- return AjaxResult.success(companyDeptService.buildDeptTreeSelect(depts));
|
|
|
- }
|
|
|
-}
|