package com.iailab.module.model.mcs.sche.controller;
|
|
import com.iailab.framework.common.pojo.CommonResult;
|
import com.iailab.framework.common.pojo.PageResult;
|
import com.iailab.framework.common.util.object.BeanUtils;
|
import com.iailab.module.model.mcs.sche.entity.StScheduleUserEntity;
|
import com.iailab.module.model.mcs.sche.service.StScheduleUserService;
|
import com.iailab.module.model.mcs.sche.vo.StScheduleUserPageReqVO;
|
import com.iailab.module.model.mcs.sche.vo.StScheduleUserRespVO;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
|
import static com.iailab.framework.common.pojo.CommonResult.error;
|
import static com.iailab.framework.common.pojo.CommonResult.success;
|
|
/**
|
* @author PanZhibao
|
* @date 2021年07月20日 15:34
|
*/
|
@RestController
|
@RequestMapping("/sche/schedule-user")
|
public class StScheduleUserController {
|
@Autowired
|
private StScheduleUserService stScheduleUserService;
|
|
/**
|
* 调度用户类型列表
|
*/
|
@GetMapping("/list")
|
public CommonResult<PageResult<StScheduleUserRespVO>> page(@Validated StScheduleUserPageReqVO reqVO) {
|
PageResult<StScheduleUserEntity> page = stScheduleUserService.page(reqVO);
|
|
return success(BeanUtils.toBean(page, StScheduleUserRespVO.class));
|
}
|
|
/**
|
* 调度用户类型信息
|
*/
|
@GetMapping("/get")
|
public CommonResult<StScheduleUserEntity> info(@RequestParam("id") String id) {
|
StScheduleUserEntity scheduleUser = stScheduleUserService.selectById(id);
|
return success(scheduleUser);
|
}
|
|
/**
|
* 保存调度用户类型
|
*/
|
@PostMapping("/create")
|
public CommonResult<Boolean> save(@RequestBody StScheduleUserEntity scheduleUser) {
|
int count = stScheduleUserService.check(scheduleUser);
|
if (count > 0) {
|
return error(999, "名称或编号重复");
|
}
|
stScheduleUserService.saveScheduleUser(scheduleUser);
|
return success(true);
|
}
|
|
/**
|
* 修改调度用户类型
|
*/
|
@PutMapping("/update")
|
public CommonResult<Boolean> update(@RequestBody StScheduleUserEntity scheduleUser) {
|
int count = stScheduleUserService.check(scheduleUser);
|
if (count > 0) {
|
return error(999, "名称或编号重复");
|
}
|
stScheduleUserService.update(scheduleUser);
|
return success(true);
|
}
|
|
/**
|
* 删除调度用户类型
|
*/
|
@DeleteMapping("/delete")
|
public CommonResult<Boolean> delete(@RequestParam("id") String id) {
|
stScheduleUserService.deleteBatch(new String[]{id});
|
return success(true);
|
}
|
}
|