2024-11-14(属性组 商品规格 品类信息 状态按钮)

backups
笨蛋 2024-11-16 06:26:17 +08:00
parent 8409d7efd6
commit cf91af75aa
29 changed files with 532 additions and 86 deletions

View File

@ -5,10 +5,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
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 lombok.Data; import com.muyu.product.domain.req.AttributeGroupStateReq;
import lombok.EqualsAndHashCode; import lombok.*;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import com.muyu.common.core.annotation.Excel; import com.muyu.common.core.annotation.Excel;
@ -74,9 +72,8 @@ public class AttributeGroup extends BaseEntity {
* *
*/ */
public static AttributeGroup editBuild(Long id, AttributeGroupEditReq attributeGroupEditReq){ public static AttributeGroup editBuild(Long id, AttributeGroupEditReq attributeGroupEditReq){
return AttributeGroup.builder()
.id(id)
return AttributeGroup.builder().id(id).name(attributeGroupEditReq.getName())
.states(attributeGroupEditReq.getStates()) .states(attributeGroupEditReq.getStates())
.build(); .build();
} }

View File

@ -3,21 +3,21 @@ package com.muyu.product.domain;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
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.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.TreeEntity;
import com.muyu.product.domain.model.CategoryInfoSaveModel; import com.muyu.product.domain.model.CategoryInfoSaveModel;
import com.muyu.product.domain.req.CategoryInfoEditReq;
import com.muyu.product.domain.req.CategoryInfoQueryReq;
import com.muyu.product.domain.req.CategoryInfoSaveReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import io.swagger.annotations.*;
import com.muyu.common.core.annotation.Excel;
import com.muyu.product.domain.req.CategoryInfoQueryReq;
import com.muyu.product.domain.req.CategoryInfoSaveReq;
import com.muyu.product.domain.req.CategoryInfoEditReq;
import com.muyu.common.core.web.domain.TreeEntity;
import java.util.Date; import java.util.Date;
import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
/** /**
@ -64,6 +64,7 @@ public class CategoryInfo extends TreeEntity {
/** /**
* *
*/ */

View File

@ -55,6 +55,8 @@ public class RuleAttrInfo extends BaseEntity {
@Excel(name = "规格值") @Excel(name = "规格值")
@ApiModelProperty(name = "规格值", value = "规格值") @ApiModelProperty(name = "规格值", value = "规格值")
private String attrValue; private String attrValue;
/** /**
* *
*/ */

View File

@ -3,6 +3,7 @@ package com.muyu.product.domain.model;
import com.muyu.common.core.web.domain.BaseEntity; import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.product.domain.AttributeGroup; import com.muyu.product.domain.AttributeGroup;
import com.muyu.product.domain.req.AttributeGroupSaveReq; import com.muyu.product.domain.req.AttributeGroupSaveReq;
import com.muyu.product.domain.req.AttributeGroupStateReq;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -27,6 +28,8 @@ public class AttributeGroupSaveModel extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 状态 id */
private Long id;
/** 组名称 */ /** 组名称 */
private String name; private String name;
@ -46,6 +49,13 @@ public class AttributeGroupSaveModel extends BaseEntity {
.build(); .build();
} }
public static AttributeGroupStateReq updateState(AttributeGroupStateReq attributeGroupStateReq) {
return AttributeGroupStateReq.builder()
.id(attributeGroupStateReq.getId())
.states(attributeGroupStateReq.getStates())
.build();
}
public AttributeGroup buildAttributeGroup () { public AttributeGroup buildAttributeGroup () {
return AttributeGroup.builder() return AttributeGroup.builder()
.name(this.getName()) .name(this.getName())

View File

@ -31,6 +31,7 @@ public class CategoryInfoSaveModel extends TreeEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 品类名称 */ /** 品类名称 */
private String name; private String name;

View File

@ -0,0 +1,24 @@
package com.muyu.product.domain.req;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class AttributeGroupStateReq {
/** 属性id */
@ApiModelProperty(name = "属性id", value = "属性id", required = true)
private Long id;
/** 状态 */
@ApiModelProperty(name = "状态", value = "状态", required = true)
private String states;
}

View File

@ -8,6 +8,8 @@ import lombok.experimental.SuperBuilder;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import com.muyu.common.core.web.domain.TreeEntity; import com.muyu.common.core.web.domain.TreeEntity;
import java.util.List;
/** /**
* category_info * category_info
* *
@ -39,4 +41,21 @@ public class CategoryInfoEditReq extends TreeEntity {
@ApiModelProperty(name = "介绍", value = "介绍") @ApiModelProperty(name = "介绍", value = "介绍")
private String introduction; private String introduction;
/**
* ID
*/
@ApiModelProperty(name = "商品属性组关联ID", value = "商品属性组关联ID")
private List<Long> attributeGroupIdList;
/**
* ID
*/
@ApiModelProperty(name = "商品属性关联ID", value = "商品属性关联ID")
private List<Long> attributeIdList;
/**
* ID
*/
@ApiModelProperty(name = "商品品牌组关联ID", value = "商品品牌组关联ID")
private List<Long> brandIdList;
} }

View File

@ -26,6 +26,9 @@ public class RuleInfoSaveReq extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 规格名称 */
@ApiModelProperty(name = "规格id", value = "规格id")
private Long id;
/** 规格名称 */ /** 规格名称 */
@ApiModelProperty(name = "规格名称", value = "规格名称") @ApiModelProperty(name = "规格名称", value = "规格名称")
private String name; private String name;

View File

@ -0,0 +1,15 @@
package com.muyu.product.domain.req;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class WyzRuleInfoSaveReq {
public Long id;
public String status;
}

View File

@ -34,6 +34,9 @@ public class AttributeGroupPageResp extends BaseEntity {
/** 状态 */ /** 状态 */
private String states; private String states;
/** 备注*/
private String remark;
/** /**
* *

View File

@ -0,0 +1,63 @@
package com.muyu.product.domain.resp;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.muyu.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@AllArgsConstructor
@Builder
@NoArgsConstructor
@Data
/** 品类信息*/
public class CategoryInfoUpdResp {
/** 主键 */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(name = "主键", value = "主键")
private Long id;
/** 品类名称 */
@Excel(name = "品类名称")
@ApiModelProperty(name = "品类名称", value = "品类名称", required = true)
private String name;
/** 图片 */
@Excel(name = "图片")
@ApiModelProperty(name = "图片", value = "图片", required = true)
private String image;
/** 是否启用 */
@Excel(name = "是否启用")
@ApiModelProperty(name = "是否启用", value = "是否启用", required = true)
private String start;
/** 介绍 */
@Excel(name = "介绍")
@ApiModelProperty(name = "介绍", value = "介绍")
private String introduction;
/**
* ID
* AttributeGroup
*/
/**
*
*/
private List<Long> attributeInfoList;
/**
*
*/
private List<Long> attributeGroupList;
/**
*
*/
private List<Long> brandInfoList;
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.muyu.product.domain.model.AttributeGroupSaveModel; import com.muyu.product.domain.model.AttributeGroupSaveModel;
import com.muyu.product.domain.req.AttributeGroupStateReq;
import com.muyu.product.domain.resp.AttributeGroupPageResp; import com.muyu.product.domain.resp.AttributeGroupPageResp;
import com.muyu.product.domain.resp.AttributeGroupUpd; import com.muyu.product.domain.resp.AttributeGroupUpd;
import io.swagger.annotations.*; import io.swagger.annotations.*;
@ -104,6 +105,18 @@ public class AttributeGroupController extends BaseController {
return Result.success("修改成功"); return Result.success("修改成功");
} }
/***
*
*/
@RequiresPermissions("product:attributeGroup:edit")
@Log(title = "属性状态", businessType = BusinessType.UPDATE)
@PutMapping("/updateState")
@ApiOperation("修改属性状态")
public Result<String> updateState(@RequestBody AttributeGroupStateReq attributeGroupStateReq) {
attributeGroupService.updateState(attributeGroupStateReq);
return Result.success("修改成功");
}
/** /**
* *
*/ */

View File

@ -1,37 +1,28 @@
package com.muyu.product.controller; package com.muyu.product.controller;
import java.util.List;
import java.util.function.Supplier;
import javax.servlet.http.HttpServletResponse;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.product.domain.AttributeGroup;
import com.muyu.product.domain.AttributeInfo;
import com.muyu.product.domain.BrandInfo;
import com.muyu.product.domain.model.CategoryInfoSaveModel;
import com.muyu.product.domain.resp.CategoryCommonElementResp;
import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RestController;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil; import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController; import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.log.annotation.Log; import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType; import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions; import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.product.domain.CategoryInfo; import com.muyu.product.domain.CategoryInfo;
import com.muyu.product.domain.req.CategoryInfoQueryReq; import com.muyu.product.domain.model.CategoryInfoSaveModel;
import com.muyu.product.domain.req.CategoryInfoSaveReq;
import com.muyu.product.domain.req.CategoryInfoEditReq; import com.muyu.product.domain.req.CategoryInfoEditReq;
import com.muyu.product.domain.req.CategoryInfoSaveReq;
import com.muyu.product.domain.resp.CategoryCommonElementResp;
import com.muyu.product.domain.resp.CategoryInfoUpdResp;
import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
import com.muyu.product.service.CategoryInfoService; import com.muyu.product.service.CategoryInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**
* Controller * Controller
@ -77,8 +68,8 @@ public class CategoryInfoController extends BaseController {
@RequiresPermissions("product:category:query") @RequiresPermissions("product:category:query")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
public Result<CategoryInfo> getInfo(@PathVariable("id") Long id) { public Result<CategoryInfoUpdResp> getInfo(@PathVariable("id") Long id) {
return Result.success(categoryInfoService.getById(id)); return Result.success(categoryInfoService.getByIdUpd(id));
} }
/** /**
@ -104,7 +95,6 @@ public class CategoryInfoController extends BaseController {
CategoryInfoSaveModel.saveBuild(categoryInfoSaveReq, SecurityUtils::getUsername) CategoryInfoSaveModel.saveBuild(categoryInfoSaveReq, SecurityUtils::getUsername)
)); ));
} }
/** /**
* *
*/ */
@ -113,7 +103,11 @@ public class CategoryInfoController extends BaseController {
@PutMapping("/{id}") @PutMapping("/{id}")
@ApiOperation("修改品类信息") @ApiOperation("修改品类信息")
public Result<String> edit(@PathVariable Long id, @RequestBody CategoryInfoEditReq categoryInfoEditReq) { public Result<String> edit(@PathVariable Long id, @RequestBody CategoryInfoEditReq categoryInfoEditReq) {
return toAjax(categoryInfoService.updateById(CategoryInfo.editBuild(id,categoryInfoEditReq))); boolean b = categoryInfoService.updateUpdById(id, categoryInfoEditReq);
if (b){
return Result.success("修改成功");
}
return Result.success("......");
} }
/** /**

View File

@ -3,6 +3,7 @@ package com.muyu.product.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.muyu.product.domain.req.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -20,9 +21,6 @@ import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType; import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions; import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.product.domain.RuleAttrInfo; import com.muyu.product.domain.RuleAttrInfo;
import com.muyu.product.domain.req.RuleAttrInfoQueryReq;
import com.muyu.product.domain.req.RuleAttrInfoSaveReq;
import com.muyu.product.domain.req.RuleAttrInfoEditReq;
import com.muyu.product.service.RuleAttrInfoService; import com.muyu.product.service.RuleAttrInfoService;
import com.muyu.common.core.web.page.TableDataInfo; import com.muyu.common.core.web.page.TableDataInfo;
@ -105,6 +103,20 @@ public class RuleAttrInfoController extends BaseController {
return toAjax(ruleAttrInfoService.updateById(RuleAttrInfo.editBuild(id,ruleAttrInfoEditReq))); return toAjax(ruleAttrInfoService.updateById(RuleAttrInfo.editBuild(id,ruleAttrInfoEditReq)));
} }
/**
* wyz
*/
@RequiresPermissions("product:ruleAttr:edit")
@Log(title = "规格xuigai", businessType = BusinessType.UPDATE)
@PutMapping("/ruleInfoStateReq")
@ApiOperation("修改规格 属性")
public Result<String> ruleInfoStateReq(@RequestBody WyzRuleInfoSaveReq wyzRuleInfoSaveReq) {
ruleAttrInfoService.updateSaveById(wyzRuleInfoSaveReq);
return Result.success("修改成功");
}
/** /**
* *
*/ */

View File

@ -1,8 +1,11 @@
package com.muyu.product.mapper; package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsCategoryAttributeGroup; import com.muyu.product.domain.AsCategoryAttributeGroup;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* Mapper * Mapper
@ -10,6 +13,20 @@ import com.muyu.product.domain.AsCategoryAttributeGroup;
* @author DongZeLiang * @author DongZeLiang
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Mapper
public interface AsCategoryAttributeGroupMapper extends BaseMapper<AsCategoryAttributeGroup> { public interface AsCategoryAttributeGroupMapper extends BaseMapper<AsCategoryAttributeGroup> {
/**删除 品类 属性组 中间表 */
void deleteAsCategoryAttributeGroup(Long id);
/**
*
* categoryId:id
* attributeGroupId:id
*/
void addAsCategoryAttributeGroup(@Param("categoryId") Long categoryId, @Param("attributeGroupId") Long attributeGroupId);
/**
*
*/
List<Long> selectAsCategoryAttributeGroupList(@Param("id") Long id);
} }

View File

@ -1,8 +1,11 @@
package com.muyu.product.mapper; package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsCategoryAttribute; import com.muyu.product.domain.AsCategoryAttribute;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* Mapper * Mapper
@ -10,6 +13,22 @@ import com.muyu.product.domain.AsCategoryAttribute;
* @author DongZeLiang * @author DongZeLiang
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Mapper
public interface AsCategoryAttributeMapper extends BaseMapper<AsCategoryAttribute> { public interface AsCategoryAttributeMapper extends BaseMapper<AsCategoryAttribute> {
/**删除 品类 属性 中间表 */
void deleteAsCategoryAttribute(Long id);
/**
*
* categoryId:id
* attributeId:id
*/
void addAsCategoryAttribute(@Param("categoryId") Long categoryId, @Param("attributeId") Long attributeId);
/**
*
*/
List<Long> selectAsCategoryAttributeList(@Param("id") Long id);
} }

View File

@ -1,8 +1,11 @@
package com.muyu.product.mapper; package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsCategoryBrand; import com.muyu.product.domain.AsCategoryBrand;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* Mapper * Mapper
@ -10,6 +13,21 @@ import com.muyu.product.domain.AsCategoryBrand;
* @author DongZeLiang * @author DongZeLiang
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Mapper
public interface AsCategoryBrandMapper extends BaseMapper<AsCategoryBrand> { public interface AsCategoryBrandMapper extends BaseMapper<AsCategoryBrand> {
/**删除 品类 品牌 中间表 */
void deleteAsCategoryBrandMapper(Long id);
/**
*
* categoryId:id
* brandId:id
*/
void addAsCategoryBrandMapper(@Param("categoryId") Long categoryId, @Param("brandId") Long brandId);
/**
*
*/
List<Long> selectAsCategoryBrandList(@Param("id") Long id);
} }

View File

@ -1,8 +1,8 @@
package com.muyu.product.mapper; package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.CategoryInfo; import com.muyu.product.domain.CategoryInfo;
import org.apache.ibatis.annotations.Mapper;
/** /**
* Mapper * Mapper
@ -10,6 +10,10 @@ import com.muyu.product.domain.CategoryInfo;
* @author DongZeLiang * @author DongZeLiang
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Mapper
public interface CategoryInfoMapper extends BaseMapper<CategoryInfo> { public interface CategoryInfoMapper extends BaseMapper<CategoryInfo> {
//修改 品类
boolean updateCategoryInfo( CategoryInfo categoryInfo );
} }

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.RuleInfo; import com.muyu.product.domain.RuleInfo;
import org.apache.ibatis.annotations.Mapper;
/** /**
* Mapper * Mapper
@ -10,6 +11,7 @@ import com.muyu.product.domain.RuleInfo;
* @author DongZeLiang * @author DongZeLiang
* @date 2024-02-27 * @date 2024-02-27
*/ */
@Mapper
public interface RuleInfoMapper extends BaseMapper<RuleInfo> { public interface RuleInfoMapper extends BaseMapper<RuleInfo> {
} }

View File

@ -5,6 +5,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.product.domain.AttributeGroup; import com.muyu.product.domain.AttributeGroup;
import com.muyu.product.domain.model.AttributeGroupSaveModel; import com.muyu.product.domain.model.AttributeGroupSaveModel;
import com.muyu.product.domain.req.AttributeGroupEditReq; import com.muyu.product.domain.req.AttributeGroupEditReq;
import com.muyu.product.domain.req.AttributeGroupStateReq;
import com.muyu.product.domain.resp.AttributeGroupPageResp; import com.muyu.product.domain.resp.AttributeGroupPageResp;
import com.muyu.product.domain.resp.AttributeGroupUpd; import com.muyu.product.domain.resp.AttributeGroupUpd;
@ -51,5 +52,9 @@ public interface AttributeGroupService extends IService<AttributeGroup> {
*/ */
AttributeGroupUpd getByIdUpd(Long id); AttributeGroupUpd getByIdUpd(Long id);
/**
* wyz
* @param attributeGroupStateReq
*/
void updateState(AttributeGroupStateReq attributeGroupStateReq);
} }

View File

@ -1,16 +1,18 @@
package com.muyu.product.service; package com.muyu.product.service;
import java.util.List; import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.product.domain.AttributeGroup; import com.muyu.product.domain.AttributeGroup;
import com.muyu.product.domain.AttributeInfo; import com.muyu.product.domain.AttributeInfo;
import com.muyu.product.domain.BrandInfo; import com.muyu.product.domain.BrandInfo;
import com.muyu.product.domain.CategoryInfo; import com.muyu.product.domain.CategoryInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.product.domain.model.CategoryInfoSaveModel; import com.muyu.product.domain.model.CategoryInfoSaveModel;
import com.muyu.product.domain.req.CategoryInfoEditReq;
import com.muyu.product.domain.resp.CategoryCommonElementResp; import com.muyu.product.domain.resp.CategoryCommonElementResp;
import com.muyu.product.domain.resp.CategoryInfoUpdResp;
import com.muyu.product.domain.resp.CategoryParentCommonElementResp; import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
import java.util.List;
/** /**
* Service * Service
* *
@ -69,4 +71,17 @@ public interface CategoryInfoService extends IService<CategoryInfo> {
CategoryCommonElementResp getTemplateAttributeByCateGoryId (Long cateGoryId); CategoryCommonElementResp getTemplateAttributeByCateGoryId (Long cateGoryId);
public <T, AS> List<T> getCommon (Long categoryId, IService<AS> iService, IService<T> bsiService); public <T, AS> List<T> getCommon (Long categoryId, IService<AS> iService, IService<T> bsiService);
/**
*
* @param id
* @param categoryInfoEditReq
* @return
*/
boolean updateUpdById(Long id, CategoryInfoEditReq categoryInfoEditReq);
/** 获取品类信息详细信息 wyz*/
CategoryInfoUpdResp getByIdUpd(Long id);
} }

View File

@ -3,6 +3,8 @@ package com.muyu.product.service;
import java.util.List; import java.util.List;
import com.muyu.product.domain.RuleAttrInfo; import com.muyu.product.domain.RuleAttrInfo;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.product.domain.req.RuleInfoSaveReq;
import com.muyu.product.domain.req.WyzRuleInfoSaveReq;
/** /**
* Service * Service
@ -25,4 +27,9 @@ public interface RuleAttrInfoService extends IService<RuleAttrInfo> {
* @return * @return
*/ */
List<RuleAttrInfo> getInfoByRuleId (Long ruleId); List<RuleAttrInfo> getInfoByRuleId (Long ruleId);
/**
*
*/
void updateSaveById(WyzRuleInfoSaveReq wyzRuleInfoSaveReq);
} }

