123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- package com.gyee.backconfig.controller;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.gyee.backconfig.config.R;
- import com.gyee.backconfig.model.auto.Standardpoint;
- import com.gyee.backconfig.service.auto.IStandardpointService;
- import com.gyee.common.model.StringUtils;
- import org.springframework.web.bind.annotation.*;
- import javax.annotation.Resource;
- import java.util.List;
- /**
- * <p>
- * 前端控制器
- * </p>
- *
- * @author wang
- * @since 2022-10-24
- */
- @RestController
- @RequestMapping("//standardpoint")
- public class StandardpointController {
- @Resource
- private IStandardpointService standardpointService;
- /**
- * 查询
- * @param id
- * @param uniformcode
- * @param name
- * @param type
- * @param pageNum
- * @param pageSize
- * @return
- */
- @GetMapping(value = "/list")
- public R findList(@RequestParam(value = "id", required = false) String id,
- @RequestParam(value = "uniformcode", required = false) String uniformcode,
- @RequestParam(value = "name", required = false) String name,
- @RequestParam(value = "type", required = false) String type,
- @RequestParam(value = "pageNum", required = true) String pageNum,
- @RequestParam(value = "pageSize", required = true) String pageSize) {
- IPage<Standardpoint> list = standardpointService.list(id, uniformcode, name, type, pageNum, pageSize);
- if (null != list) {
- return R.ok().data(list);
- } else {
- return R.error().data("查询失败!");
- }
- }
- /**
- * 根据id查询
- *
- * @param id
- * @return
- */
- @GetMapping(value = "/{id}")
- public R findOne(@PathVariable("id") String id) {
- Standardpoint standardpoint = standardpointService.getOne(id);
- if (StringUtils.isNotNull(standardpoint)) {
- return R.ok().data(standardpoint);
- } else {
- return R.error().data("查询失败!");
- }
- }
- /**
- * 插入(批量)
- *
- * @param standardpoint
- * @return
- */
- @PostMapping(value = "/add")
- public R addAll(@RequestBody Standardpoint standardpoint) {
- boolean b = standardpointService.addOrUpdate(standardpoint);
- if (b) {
- return R.ok().data(b);
- } else {
- return R.error().data("保存失败!");
- }
- }
- /**
- * 批量删除
- *
- * @param ids
- * @return
- */
- @DeleteMapping(value = "/{ids}")
- public R deleteAll(@PathVariable("ids") String ids) {
- boolean b = standardpointService.removeByIds(ids);
- if (b) {
- return R.ok().data(b);
- } else {
- return R.error().data("删除失败!");
- }
- }
- /**
- * 批量修改
- *
- * @param list
- * @return
- */
- @PutMapping(value = "/editStandardpoint")
- public R update(@RequestBody List<Standardpoint> list) {
- boolean b = standardpointService.updateBatchById(list);
- if (b) {
- return R.ok().data(b);
- } else {
- return R.error().data("更新失败!");
- }
- }
- /**
- * 查询
- *
- * @param type
- * @return
- */
- @GetMapping(value = "/pointcode")
- public R findList(
- @RequestParam(value = "type", required = false) String type) {
- String code = standardpointService.getPointCode(type);
- if (null != code) {
- return R.ok().data(code);
- } else {
- return R.error().data("查询失败!");
- }
- }
- }
|