12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- package com.gyee.backconfig.controller;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.gyee.backconfig.config.R;
- import com.gyee.backconfig.model.auto.ProBasicRegion;
- import com.gyee.backconfig.service.auto.IProBasicRegionService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.web.bind.annotation.*;
- import javax.annotation.Resource;
- import java.util.Arrays;
- /**
- * <p>
- * 区域 前端控制器
- * </p>
- *
- * @author wang
- * @since 2022-10-15
- */
- @RestController
- @RequestMapping("//pro-basic-region")
- @Api(value = "区域配置" ,tags = "区域配置")
- public class ProBasicRegionController {
- @Resource
- private IProBasicRegionService proBasicRegionService;
- /**
- * 查询
- *
- * @param id
- * @param
- * @param name
- * @param aname
- * @param pageNum
- * @param pageSize
- * @return
- */
- @GetMapping(value = "/List")
- @ApiOperation(value = "区域-列表", notes = "区域-列表")
- public R findList(@RequestParam(value = "id", required = false) String id,
- @RequestParam(value = "name", required = false) String name,
- @RequestParam(value = "aname", required = false) String aname,
- @RequestParam(value = "code", required = false) String code,
- @RequestParam(value = "pageNum", required = true) String pageNum,
- @RequestParam(value = "pageSize", required = true) String pageSize) {
- IPage<ProBasicRegion> list = proBasicRegionService.list(id, name, aname, code, pageNum, pageSize);
- if (null != list) {
- return R.ok().data(list);
- } else {
- return R.error().data("查询失败!");
- }
- }
- /**
- * 保存
- *
- * @param proBasicRegion
- * @return
- */
- @PostMapping(value = "/save")
- @ApiOperation(value = "区域-新增or修改", notes = "区域-新增or修改")
- @CrossOrigin(origins = "*", maxAge = 3600)
- public R addAll(@RequestBody ProBasicRegion proBasicRegion) {
- boolean b = proBasicRegionService.saveOrUpdate(proBasicRegion);
- if (b) {
- return R.ok().data(b);
- } else {
- return R.error().data("保存失败!");
- }
- }
- @DeleteMapping(value = "/{ids}")
- @ApiOperation(value = "区域-删除", notes = "区域-删除")
- public R deleteAll(@PathVariable("ids") String ids) {
- String[] strings = ids.split(",");
- boolean b = proBasicRegionService.removeByIds(Arrays.asList(strings));
- if (b) {
- return R.ok().data(b);
- } else {
- return R.error().data("删除失败!");
- }
- }
- }
|