|
|
@ -17,8 +17,9 @@ |
|
|
|
|
|
|
|
package com.epmet.controller; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.annotation.LoginUser; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.user.UserDetail; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.ExcelUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
@ -49,61 +50,75 @@ import java.util.Map; |
|
|
|
@RequestMapping("operuser") |
|
|
|
public class OperUserController { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private OperUserService operUserService; |
|
|
|
@Autowired |
|
|
|
private OperUserService operUserService; |
|
|
|
|
|
|
|
@GetMapping("page") |
|
|
|
public Result<PageData<OperUserDTO>> page(@RequestParam Map<String, Object> params){ |
|
|
|
PageData<OperUserDTO> page = operUserService.page(params); |
|
|
|
return new Result<PageData<OperUserDTO>>().ok(page); |
|
|
|
} |
|
|
|
@GetMapping("page") |
|
|
|
public Result<PageData<OperUserDTO>> page(@RequestParam Map<String, Object> params) { |
|
|
|
PageData<OperUserDTO> page = operUserService.page(params); |
|
|
|
return new Result<PageData<OperUserDTO>>().ok(page); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("{id}") |
|
|
|
public Result<OperUserDTO> get(@PathVariable("id") String id){ |
|
|
|
OperUserDTO data = operUserService.get(id); |
|
|
|
return new Result<OperUserDTO>().ok(data); |
|
|
|
} |
|
|
|
@GetMapping("{id}") |
|
|
|
public Result<OperUserDTO> get(@PathVariable("id") String id) { |
|
|
|
OperUserDTO data = operUserService.get(id); |
|
|
|
return new Result<OperUserDTO>().ok(data); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping |
|
|
|
public Result save(@RequestBody OperUserDTO dto){ |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|
|
|
operUserService.save(dto); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
@PostMapping |
|
|
|
public Result save(@RequestBody OperUserDTO dto) { |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|
|
|
operUserService.save(dto); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping |
|
|
|
public Result update(@RequestBody OperUserDTO dto){ |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|
|
|
operUserService.update(dto); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
@PutMapping |
|
|
|
public Result update(@RequestBody OperUserDTO dto) { |
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|
|
|
operUserService.update(dto); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@DeleteMapping |
|
|
|
public Result delete(@RequestBody String[] ids){ |
|
|
|
//效验数据
|
|
|
|
AssertUtils.isArrayEmpty(ids, "id"); |
|
|
|
operUserService.delete(ids); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
@DeleteMapping |
|
|
|
public Result delete(@RequestBody String[] ids) { |
|
|
|
//效验数据
|
|
|
|
AssertUtils.isArrayEmpty(ids, "id"); |
|
|
|
operUserService.delete(ids); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("export") |
|
|
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|
|
|
List<OperUserDTO> list = operUserService.list(params); |
|
|
|
ExcelUtils.exportExcelToTarget(response, null, list, OperUserExcel.class); |
|
|
|
} |
|
|
|
@GetMapping("export") |
|
|
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|
|
|
List<OperUserDTO> list = operUserService.list(params); |
|
|
|
ExcelUtils.exportExcelToTarget(response, null, list, OperUserExcel.class); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取运营人员信息 |
|
|
|
* |
|
|
|
* @param tokenDto token |
|
|
|
* @return OperUserDTO |
|
|
|
* @author zhaoqifeng |
|
|
|
*/ |
|
|
|
@GetMapping("queryOperUserDto") |
|
|
|
public Result<OperUserDTO> queryOperUserDto(@LoginUser TokenDto tokenDto) { |
|
|
|
OperUserDTO data = operUserService.getOperUserInfoById(tokenDto.getUserId()); |
|
|
|
return new Result<OperUserDTO>().ok(data); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取运营人员信息 |
|
|
|
* |
|
|
|
* @param operUserId oper_user表主键 |
|
|
|
* @return OperUserDTO |
|
|
|
* @author zhaoqifeng |
|
|
|
*/ |
|
|
|
@GetMapping("queryOperUserDtoById/{operUserId}") |
|
|
|
public Result<OperUserDTO> queryOperUserDtoById(@PathVariable("operUserId") String operUserId){ |
|
|
|
OperUserDTO data = operUserService.getOperUserInfoById(operUserId); |
|
|
|
return new Result<OperUserDTO>().ok(data); |
|
|
|
} |
|
|
|
public Result<OperUserDTO> queryOperUserDtoById(@PathVariable("operUserId") String operUserId) { |
|
|
|
OperUserDTO data = operUserService.getOperUserInfoById(operUserId); |
|
|
|
return new Result<OperUserDTO>().ok(data); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|