package com.iailab.module.model.mcs.pre.controller.admin;
|
|
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.pre.entity.MmResultTableEntity;
|
import com.iailab.module.model.mcs.pre.service.MmResultTableService;
|
import com.iailab.module.model.mcs.pre.vo.MmItemTypeRespVO;
|
import com.iailab.module.model.mcs.pre.vo.MmResultTablePageReqVO;
|
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年04月22日 9:57
|
*/
|
@RestController
|
@RequestMapping("/pre/result-table")
|
public class MmResultTableController {
|
|
@Autowired
|
private MmResultTableService mmResultTableService;
|
|
/**
|
* 结果存放列表
|
*/
|
@GetMapping("/page")
|
public CommonResult<PageResult<MmItemTypeRespVO>> page(@Validated MmResultTablePageReqVO reqVO) {
|
PageResult<MmResultTableEntity> page = mmResultTableService.page(reqVO);
|
|
return success(BeanUtils.toBean(page, MmItemTypeRespVO.class));
|
}
|
|
@GetMapping("/get/{id}")
|
public CommonResult<MmResultTableEntity> info(@PathVariable("id") String id){
|
MmResultTableEntity resultTable = mmResultTableService.selectById(id);
|
|
return success(resultTable);
|
}
|
|
/**
|
* 保存结果存放
|
*/
|
@PostMapping("/create")
|
public CommonResult<Boolean> save(@RequestBody MmResultTableEntity resultTable){
|
int count = mmResultTableService.check(resultTable);
|
if (count > 0) {
|
return error(999,"名称重复");
|
}
|
mmResultTableService.saveResultTable(resultTable);
|
return success(true);
|
}
|
|
/**
|
* 修改结果存放
|
*/
|
@PutMapping("/update")
|
public CommonResult<Boolean> update(@RequestBody MmResultTableEntity resultTable){
|
int count = mmResultTableService.check(resultTable);
|
if (count > 0) {
|
return error(999,"名称重复");
|
}
|
mmResultTableService.update(resultTable);
|
return success(true);
|
}
|
|
/**
|
* 删除结果存放
|
*/
|
@DeleteMapping("/delete")
|
public CommonResult<Boolean> delete(@RequestParam("id") String id) {
|
mmResultTableService.deleteBatch(new String[]{id});
|
return success(true);
|
}
|
}
|