View File

@ -1,6 +1,8 @@
package com.muyu.product.service.impl; package com.muyu.product.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.muyu.common.core.utils.ObjUtils; import com.muyu.common.core.utils.ObjUtils;
@ -10,6 +12,7 @@ import com.muyu.product.domain.AttributeGroup;
import com.muyu.product.domain.AttributeInfo; import com.muyu.product.domain.AttributeInfo;
import com.muyu.product.domain.model.AttributeGroupSaveModel; import com.muyu.product.domain.model.AttributeGroupSaveModel;
import com.muyu.product.domain.req.AttributeGroupEditReq; import com.muyu.product.domain.req.AttributeGroupEditReq;
import com.muyu.product.domain.req.AttributeGroupStateReq;
import com.muyu.product.domain.resp.AttributeGroupPageResp; import com.muyu.product.domain.resp.AttributeGroupPageResp;
import com.muyu.product.domain.resp.AttributeGroupUpd; import com.muyu.product.domain.resp.AttributeGroupUpd;
import com.muyu.product.mapper.AsAttributeGroupMapper; import com.muyu.product.mapper.AsAttributeGroupMapper;
@ -43,9 +46,15 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
@Autowired @Autowired
private AttributeInfoService attributeInfoService; private AttributeInfoService attributeInfoService;
/**
*
*/
@Autowired @Autowired
private AsAttributeGroupMapper attributeGroupMapper; private AsAttributeGroupMapper attributeGroupMapper;
@Autowired
private AttributeGroupMapper mapper;
/** /**
* *
* *
@ -88,6 +97,9 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
queryWrapper.eq(AttributeGroup::getStates, attributeGroup.getStates()); queryWrapper.eq(AttributeGroup::getStates, attributeGroup.getStates());
} }
if (ObjUtils.notNull(attributeGroup.getRemark())) {
queryWrapper.eq(AttributeGroup::getRemark, attributeGroup.getRemark());
}
return list(queryWrapper); return list(queryWrapper);
} }
@ -130,6 +142,20 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
} }
} }
/**
*
* @param attributeGroupStateReq
*/
@Override
public void updateState(AttributeGroupStateReq attributeGroupStateReq) {
LambdaQueryWrapper<AttributeGroup> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AttributeGroup ::getId ,attributeGroupStateReq.getId());
AttributeGroup attributeGroup = new AttributeGroup();
attributeGroup.setStates(attributeGroupStateReq.getStates());
mapper.update(attributeGroup,queryWrapper);
}
/** /**
* *
@ -169,4 +195,7 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
attributeInfos attributeInfos
).build();//修改回显时信息 ).build();//修改回显时信息
} }
} }

View File

@ -10,8 +10,13 @@ import com.muyu.product.domain.base.CategoryBase;
import com.muyu.product.domain.model.CategoryInfoSaveModel; import com.muyu.product.domain.model.CategoryInfoSaveModel;
import com.muyu.product.domain.model.TemplateAttributeGroupModel; import com.muyu.product.domain.model.TemplateAttributeGroupModel;
import com.muyu.product.domain.model.TemplateAttributeModel; import com.muyu.product.domain.model.TemplateAttributeModel;
import com.muyu.product.domain.req.CategoryInfoEditReq;
import com.muyu.product.domain.resp.CategoryCommonElementResp; import com.muyu.product.domain.resp.CategoryCommonElementResp;
import com.muyu.product.domain.resp.CategoryInfoUpdResp;
import com.muyu.product.domain.resp.CategoryParentCommonElementResp; import com.muyu.product.domain.resp.CategoryParentCommonElementResp;
import com.muyu.product.mapper.AsCategoryAttributeGroupMapper;
import com.muyu.product.mapper.AsCategoryAttributeMapper;
import com.muyu.product.mapper.AsCategoryBrandMapper;
import com.muyu.product.mapper.CategoryInfoMapper; import com.muyu.product.mapper.CategoryInfoMapper;
import com.muyu.product.service.*; import com.muyu.product.service.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -58,6 +63,14 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
@Autowired @Autowired
private AttributeGroupService attributeGroupService; private AttributeGroupService attributeGroupService;
@Autowired
private AsCategoryAttributeGroupMapper attributeGroupMapper;
@Autowired
private AsCategoryAttributeMapper asCategoryAttributeMapper;
@Autowired
private AsCategoryBrandMapper asCategoryBrandMapper;
/** /**
* *
* *
@ -270,6 +283,84 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
return list; return list;
} }
@Override
public boolean updateUpdById(Long id, CategoryInfoEditReq categoryInfoEditReq) {
LambdaQueryWrapper<CategoryInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CategoryInfo::getId,id);
//修改 品类信息
CategoryInfo info = CategoryInfo.editBuild(id, categoryInfoEditReq);
if (info != null){
//修改 品类中 的 商品属性 attributeIdList
updateAttributeIdList(id, categoryInfoEditReq);
//修改 品类中 的 商品属性组 (attributeGroupIdList)
updateAttributeGroupIdList(id, categoryInfoEditReq);
//修改 品类中 的 商品品牌组 brandIdList
updateAsCategoryBrandMapper(id, categoryInfoEditReq);
return true;
}
return false;
}
/** 获取品类信息详细信息 wyz*/
@Override
public CategoryInfoUpdResp getByIdUpd(Long id) {
LambdaQueryWrapper<CategoryInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CategoryInfo::getId,id);
CategoryInfo byId = this.getById(id);
//查询 品类信息
return CategoryInfoUpdResp.builder()
.id(byId.getId())
.name(byId.getName())
.image(byId.getImage())
.start(byId.getStart())
.introduction(byId.getIntroduction())
.attributeInfoList(attributeGroupMapper.selectAsCategoryAttributeGroupList(id))
.attributeGroupList(attributeGroupMapper.selectAsCategoryAttributeGroupList(id))
.brandInfoList(asCategoryBrandMapper.selectAsCategoryBrandList(id))
.build();
}
/**修改 品类中 的 商品品牌组 brandIdList**/
private void updateAsCategoryBrandMapper(Long id, CategoryInfoEditReq categoryInfoEditReq) {
//修改 品类中 的 商品属性 attributeIdList
/** 删除商品品牌组*/
asCategoryBrandMapper.deleteAsCategoryBrandMapper(id);
//获取 入参中的 商品品牌组 id 集合
List<Long> list = categoryInfoEditReq.getBrandIdList();
for (Long aLong : list) {
//添加 品类 商品品牌组 中间 表
asCategoryBrandMapper.addAsCategoryBrandMapper(id,aLong);
}
}
/**修改 品类中 的 商品属性 attributeIdList**/
private void updateAttributeIdList(Long id, CategoryInfoEditReq categoryInfoEditReq) {
//修改 品类中 的 商品属性 attributeIdList
/** 删除属性*/
asCategoryAttributeMapper.deleteAsCategoryAttribute(id);
//获取 入参中的 属性 id 集合
List<Long> list = categoryInfoEditReq.getAttributeIdList();
for (Long aLong : list) {
//添加 品类 属性 中间 表
asCategoryAttributeMapper.addAsCategoryAttribute(id,aLong);
}
}
/**修改 品类中 的 商品属性组 updateAttributeGroupIdList**/
private void updateAttributeGroupIdList(Long id, CategoryInfoEditReq categoryInfoEditReq) {
/** 删除 属性组*/
attributeGroupMapper.deleteAsCategoryAttributeGroup(id);
/** 添加 属性组*/
List<Long> list = categoryInfoEditReq.getAttributeGroupIdList();
for (Long aLong : list) {
attributeGroupMapper.addAsCategoryAttributeGroup(id,aLong);
}
}
/** /**
* ID * ID
* *

View File

@ -3,7 +3,14 @@ package com.muyu.product.service.impl;
import java.util.List; import java.util.List;
import com.muyu.common.core.utils.ObjUtils; import com.muyu.common.core.utils.ObjUtils;
import com.muyu.product.domain.AttributeGroup;
import com.muyu.product.domain.RuleInfo;
import com.muyu.product.domain.req.AttributeGroupStateReq;
import com.muyu.product.domain.req.RuleInfoSaveReq;
import com.muyu.product.domain.req.WyzRuleInfoSaveReq;
import com.muyu.product.mapper.RuleInfoMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.muyu.product.mapper.RuleAttrInfoMapper; import com.muyu.product.mapper.RuleAttrInfoMapper;
import com.muyu.product.domain.RuleAttrInfo; import com.muyu.product.domain.RuleAttrInfo;
@ -21,6 +28,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@Service @Service
public class RuleAttrInfoServiceImpl extends ServiceImpl<RuleAttrInfoMapper, RuleAttrInfo> implements RuleAttrInfoService { public class RuleAttrInfoServiceImpl extends ServiceImpl<RuleAttrInfoMapper, RuleAttrInfo> implements RuleAttrInfoService {
@Autowired
private RuleInfoMapper ruleInfoMapper;
/** /**
* *
* *
@ -64,4 +73,20 @@ public class RuleAttrInfoServiceImpl extends ServiceImpl<RuleAttrInfoMapper, Rul
queryWrapper.eq(RuleAttrInfo::getRuleId, ruleId); queryWrapper.eq(RuleAttrInfo::getRuleId, ruleId);
return this.list(queryWrapper); return this.list(queryWrapper);
} }
/**
* wyz
* @param wyzRuleInfoSaveReq
*/
@Override
public void updateSaveById(WyzRuleInfoSaveReq wyzRuleInfoSaveReq) {
LambdaQueryWrapper<RuleInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(RuleInfo ::getId ,wyzRuleInfoSaveReq.getId());
RuleInfo ruleInfo = new RuleInfo();
ruleInfo.setStatus(wyzRuleInfoSaveReq.getStatus());
ruleInfoMapper.update(ruleInfo,queryWrapper);
}
} }

