parent
1cea6510eb
commit
f6322db398
|
|
@ -7,6 +7,7 @@
|
|||
type="primary"
|
||||
icon="el-icon-arrow-left"
|
||||
:loading="buttonLoading"
|
||||
v-hasPermi="['openapi:area:rest']"
|
||||
@click="getNewsArea()">联网获取最新区域编码
|
||||
</el-button>
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<el-input v-model="dataForm.address" placeholder="仓库地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="区域编码" prop="areacode">
|
||||
<el-input v-model="dataForm.areacode" placeholder="区域编码"></el-input>
|
||||
<el-input v-model.number="dataForm.areacode" placeholder="区域编码"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
|
|
@ -38,13 +38,16 @@ export default {
|
|||
},
|
||||
dataRule: {
|
||||
name: [
|
||||
{required: true, message: '仓库名不能为空', trigger: 'blur'}
|
||||
{required: true, message: '仓库名不能为空', trigger: 'blur'},
|
||||
{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }
|
||||
],
|
||||
address: [
|
||||
{required: true, message: '仓库地址不能为空', trigger: 'blur'}
|
||||
{required: true, message: '仓库地址不能为空', trigger: 'blur'},
|
||||
{ min: 1, max: 100, message: '长度在 1 到 100 个字符', trigger: 'blur' }
|
||||
],
|
||||
areacode: [
|
||||
{required: true, message: '区域编码不能为空', trigger: 'blur'}
|
||||
{required: true, message: '区域编码不能为空', trigger: 'blur'},
|
||||
{type: 'number',min: 100000, max: 999999, message: '区域编码为数字且为6位', trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.xjs.area.controller;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.xjs.area.domain.Area;
|
||||
import com.xjs.area.service.AreaService;
|
||||
import com.xjs.web.MyBaseController;
|
||||
|
|
@ -32,6 +33,7 @@ public class AreaController extends MyBaseController<Area> {
|
|||
|
||||
@GetMapping("rest")
|
||||
@ApiOperation("更新获取区域编码信息")
|
||||
@RequiresPermissions("openapi:area:rest")
|
||||
public AjaxResult restArea() {
|
||||
areaService.truncateArea();
|
||||
areaService.saveArea();
|
||||
|
|
@ -41,6 +43,7 @@ public class AreaController extends MyBaseController<Area> {
|
|||
|
||||
@GetMapping("getProvinceArea")
|
||||
@ApiOperation("获取所有省级区域")
|
||||
@RequiresPermissions("openapi:area:list")
|
||||
public AjaxResult getProvinceArea() {
|
||||
List<Area> areaList = areaService.getProvinceArea();
|
||||
return AjaxResult.success(areaList);
|
||||
|
|
@ -48,6 +51,7 @@ public class AreaController extends MyBaseController<Area> {
|
|||
|
||||
@GetMapping("getAreaByParentId/{pid}")
|
||||
@ApiOperation("根据父ID获取区域")
|
||||
@RequiresPermissions("openapi:area:list")
|
||||
public AjaxResult getAreaByParentId(@PathVariable Long pid) {
|
||||
List<Area> areaList = areaService.getAreaByParentId(pid);
|
||||
return AjaxResult.success(areaList);
|
||||
|
|
|
|||
|
|
@ -4,9 +4,13 @@ import com.xjs.mall.ware.entity.WareInfoEntity;
|
|||
import com.xjs.mall.ware.service.WareInfoService;
|
||||
import com.xjs.utils.PageUtils;
|
||||
import com.xjs.mall.other.R;
|
||||
import com.xjs.validation.group.AddGroup;
|
||||
import com.xjs.validation.group.UpdateGroup;
|
||||
import com.xjs.web.MyBaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -23,7 +27,7 @@ import java.util.Map;
|
|||
@RestController
|
||||
@RequestMapping("ware/wareinfo")
|
||||
@Api(tags = "商城-仓库-仓库信息")
|
||||
public class WareInfoController {
|
||||
public class WareInfoController extends MyBaseController<WareInfoEntity> {
|
||||
@Autowired
|
||||
private WareInfoService wareInfoService;
|
||||
|
||||
|
|
@ -33,6 +37,7 @@ public class WareInfoController {
|
|||
@GetMapping("/list")
|
||||
@ApiOperation("列表")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
super.checkParams(params);
|
||||
PageUtils page = wareInfoService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
|
|
@ -55,7 +60,7 @@ public class WareInfoController {
|
|||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("保存")
|
||||
public R save(@RequestBody WareInfoEntity wareInfo) {
|
||||
public R save(@Validated(AddGroup.class) @RequestBody WareInfoEntity wareInfo) {
|
||||
wareInfoService.save(wareInfo);
|
||||
|
||||
return R.ok();
|
||||
|
|
@ -66,7 +71,7 @@ public class WareInfoController {
|
|||
*/
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改")
|
||||
public R update(@RequestBody WareInfoEntity wareInfo) {
|
||||
public R update(@Validated(UpdateGroup.class)@RequestBody WareInfoEntity wareInfo) {
|
||||
wareInfoService.updateById(wareInfo);
|
||||
|
||||
return R.ok();
|
||||
|
|
|
|||
|
|
@ -2,14 +2,16 @@ package com.xjs.mall.ware.entity;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.xjs.validation.group.AddGroup;
|
||||
import com.xjs.validation.group.UpdateGroup;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 仓库信息
|
||||
*
|
||||
*
|
||||
* @author xiejs
|
||||
* @email 1294405880@qq.com
|
||||
* @date 2022-03-15 09:56:19
|
||||
|
|
@ -17,24 +19,31 @@ import lombok.Data;
|
|||
@Data
|
||||
@TableName("wms_ware_info")
|
||||
public class WareInfoEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 仓库名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 仓库地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 区域编码
|
||||
*/
|
||||
private String areacode;
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 仓库名
|
||||
*/
|
||||
@NotBlank(message = "仓库名不能为空", groups = {UpdateGroup.class, AddGroup.class})
|
||||
@Size(max = 20, message = "请控制仓库名长度在20字符", groups = {UpdateGroup.class, AddGroup.class})
|
||||
private String name;
|
||||
/**
|
||||
* 仓库地址
|
||||
*/
|
||||
@NotBlank(message = "仓库地址不能为空", groups = {UpdateGroup.class, AddGroup.class})
|
||||
@Size(max = 100, message = "请控制仓库地址长度在100字符", groups = {UpdateGroup.class, AddGroup.class})
|
||||
private String address;
|
||||
/**
|
||||
* 区域编码
|
||||
*/
|
||||
@NotNull(message = "区域编码不能为空", groups = {UpdateGroup.class, AddGroup.class})
|
||||
@Max(message = "区域编码在六位数", groups = {UpdateGroup.class, AddGroup.class}, value = 999999)
|
||||
@Min(message = "区域编码在六位数", groups = {UpdateGroup.class, AddGroup.class}, value = 100000)
|
||||
private Integer areacode;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public class WareInfoServiceImpl extends ServiceImpl<WareInfoDao, WareInfoEntity
|
|||
.like(WareInfoEntity::getAddress, key).or()
|
||||
.eq(WareInfoEntity::getAreacode, key);
|
||||
}
|
||||
wrapper.orderByDesc(WareInfoEntity::getId);
|
||||
|
||||
IPage<WareInfoEntity> page = this.page(new Query<WareInfoEntity>().getPage(params), wrapper);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue