parent
f662493fd9
commit
a15ed1f2d1
|
|
@ -135,7 +135,8 @@ export default {
|
||||||
attrGroups: [],
|
attrGroups: [],
|
||||||
dataRule: {
|
dataRule: {
|
||||||
attrName: [
|
attrName: [
|
||||||
{required: true, message: "属性名不能为空", trigger: "blur"}
|
{required: true, message: "属性名不能为空", trigger: "blur"},
|
||||||
|
{ min: 1, max: 30, message: '长度在 1 到 30 个字符', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
searchType: [
|
searchType: [
|
||||||
{required: true, message: "是否需要检索不能为空", trigger: "blur"}
|
{required: true, message: "是否需要检索不能为空", trigger: "blur"}
|
||||||
|
|
@ -144,7 +145,8 @@ export default {
|
||||||
{required: true, message: "值类型不能为空", trigger: "blur"}
|
{required: true, message: "值类型不能为空", trigger: "blur"}
|
||||||
],
|
],
|
||||||
icon: [
|
icon: [
|
||||||
{required: true, message: "属性图标不能为空", trigger: "blur"}
|
{required: true, message: "属性图标不能为空", trigger: "blur"},
|
||||||
|
{ min: 1, max: 30, message: '长度在 1 到 30 个字符', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
attrType: [
|
attrType: [
|
||||||
{required: true, message: "属性类型不能为空", trigger: "blur"}
|
{required: true, message: "属性类型不能为空", trigger: "blur"}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
label-width="90px"
|
label-width="90px"
|
||||||
>
|
>
|
||||||
<el-form-item label="组名" prop="attrGroupName">
|
<el-form-item label="组名" prop="attrGroupName">
|
||||||
<el-input v-model="dataForm.attrGroupName" placeholder="组名"></el-input>
|
<el-input v-model="dataForm.attrGroupName" placeholder="组名" ></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序" prop="sort">
|
<el-form-item label="排序" prop="sort">
|
||||||
<el-input-number v-model.number="dataForm.sort" :min="1" :max="9999" label="排序"></el-input-number>
|
<el-input-number v-model.number="dataForm.sort" :min="1" :max="9999" label="排序"></el-input-number>
|
||||||
|
|
@ -81,13 +81,18 @@ export default {
|
||||||
},
|
},
|
||||||
dataRule: {
|
dataRule: {
|
||||||
attrGroupName: [
|
attrGroupName: [
|
||||||
{required: true, message: "组名不能为空", trigger: "blur"}
|
{required: true, message: "组名不能为空", trigger: "blur"},
|
||||||
|
{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
sort: [{required: true, message: "排序不能为空", trigger: "blur"}],
|
sort: [{required: true, message: "排序不能为空", trigger: "blur"}],
|
||||||
descript: [
|
descript: [
|
||||||
{required: true, message: "描述不能为空", trigger: "blur"}
|
{required: true, message: "描述不能为空", trigger: "blur"},
|
||||||
|
{ min: 1, max: 255, message: '长度在 1 到 255 个字符', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
icon: [
|
||||||
|
{required: true, message: "组图标不能为空", trigger: "blur"},
|
||||||
|
{ min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
icon: [{required: true, message: "组图标不能为空", trigger: "blur"}],
|
|
||||||
catelogId: [
|
catelogId: [
|
||||||
{required: true, message: "所属分类id不能为空", trigger: "blur"}
|
{required: true, message: "所属分类id不能为空", trigger: "blur"}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="mod-config">
|
<div class="mod-config">
|
||||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
<el-input maxlength="20" v-model="dataForm.key" placeholder="请输入属性名等" clearable></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-input size="mini" v-model="dataForm.key" placeholder="请输入品牌名、介绍、检索首字母等" clearable style="width: 300px"></el-input>
|
<el-input size="mini" maxlength="20" v-model="dataForm.key" placeholder="请输入品牌名、介绍、检索首字母等" clearable style="width: 300px"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
prefix-icon="el-icon-search"
|
prefix-icon="el-icon-search"
|
||||||
@input="rest"
|
@input="rest"
|
||||||
placeholder="输入关键字进行过滤"
|
placeholder="输入关键字进行过滤"
|
||||||
|
maxlength="10"
|
||||||
v-model="filterText">
|
v-model="filterText">
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|
||||||
|
|
@ -134,11 +135,11 @@ export default {
|
||||||
|
|
||||||
dataRule: {
|
dataRule: {
|
||||||
name: [
|
name: [
|
||||||
{ required: true, message: "分类名称不能为空", trigger: "blur" },
|
{required: true, message: "分类名称不能为空", trigger: "blur"},
|
||||||
{ min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur' }
|
{min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
productUnit: [
|
productUnit: [
|
||||||
{ min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur' }
|
{min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -180,7 +181,7 @@ export default {
|
||||||
for (let i = 0; i < checkedNodes.length; i++) {
|
for (let i = 0; i < checkedNodes.length; i++) {
|
||||||
catIds.push(checkedNodes[i].catId);
|
catIds.push(checkedNodes[i].catId);
|
||||||
}
|
}
|
||||||
if (catIds.length===0) {
|
if (catIds.length === 0) {
|
||||||
this.$modal.notifyWarning("请选择删除内容")
|
this.$modal.notifyWarning("请选择删除内容")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import java.util.Objects;
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @since 2022-02-18
|
* @since 2022-02-18
|
||||||
*/
|
*/
|
||||||
public class CheckNumberConstraintValidator implements ConstraintValidator<CheckNumber,Integer> {
|
public class CheckNumberConstraintValidator implements ConstraintValidator<CheckNumber,Object> {
|
||||||
|
|
||||||
private int[] num;
|
private int[] num;
|
||||||
|
|
||||||
|
|
@ -27,14 +27,29 @@ public class CheckNumberConstraintValidator implements ConstraintValidator<Check
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
public boolean isValid(Object value, ConstraintValidatorContext context) {
|
||||||
|
|
||||||
if (Objects.nonNull(value)) {
|
if (Objects.nonNull(value)) {
|
||||||
for (int i : num) {
|
|
||||||
if (value == i) {
|
if (value instanceof Integer) {
|
||||||
return true;
|
int val =(int) value;
|
||||||
|
for (int i : num) {
|
||||||
|
if (val == i) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value instanceof Long) {
|
||||||
|
long val =(long) value;
|
||||||
|
for (int i : num) {
|
||||||
|
if (val == i) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
package com.xjs.mall.product.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.xjs.mall.product.entity.AttrAttrgroupRelationEntity;
|
|
||||||
import com.xjs.mall.product.service.AttrAttrgroupRelationService;
|
|
||||||
import com.xjs.utils.PageUtils;
|
|
||||||
import com.xjs.utils.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 属性&属性分组关联
|
|
||||||
*
|
|
||||||
* @author xiejs
|
|
||||||
* @email 1294405880@qq.com
|
|
||||||
* @date 2022-03-15 10:16:53
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("product/attrattrgrouprelation")
|
|
||||||
public class AttrAttrgroupRelationController {
|
|
||||||
@Autowired
|
|
||||||
private AttrAttrgroupRelationService attrAttrgroupRelationService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = attrAttrgroupRelationService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
AttrAttrgroupRelationEntity attrAttrgroupRelation = attrAttrgroupRelationService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("attrAttrgroupRelation", attrAttrgroupRelation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody AttrAttrgroupRelationEntity attrAttrgroupRelation){
|
|
||||||
attrAttrgroupRelationService.save(attrAttrgroupRelation);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody AttrAttrgroupRelationEntity attrAttrgroupRelation){
|
|
||||||
attrAttrgroupRelationService.updateById(attrAttrgroupRelation);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
attrAttrgroupRelationService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -7,22 +7,24 @@ import com.xjs.mall.product.vo.AttrResponseVo;
|
||||||
import com.xjs.mall.product.vo.AttrVo;
|
import com.xjs.mall.product.vo.AttrVo;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.utils.R;
|
||||||
|
import com.xjs.validation.group.AddGroup;
|
||||||
|
import com.xjs.validation.group.UpdateGroup;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品属性
|
* 商品属性
|
||||||
*
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @email 1294405880@qq.com
|
* @email 1294405880@qq.com
|
||||||
* @since 2022-03-15 10:16:53
|
* @since 2022-03-15 10:16:53
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("product/attr")
|
@RequestMapping("product/attr")
|
||||||
|
|
@ -45,8 +47,8 @@ public class AttrController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/info/{attrId}")
|
@GetMapping("/info/{attrId}")
|
||||||
@ApiOperation("信息")
|
@ApiOperation("信息")
|
||||||
public R info(@PathVariable("attrId") Long attrId){
|
public R info(@PathVariable("attrId") Long attrId) {
|
||||||
AttrResponseVo attr = attrService.getAttrInfo(attrId);
|
AttrResponseVo attr = attrService.getAttrInfo(attrId);
|
||||||
|
|
||||||
return R.ok().put("attr", attr);
|
return R.ok().put("attr", attr);
|
||||||
}
|
}
|
||||||
|
|
@ -57,8 +59,8 @@ public class AttrController {
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
@ApiOperation("保存")
|
@ApiOperation("保存")
|
||||||
@Log(title = "规格参数", businessType = BusinessType.INSERT)
|
@Log(title = "规格参数", businessType = BusinessType.INSERT)
|
||||||
public R save(@RequestBody AttrVo attr){
|
public R save(@Validated(AddGroup.class) @RequestBody AttrVo attr) {
|
||||||
attrService.saveAttr(attr);
|
attrService.saveAttr(attr);
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
@ -69,8 +71,8 @@ public class AttrController {
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@ApiOperation("修改")
|
@ApiOperation("修改")
|
||||||
@Log(title = "规格参数", businessType = BusinessType.UPDATE)
|
@Log(title = "规格参数", businessType = BusinessType.UPDATE)
|
||||||
public R update(@RequestBody AttrVo attr){
|
public R update(@Validated(UpdateGroup.class) @RequestBody AttrVo attr) {
|
||||||
attrService.updateAttr(attr);
|
attrService.updateAttr(attr);
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
@ -81,8 +83,8 @@ public class AttrController {
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@ApiOperation("删除")
|
@ApiOperation("删除")
|
||||||
@Log(title = "规格参数", businessType = BusinessType.DELETE)
|
@Log(title = "规格参数", businessType = BusinessType.DELETE)
|
||||||
public R delete(@RequestBody Long[] attrIds){
|
public R delete(@RequestBody Long[] attrIds) {
|
||||||
attrService.removeByIds(Arrays.asList(attrIds));
|
attrService.removeByIds(Arrays.asList(attrIds));
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,12 @@ import com.xjs.mall.product.service.AttrGroupService;
|
||||||
import com.xjs.mall.product.service.CategoryService;
|
import com.xjs.mall.product.service.CategoryService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.utils.R;
|
||||||
|
import com.xjs.validation.group.AddGroup;
|
||||||
|
import com.xjs.validation.group.UpdateGroup;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -23,7 +26,7 @@ import java.util.stream.Collectors;
|
||||||
*
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @email 1294405880@qq.com
|
* @email 1294405880@qq.com
|
||||||
* @since 2022-03-15 10:16:53
|
* @since 2022-03-15 10:16:53
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("product/attrgroup")
|
@RequestMapping("product/attrgroup")
|
||||||
|
|
@ -39,9 +42,9 @@ public class AttrGroupController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list/{catelogId}")
|
@GetMapping("/list/{catelogId}")
|
||||||
@ApiOperation("列表")
|
@ApiOperation("列表")
|
||||||
public R list(@RequestParam Map<String, Object> params,Long catelogId){
|
public R list(@RequestParam Map<String, Object> params, Long catelogId) {
|
||||||
|
|
||||||
PageUtils page =attrGroupService.queryPage(params,catelogId);
|
PageUtils page = attrGroupService.queryPage(params, catelogId);
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
return R.ok().put("page", page);
|
||||||
}
|
}
|
||||||
|
|
@ -52,10 +55,10 @@ public class AttrGroupController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/info/{attrGroupId}")
|
@GetMapping("/info/{attrGroupId}")
|
||||||
@ApiOperation("信息")
|
@ApiOperation("信息")
|
||||||
public R info(@PathVariable("attrGroupId") Long attrGroupId){
|
public R info(@PathVariable("attrGroupId") Long attrGroupId) {
|
||||||
AttrGroupEntity attrGroup = attrGroupService.getById(attrGroupId);
|
AttrGroupEntity attrGroup = attrGroupService.getById(attrGroupId);
|
||||||
|
|
||||||
Long[] path=categoryService.finCatelogPath(attrGroup.getCatelogId());
|
Long[] path = categoryService.finCatelogPath(attrGroup.getCatelogId());
|
||||||
List<String> collect = Arrays.stream(path).map(String::valueOf).collect(Collectors.toList());
|
List<String> collect = Arrays.stream(path).map(String::valueOf).collect(Collectors.toList());
|
||||||
|
|
||||||
attrGroup.setCatelogPath(collect);
|
attrGroup.setCatelogPath(collect);
|
||||||
|
|
@ -69,8 +72,8 @@ public class AttrGroupController {
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
@ApiOperation("保存")
|
@ApiOperation("保存")
|
||||||
@Log(title = "属性分组", businessType = BusinessType.INSERT)
|
@Log(title = "属性分组", businessType = BusinessType.INSERT)
|
||||||
public R save(@RequestBody AttrGroupEntity attrGroup){
|
public R save(@Validated(AddGroup.class) @RequestBody AttrGroupEntity attrGroup) {
|
||||||
attrGroupService.save(attrGroup);
|
attrGroupService.save(attrGroup);
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
@ -81,8 +84,8 @@ public class AttrGroupController {
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@ApiOperation("修改")
|
@ApiOperation("修改")
|
||||||
@Log(title = "属性分组", businessType = BusinessType.UPDATE)
|
@Log(title = "属性分组", businessType = BusinessType.UPDATE)
|
||||||
public R update(@RequestBody AttrGroupEntity attrGroup){
|
public R update(@Validated(UpdateGroup.class) @RequestBody AttrGroupEntity attrGroup) {
|
||||||
attrGroupService.updateById(attrGroup);
|
attrGroupService.updateById(attrGroup);
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
@ -93,8 +96,8 @@ public class AttrGroupController {
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@ApiOperation("删除")
|
@ApiOperation("删除")
|
||||||
@Log(title = "属性分组", businessType = BusinessType.DELETE)
|
@Log(title = "属性分组", businessType = BusinessType.DELETE)
|
||||||
public R delete(@RequestBody Long[] attrGroupIds){
|
public R delete(@RequestBody Long[] attrGroupIds) {
|
||||||
attrGroupService.removeByIds(Arrays.asList(attrGroupIds));
|
attrGroupService.removeByIds(Arrays.asList(attrGroupIds));
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,12 @@ package com.xjs.mall.product.entity;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.xjs.validation.group.AddGroup;
|
||||||
|
import com.xjs.validation.group.UpdateGroup;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -18,38 +22,44 @@ import java.util.List;
|
||||||
@Data
|
@Data
|
||||||
@TableName("pms_attr_group")
|
@TableName("pms_attr_group")
|
||||||
public class AttrGroupEntity implements Serializable {
|
public class AttrGroupEntity implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分组id
|
* 分组id
|
||||||
*/
|
*/
|
||||||
@TableId
|
@TableId
|
||||||
private Long attrGroupId;
|
private Long attrGroupId;
|
||||||
/**
|
/**
|
||||||
* 组名
|
* 组名
|
||||||
*/
|
*/
|
||||||
private String attrGroupName;
|
@NotBlank(message = "组名不能为空", groups = {UpdateGroup.class, AddGroup.class})
|
||||||
/**
|
@Size(max = 20, groups = {UpdateGroup.class, AddGroup.class}, message = "图标大小长度大于 20 字符")
|
||||||
* 排序
|
private String attrGroupName;
|
||||||
*/
|
/**
|
||||||
private Integer sort;
|
* 排序
|
||||||
/**
|
*/
|
||||||
* 描述
|
private Integer sort;
|
||||||
*/
|
/**
|
||||||
private String descript;
|
* 描述
|
||||||
/**
|
*/
|
||||||
* 组图标
|
@NotBlank(message = "描述不能为空", groups = {UpdateGroup.class, AddGroup.class})
|
||||||
*/
|
@Size(max = 255, groups = {UpdateGroup.class, AddGroup.class}, message = "图标大小长度大于 255 字符")
|
||||||
private String icon;
|
private String descript;
|
||||||
/**
|
/**
|
||||||
* 所属分类id
|
* 组图标
|
||||||
*/
|
*/
|
||||||
private Long catelogId;
|
@Size(max = 50, groups = {UpdateGroup.class, AddGroup.class}, message = "图标大小长度大于 50 字符")
|
||||||
|
private String icon;
|
||||||
|
/**
|
||||||
|
* 所属分类id
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "所属分类id不能为空", groups = {UpdateGroup.class, AddGroup.class})
|
||||||
|
private Long catelogId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类id完整路径
|
* 分类id完整路径
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<String> catelogPath;
|
private List<String> catelogPath;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
package com.xjs.mall.product.service;
|
package com.xjs.mall.product.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.xjs.utils.PageUtils;
|
|
||||||
import com.xjs.mall.product.entity.AttrAttrgroupRelationEntity;
|
import com.xjs.mall.product.entity.AttrAttrgroupRelationEntity;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 属性&属性分组关联
|
* 属性&属性分组关联
|
||||||
*
|
*
|
||||||
|
|
@ -15,6 +12,5 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public interface AttrAttrgroupRelationService extends IService<AttrAttrgroupRelationEntity> {
|
public interface AttrAttrgroupRelationService extends IService<AttrAttrgroupRelationEntity> {
|
||||||
|
|
||||||
PageUtils queryPage(Map<String, Object> params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,15 @@
|
||||||
package com.xjs.mall.product.service.impl;
|
package com.xjs.mall.product.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import java.util.Map;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.xjs.utils.PageUtils;
|
|
||||||
import com.xjs.utils.Query;
|
|
||||||
|
|
||||||
import com.xjs.mall.product.dao.AttrAttrgroupRelationDao;
|
import com.xjs.mall.product.dao.AttrAttrgroupRelationDao;
|
||||||
import com.xjs.mall.product.entity.AttrAttrgroupRelationEntity;
|
import com.xjs.mall.product.entity.AttrAttrgroupRelationEntity;
|
||||||
import com.xjs.mall.product.service.AttrAttrgroupRelationService;
|
import com.xjs.mall.product.service.AttrAttrgroupRelationService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
@Service("attrAttrgroupRelationService")
|
@Service("attrAttrgroupRelationService")
|
||||||
public class AttrAttrgroupRelationServiceImpl extends ServiceImpl<AttrAttrgroupRelationDao, AttrAttrgroupRelationEntity> implements AttrAttrgroupRelationService {
|
public class AttrAttrgroupRelationServiceImpl extends ServiceImpl<AttrAttrgroupRelationDao, AttrAttrgroupRelationEntity> implements AttrAttrgroupRelationService {
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageUtils queryPage(Map<String, Object> params) {
|
|
||||||
IPage<AttrAttrgroupRelationEntity> page = this.page(
|
|
||||||
new Query<AttrAttrgroupRelationEntity>().getPage(params),
|
|
||||||
new QueryWrapper<AttrAttrgroupRelationEntity>()
|
|
||||||
);
|
|
||||||
|
|
||||||
return new PageUtils(page);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
package com.xjs.mall.product.vo;
|
package com.xjs.mall.product.vo;
|
||||||
|
|
||||||
|
import com.xjs.validation.annotation.CheckNumber;
|
||||||
|
import com.xjs.validation.group.AddGroup;
|
||||||
|
import com.xjs.validation.group.UpdateGroup;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品属性Vo
|
* 商品属性Vo
|
||||||
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @since 2022-03-17
|
* @since 2022-03-17
|
||||||
*/
|
*/
|
||||||
|
|
@ -13,39 +21,54 @@ public class AttrVo {
|
||||||
/**
|
/**
|
||||||
* 属性名
|
* 属性名
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "属性名不能为空", groups = {AddGroup.class, UpdateGroup.class})
|
||||||
|
@Size(max = 30, groups = {AddGroup.class, UpdateGroup.class}, message = "属性名长度在 1 到 30 字符")
|
||||||
private String attrName;
|
private String attrName;
|
||||||
/**
|
/**
|
||||||
* 是否需要检索[0-不需要,1-需要]
|
* 是否需要检索[0-不需要,1-需要]
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "是否需要检索不能为空", groups = {AddGroup.class, UpdateGroup.class})
|
||||||
|
@CheckNumber(num = {0, 1}, groups = {AddGroup.class, UpdateGroup.class})
|
||||||
private Integer searchType;
|
private Integer searchType;
|
||||||
/**
|
/**
|
||||||
* 属性图标
|
* 属性图标
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "属性图标不能为空", groups = {AddGroup.class, UpdateGroup.class})
|
||||||
|
@Size(max = 30, groups = {AddGroup.class, UpdateGroup.class}, message = "属性图标长度在 1 到 30 字符")
|
||||||
private String icon;
|
private String icon;
|
||||||
/**
|
/**
|
||||||
* 可选值列表[用逗号分隔]
|
* 可选值列表[用逗号分隔]
|
||||||
*/
|
*/
|
||||||
|
@Size(max = 255, groups = {AddGroup.class, UpdateGroup.class}, message = "可选值列表长度在 1 到 255 字符")
|
||||||
private String valueSelect;
|
private String valueSelect;
|
||||||
/**
|
/**
|
||||||
* 属性类型[0-销售属性,1-基本属性,2-既是销售属性又是基本属性]
|
* 属性类型[0-销售属性,1-基本属性,2-既是销售属性又是基本属性]
|
||||||
*/
|
*/
|
||||||
|
@CheckNumber(num = {0, 1}, groups = {AddGroup.class, UpdateGroup.class})
|
||||||
|
@NotNull(message = "属性类型不能为空", groups = {AddGroup.class, UpdateGroup.class})
|
||||||
private Integer attrType;
|
private Integer attrType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 值类型(多选单选)
|
* 值类型(多选单选)
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "值类型不能为空", groups = {AddGroup.class, UpdateGroup.class})
|
||||||
private Integer valueType;
|
private Integer valueType;
|
||||||
/**
|
/**
|
||||||
* 启用状态[0 - 禁用,1 - 启用]
|
* 启用状态[0 - 禁用,1 - 启用]
|
||||||
*/
|
*/
|
||||||
|
@CheckNumber(num = {0, 1}, groups = {AddGroup.class, UpdateGroup.class})
|
||||||
|
@NotNull(message = "启用状态不能为空", groups = {AddGroup.class, UpdateGroup.class})
|
||||||
private Long enable;
|
private Long enable;
|
||||||
/**
|
/**
|
||||||
* 所属分类
|
* 所属分类
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "所属分类id不能为空", groups = {AddGroup.class, UpdateGroup.class})
|
||||||
private Long catelogId;
|
private Long catelogId;
|
||||||
/**
|
/**
|
||||||
* 快速展示【是否展示在介绍上;0-否 1-是】,在sku中仍然可以调整
|
* 快速展示【是否展示在介绍上;0-否 1-是】,在sku中仍然可以调整
|
||||||
*/
|
*/
|
||||||
|
@CheckNumber(num = {0, 1}, groups = {AddGroup.class, UpdateGroup.class})
|
||||||
|
@NotNull(message = "快速展示不能为空", groups = {AddGroup.class, UpdateGroup.class})
|
||||||
private Integer showDesc;
|
private Integer showDesc;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue