123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- package com.fs.company.controller;
- import java.util.List;
- import com.fs.common.utils.ServletUtils;
- import com.fs.core.security.LoginUser;
- 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.fs.common.annotation.Log;
- import com.fs.common.core.controller.BaseController;
- import com.fs.common.core.domain.AjaxResult;
- import com.fs.common.enums.BusinessType;
- import com.fs.company.domain.CompanyDept;
- import com.fs.company.service.ICompanyDeptService;
- import com.fs.common.utils.poi.ExcelUtil;
- import com.fs.common.core.page.TableDataInfo;
- @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));
- }
- }
|