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.
102 lines
2.8 KiB
Java
102 lines
2.8 KiB
Java
6 years ago
|
package com.kiisoo.ic.employee.controller;
|
||
|
|
||
|
import com.kiisoo.ic.common.BaseController;
|
||
|
import com.kiisoo.ic.employee.entity.EmployeeDO;
|
||
|
import com.kiisoo.ic.employee.entity.PrivilageCpUserDO;
|
||
|
import com.kiisoo.ic.employee.service.EmployeeService;
|
||
|
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.List;
|
||
|
import java.util.Map;
|
||
|
|
||
|
/**
|
||
|
* @Description: 用户管理controller
|
||
|
* @Auther: yechenhao
|
||
|
* @Date: 2020/4/7 0002 10:06
|
||
|
* @Version: v1
|
||
|
*/
|
||
|
@Controller
|
||
|
@RequestMapping("/user")
|
||
|
@Slf4j
|
||
|
public class EmployeeController extends BaseController {
|
||
|
|
||
|
@Autowired
|
||
|
private EmployeeService employeeService;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 新增成员
|
||
|
* @param employee 成员实体
|
||
|
* @return
|
||
|
* @throws WxErrorException
|
||
|
*/
|
||
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
||
|
@ResponseBody
|
||
|
public Map<String,Object> listUser(){
|
||
|
try {
|
||
|
List<PrivilageCpUserDO> privilageCpUserDOS = employeeService.listUser();
|
||
|
return data(privilageCpUserDOS);
|
||
|
}catch (Exception e){
|
||
|
log.error("添加用户失败",e);
|
||
|
return fail();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 新增成员
|
||
|
* @param employee 成员实体
|
||
|
* @return
|
||
|
* @throws WxErrorException
|
||
|
*/
|
||
|
@RequestMapping(value = "add",method = RequestMethod.POST)
|
||
|
@ResponseBody
|
||
|
public Map<String,Object> addUser(@RequestBody EmployeeDO employee){
|
||
|
try {
|
||
|
Boolean hasAdd = employeeService.addUser(employee);
|
||
|
return data(hasAdd);
|
||
|
}catch (Exception e){
|
||
|
log.error("添加用户失败",e);
|
||
|
return fail();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 修改成员
|
||
|
* @param employee 成员实体
|
||
|
* @return
|
||
|
* @throws WxErrorException
|
||
|
*/
|
||
|
@RequestMapping(value = "update",method = RequestMethod.POST)
|
||
|
@ResponseBody
|
||
|
public Map<String,Object> updateUser(@RequestBody EmployeeDO employee){
|
||
|
try {
|
||
|
Boolean hasAdd = employeeService.updateUser(employee);
|
||
|
return data(hasAdd);
|
||
|
}catch (Exception e){
|
||
|
log.error("修改用户失败",e);
|
||
|
return fail();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 删除成员
|
||
|
* @param employee 成员实体
|
||
|
* @return
|
||
|
* @throws WxErrorException
|
||
|
*/
|
||
|
@RequestMapping(value = "add",method = RequestMethod.POST)
|
||
|
@ResponseBody
|
||
|
public Map<String,Object> deleteUser(@RequestParam("cpUserId") Long cpUserId){
|
||
|
try {
|
||
|
Boolean hasAdd = employeeService.deleteUser(cpUserId);
|
||
|
return data(hasAdd);
|
||
|
}catch (Exception e){
|
||
|
log.error("删除用户失败",e);
|
||
|
return fail();
|
||
|
}
|
||
|
}
|
||
|
}
|