View File

@ -53,8 +53,6 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo>
public List<RuleInfo> list(RuleInfo ruleInfo) { public List<RuleInfo> list(RuleInfo ruleInfo) {
LambdaQueryWrapper<RuleInfo> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<RuleInfo> queryWrapper = new LambdaQueryWrapper<>();
if (ObjUtils.notNull(ruleInfo.getName())){ if (ObjUtils.notNull(ruleInfo.getName())){
queryWrapper.like(RuleInfo::getName, ruleInfo.getName()); queryWrapper.like(RuleInfo::getName, ruleInfo.getName());
} }
@ -63,10 +61,6 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo>
queryWrapper.eq(RuleInfo::getStatus, ruleInfo.getStatus()); queryWrapper.eq(RuleInfo::getStatus, ruleInfo.getStatus());
} }
return list(queryWrapper); return list(queryWrapper);
} }
@ -137,6 +131,7 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo>
} }
/** /**
* wyz * wyz
* @return * @return

View File

@ -18,4 +18,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectAsCategoryAttributeGroupVo"> <sql id="selectAsCategoryAttributeGroupVo">
select id, category_id, attribute_group_id, remark, create_by, create_time, update_by, update_time from as_category_attribute_group select id, category_id, attribute_group_id, remark, create_by, create_time, update_by, update_time from as_category_attribute_group
</sql> </sql>
<delete id="deleteAsCategoryAttributeGroup">
delete from `as_category_attribute_group` where category_id=#{id}
</delete>
<select id="selectAsCategoryAttributeGroupList" resultType="java.lang.Long">
select attribute_group_id from `as_category_attribute_group` where category_id=#{id}
</select>
<insert id="addAsCategoryAttributeGroup">
INSERT INTO `as_category_attribute_group` (`id`, `category_id`, `attribute_group_id`, `remark`,
`create_by`, `create_time`, `update_by`, `update_time`)
VALUES (0, #{categoryId}, #{attributeGroupId}, NULL, NULL, NULL, NULL, NULL);
</insert>
</mapper> </mapper>

View File

@ -16,6 +16,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectAsCategoryAttributeVo"> <sql id="selectAsCategoryAttributeVo">
select id, category_id, attribute_id, remark, create_by, create_time, update_by, update_time from as_category_attribute select id,
category_id,
attribute_id,
remark,
create_by,
create_time,
update_by,
update_time
from as_category_attribute
</sql> </sql>
<insert id="addAsCategoryAttribute">
INSERT INTO `as_category_attribute` (`id`, `category_id`, `attribute_id`, `remark`, `create_by`,
`create_time`, `update_by`, `update_time`)
VALUES (0, #{categoryId}, #{attributeId}, NULL, NULL, NULL, NULL, NULL);
</insert>
<delete id="deleteAsCategoryAttribute">
delete
from `as_category_attribute`
where category_id = #{id}
</delete>
<select id="selectAsCategoryAttributeList" resultType="java.lang.Long">
select attribute_id from `as_category_attribute` where category_id=#{id}
</select>
</mapper> </mapper>

View File

@ -19,6 +19,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectCategoryInfoVo"> <sql id="selectCategoryInfoVo">
select id, name, image, parent_id, start, introduction, remark, create_by, create_time, update_by, update_time from category_info select id,
name,
image,
parent_id,
start,
introduction,
remark,
create_by,
create_time,
update_by,
update_time
from category_info
</sql> </sql>
<update id="updateCategoryInfo">
UPDATE `category_info`
SET `name` = #{name},
`image` = #{image},
`parent_id` = #{parentId},
`start` = #{start},
`introduction` = #{introduction},
`remark` = #{remark},
`create_by` = #{createBy},
`create_time` = #{createTime},
`update_by` = #{updateBy},
`update_time` = #{updateTime}
WHERE `id` = #{id};
</update>
</mapper> </mapper>