You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
3.1 KiB
Java
111 lines
3.1 KiB
Java
6 years ago
|
package com.kiisoo.ic.department.controller;
|
||
|
|
||
|
import com.kiisoo.ic.common.BaseController;
|
||
|
import com.kiisoo.ic.department.entity.DepartmentDO;
|
||
|
import com.kiisoo.ic.department.service.DepartmentService;
|
||
|
import lombok.extern.slf4j.Slf4j;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.stereotype.Controller;
|
||
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
||
|
import java.util.Map;
|
||
|
|
||
|
/**
|
||
|
* @Description: 部门管理controller
|
||
|
* @Auther: yechenhao
|
||
|
* @Date: 2020/4/7 0002 10:06
|
||
|
* @Version: v1
|
||
|
*/
|
||
|
@Controller
|
||
|
@RequestMapping("/department")
|
||
|
@Slf4j
|
||
|
public class DepartmentController extends BaseController {
|
||
|
|
||
|
@Autowired
|
||
|
private DepartmentService departmentService;
|
||
|
|
||
|
/**
|
||
|
* 查询部门
|
||
|
* @param
|
||
|
* @return
|
||
|
* @throws Exception
|
||
|
*/
|
||
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
||
|
@ResponseBody
|
||
|
public Map<String,Object> listDepartment(){
|
||
|
try {
|
||
|
Boolean hasAdd = departmentService.listDepartment();
|
||
|
return data(hasAdd);
|
||
|
}catch (Exception e){
|
||
|
log.error("添加部门失败",e);
|
||
|
return fail();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 增加部门
|
||
|
* @param departmentDO 部门实体类
|
||
|
* @return
|
||
|
* @throws Exception
|
||
|
*/
|
||
|
@RequestMapping(value = "add",method = RequestMethod.POST)
|
||
|
@ResponseBody
|
||
|
public Map<String,Object> addDepartment(@RequestBody DepartmentDO departmentDO){
|
||
|
try {
|
||
|
Boolean hasAdd = departmentService.addDepartment(departmentDO);
|
||
|
return data(hasAdd);
|
||
|
}catch (Exception e){
|
||
|
log.error("添加部门失败",e);
|
||
|
return fail();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 修改部门
|
||
|
* @param departmentDO 部门实体类
|
||
|
* @return
|
||
|
* @throws Exception
|
||
|
*/
|
||
|
@RequestMapping(value = "update",method = RequestMethod.POST)
|
||
|
@ResponseBody
|
||
|
public Map<String,Object> updateDepartment(@RequestBody DepartmentDO departmentDO){
|
||
|
try {
|
||
|
Boolean hasUpdate = departmentService.updateDepartment(departmentDO);
|
||
|
return data(hasUpdate);
|
||
|
}catch (Exception e){
|
||
|
log.error("修改部门失败",e);
|
||
|
return fail();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 删除部门
|
||
|
* @param departmentId 部门实体id
|
||
|
* @return
|
||
|
* @throws Exception
|
||
|
*/
|
||
|
@RequestMapping(value = "delete",method = RequestMethod.POST)
|
||
|
@ResponseBody
|
||
|
public Map<String,Object> deleteDepartment(@RequestParam("departmentId") Long departmentId){
|
||
|
try {
|
||
|
Boolean hasDel = departmentService.deleteDepartment(departmentId);
|
||
|
return data(hasDel);
|
||
|
}catch (Exception e){
|
||
|
log.error("删除部门失败",e);
|
||
|
return fail();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@RequestMapping(value = "sync",method = RequestMethod.GET)
|
||
|
@ResponseBody
|
||
|
public Map<String,Object> syncDepartment(){
|
||
|
try {
|
||
|
Boolean hasSync = departmentService.syncDepartment();
|
||
|
return data(hasSync);
|
||
|
}catch (Exception e){
|
||
|
log.error("添加部门失败",e);
|
||
|
return fail();
|
||
|
}
|
||
|
}
|
||
|
}
|