dev #1
|
@ -8,7 +8,7 @@
|
|||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,43 +1,14 @@
|
|||
package com.atguigu.ssyx.sys.controller;
|
||||
|
||||
|
||||
import com.atguigu.ssyx.common.result.Result;
|
||||
import com.atguigu.ssyx.model.sys.RegionWare;
|
||||
import com.atguigu.ssyx.sys.service.RegionWareService;
|
||||
import com.atguigu.ssyx.vo.sys.RegionWareQueryVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Api(value = "获取开通区管理", tags = "获取开通区管理")
|
||||
@Api(tags = "区域接口")
|
||||
@RestController
|
||||
@RequestMapping(value = "/admin/sys/regionWare")
|
||||
@RequestMapping("/admin/sys/region")
|
||||
public class RegionController {
|
||||
@Resource
|
||||
private RegionWareService regionWareService;
|
||||
|
||||
@ApiOperation(value = "获取开通区域列表")
|
||||
@GetMapping("{page}/{limit}")
|
||||
public Result<IPage<RegionWare>> index(
|
||||
@ApiParam(name = "page", value = "当前页码", required = true)
|
||||
@PathVariable Long page,
|
||||
@ApiParam(name = "limit", value = "每页记录数", required = true)
|
||||
@PathVariable Long limit,
|
||||
@ApiParam(name = "regionWareVo", value = "查询对象", required = false)
|
||||
RegionWareQueryVo regionWareQueryVo) {
|
||||
|
||||
Page<RegionWare> pageParam = new Page<>(page, limit);
|
||||
IPage<RegionWare> pageModel = regionWareService.selectPage(pageParam, regionWareQueryVo);
|
||||
|
||||
return Result.success(pageModel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,62 @@
|
|||
package com.atguigu.ssyx.sys.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.atguigu.ssyx.common.result.Result;
|
||||
import com.atguigu.ssyx.model.sys.RegionWare;
|
||||
import com.atguigu.ssyx.model.sys.Ware;
|
||||
import com.atguigu.ssyx.sys.service.RegionWareService;
|
||||
import com.atguigu.ssyx.vo.sys.RegionWareQueryVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Api(value = "RegionWare管理", tags = "RegionWare管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/region-ware")
|
||||
@RequestMapping(value = "/admin/sys/regionWare")
|
||||
public class RegionWareController {
|
||||
@Resource
|
||||
private RegionWareService regionWareService;
|
||||
|
||||
@ApiOperation(value = "获取开通区域列表")
|
||||
@GetMapping("{page}/{limit}")
|
||||
public Result<IPage<RegionWare>> index(
|
||||
@ApiParam(name = "page", value = "当前页码", required = true)
|
||||
@PathVariable Long page,
|
||||
@ApiParam(name = "limit", value = "每页记录数", required = true)
|
||||
@PathVariable Long limit,
|
||||
@ApiParam(name = "regionWareVo", value = "查询对象", required = false)
|
||||
RegionWareQueryVo regionWareQueryVo) {
|
||||
|
||||
Page<RegionWare> pageParam = new Page<>(page, limit);
|
||||
IPage<RegionWare> pageModel = regionWareService.selectPage(pageParam, regionWareQueryVo);
|
||||
|
||||
return Result.success(pageModel);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加开通区域")
|
||||
@PostMapping("save")
|
||||
public Result<RegionWare> save(@RequestBody RegionWare regionWare) {
|
||||
regionWareService.saveRegionWare(regionWare);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除")
|
||||
@DeleteMapping("remove/{id}")
|
||||
public Result<Ware> remove(@PathVariable Long id) {
|
||||
regionWareService.removeById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "取消开通区域")
|
||||
@PostMapping("updateStatus/{id}/{status}")
|
||||
public Result<String> updateStatus(@PathVariable Long id, @PathVariable Integer status) {
|
||||
regionWareService.updateStatus(id, status);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +1,29 @@
|
|||
package com.atguigu.ssyx.sys.controller;
|
||||
|
||||
|
||||
import com.atguigu.ssyx.common.result.Result;
|
||||
import com.atguigu.ssyx.model.sys.Ware;
|
||||
import com.atguigu.ssyx.sys.service.WareService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓库表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author atguigu
|
||||
* @since 2024-04-02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/ware")
|
||||
public class WareController {
|
||||
import java.util.List;
|
||||
|
||||
@Api(value = "Ware管理", tags = "Ware管理")
|
||||
@RestController
|
||||
@RequestMapping(value = "/admin/sys/ware")
|
||||
public class WareController {
|
||||
@Autowired
|
||||
private WareService wareService;
|
||||
|
||||
@ApiOperation(value = "获取全部仓库")
|
||||
@GetMapping("findAllList")
|
||||
public Result<List<Ware>> findAllList() {
|
||||
return Result.success(wareService.list());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,4 +12,14 @@ public interface RegionWareService extends IService<RegionWare> {
|
|||
* 开通区域列表
|
||||
*/
|
||||
IPage<RegionWare> selectPage(Page<RegionWare> pageParam, RegionWareQueryVo regionWareQueryVo);
|
||||
|
||||
/**
|
||||
* 添加开通区域
|
||||
*/
|
||||
void saveRegionWare(RegionWare regionWare);
|
||||
|
||||
/**
|
||||
* 取消开通区域
|
||||
*/
|
||||
void updateStatus(Long id, Integer status);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package com.atguigu.ssyx.sys.service.impl;
|
||||
|
||||
import com.atguigu.ssyx.common.exception.BunnyException;
|
||||
import com.atguigu.ssyx.common.result.ResultCodeEnum;
|
||||
import com.atguigu.ssyx.model.sys.RegionWare;
|
||||
import com.atguigu.ssyx.sys.mapper.RegionWareMapper;
|
||||
import com.atguigu.ssyx.sys.service.RegionWareService;
|
||||
import com.atguigu.ssyx.vo.sys.RegionWareQueryVo;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -27,4 +30,29 @@ public class RegionWareServiceImpl extends ServiceImpl<RegionWareMapper, RegionW
|
|||
|
||||
return baseMapper.selectPage(pageParam, wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加开通区域
|
||||
*/
|
||||
@Override
|
||||
public void saveRegionWare(RegionWare regionWare) {
|
||||
// 查询当前区域是否开通
|
||||
Integer count = baseMapper.selectCount(Wrappers.<RegionWare>lambdaQuery().eq(RegionWare::getRegionId, regionWare.getRegionId()));
|
||||
if (count > 0) {
|
||||
throw new BunnyException(ResultCodeEnum.REGION_OPEN);
|
||||
}
|
||||
|
||||
baseMapper.insert(regionWare);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消开通区域
|
||||
*/
|
||||
@Override
|
||||
public void updateStatus(Long id, Integer status) {
|
||||
RegionWare regionWare = baseMapper.selectById(id);
|
||||
regionWare.setStatus(status);
|
||||
// 更新数据
|
||||
baseMapper.updateById(regionWare);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue