package cn.gistack.sm.resDataCheck.controller;
|
|
import cn.gistack.sm.resDataCheck.entity.Rules;
|
import cn.gistack.sm.resDataCheck.service.IRulesService;
|
import cn.gistack.sm.resDataCheck.vo.RulesVO;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.AllArgsConstructor;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springblade.core.boot.ctrl.BladeController;
|
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.tool.api.R;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.Arrays;
|
|
/**
|
* @Description: 数据规则校验
|
*/
|
@Slf4j
|
@Api(tags = "数据规则校验")
|
@RestController
|
@RequestMapping("/resDataCheck/rules")
|
@AllArgsConstructor
|
public class RulesController extends BladeController {
|
|
private IRulesService rulesService;
|
|
/**
|
* 分页列表查询
|
*/
|
@ApiOperation(value = "数据规则校验-分页列表查询", notes = "数据规则校验-分页列表查询")
|
@GetMapping(value = "/list")
|
public R<IPage<Rules>> queryPageList(Rules rules, Query query) {
|
IPage<Rules> pageList = rulesService.selectRulesPage(Condition.getPage(query), rules);
|
return R.data(pageList);
|
}
|
|
/**
|
* 添加
|
*
|
* @param rules
|
* @return
|
*/
|
@ApiOperation(value = "数据规则校验-添加", notes = "数据规则校验-添加")
|
@PostMapping(value = "/add")
|
public R add(@RequestBody Rules rules) {
|
return R.data(rulesService.save(rules));
|
}
|
|
/**
|
* 自定义添加
|
*
|
* @param rulesVO
|
* @return
|
*/
|
@ApiOperation(value = "数据规则校验-自定义添加", notes = "数据规则校验-自定义添加")
|
@PostMapping(value = "/save")
|
public R customizeAdd(@RequestBody RulesVO rulesVO){
|
return R.data(rulesService.customizeAdd(rulesVO));
|
}
|
|
/**
|
* 编辑
|
*
|
* @param rules
|
* @return
|
*/
|
@ApiOperation(value = "数据规则校验-编辑", notes = "数据规则校验-编辑")
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
public R edit(@RequestBody Rules rules) {
|
return R.data(rulesService.updateById(rules));
|
}
|
|
/**
|
* 自定义编辑
|
*
|
* @param rulesVO
|
* @return
|
*/
|
@ApiOperation(value = "数据规则校验-编辑", notes = "数据规则校验-编辑")
|
@RequestMapping(value = "/update", method = {RequestMethod.PUT, RequestMethod.POST})
|
public R customizeEdit(@RequestBody RulesVO rulesVO) {
|
return R.data(rulesService.customizeEdit(rulesVO));
|
}
|
|
/**
|
* 通过id删除
|
*
|
* @param id
|
* @return
|
*/
|
@ApiOperation(value = "数据规则校验-通过id删除", notes = "数据规则校验-通过id删除")
|
@PostMapping(value = "/delete")
|
public R delete(@RequestParam(name = "id", required = true) String id) {
|
return R.data(rulesService.removeById(id));
|
}
|
|
/**
|
* 批量删除
|
*
|
* @param ids
|
* @return
|
*/
|
@ApiOperation(value = "数据规则校验-批量删除", notes = "数据规则校验-批量删除")
|
@PostMapping(value = "/deleteBatch")
|
public R deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
return R.data(this.rulesService.removeByIds(Arrays.asList(ids.split(","))));
|
}
|
|
/**
|
* 通过id查询
|
*
|
* @param id
|
* @return
|
*/
|
@ApiOperation(value = "数据规则校验-通过id查询", notes = "数据规则校验-通过id查询")
|
@GetMapping(value = "/queryById")
|
public R queryById(@RequestParam(name = "id", required = true) String id) {
|
Rules rules = rulesService.getById(id);
|
return R.data(rules);
|
}
|
|
/**
|
* 通过id查询
|
*
|
* @param id
|
* @return
|
*/
|
@ApiOperation(value = "数据规则校验-通过id查询", notes = "数据规则校验-通过id查询")
|
@GetMapping(value = "/getDetail")
|
public R getDetail(@RequestParam(name = "id", required = true) String id) {
|
RulesVO rulesVO = rulesService.getDetail(id);
|
return R.data(rulesVO);
|
}
|
|
}
|