master
parent
5fef221d30
commit
adf42d9e07
|
@ -1,9 +1,8 @@
|
||||||
package com.muyu.product.domain;
|
package com.muyu.product.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -21,6 +21,8 @@ import java.util.List;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class CategoryParentCommonElementResp {
|
public class CategoryParentCommonElementResp {
|
||||||
|
|
||||||
|
private Long categoryId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 属性集合
|
* 属性集合
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,6 +12,9 @@ import com.muyu.product.domain.model.CategoryInfoSaveModel;
|
||||||
import com.muyu.product.domain.resp.CategoryCommonElementResp;
|
import com.muyu.product.domain.resp.CategoryCommonElementResp;
|
||||||
import com.muyu.product.domain.resp.CategoryInfoUpdReq;
|
import com.muyu.product.domain.resp.CategoryInfoUpdReq;
|
||||||
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 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;
|
||||||
|
@ -47,6 +50,8 @@ public class CategoryInfoController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private CategoryInfoService categoryInfoService;
|
private CategoryInfoService categoryInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询品类信息列表
|
* 查询品类信息列表
|
||||||
*/
|
*/
|
||||||
|
@ -138,9 +143,7 @@ public class CategoryInfoController extends BaseController {
|
||||||
@GetMapping("/parentCommonElement/{categoryId}")
|
@GetMapping("/parentCommonElement/{categoryId}")
|
||||||
@ApiOperation("通过品类ID获取父级以上的属性集合")
|
@ApiOperation("通过品类ID获取父级以上的属性集合")
|
||||||
@ApiImplicitParam(name = "categoryId", value = "categoryId", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class, example = "1")
|
@ApiImplicitParam(name = "categoryId", value = "categoryId", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class, example = "1")
|
||||||
public Result<CategoryParentCommonElementResp> parentCommonElement(
|
public Result<CategoryParentCommonElementResp> parentCommonElement(@PathVariable(value = "categoryId") Long categoryId) {
|
||||||
@PathVariable(value = "categoryId") Long categoryId
|
|
||||||
) {
|
|
||||||
return Result.success(categoryInfoService.parentCommonElement(categoryId));
|
return Result.success(categoryInfoService.parentCommonElement(categoryId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@ public class ProjectInfoController extends BaseController {
|
||||||
return Result.success(projectInfoService.getById(id));
|
return Result.success(projectInfoService.getById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取商品信息详细信息
|
* 获取商品信息详细信息
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -40,6 +40,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/rule")
|
@RequestMapping("/rule")
|
||||||
public class RuleInfoController extends BaseController {
|
public class RuleInfoController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RuleInfoService ruleInfoService;
|
private RuleInfoService ruleInfoService;
|
||||||
|
|
||||||
|
|
|
@ -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.AsCategoryAttributeGroup;
|
import com.muyu.product.domain.AsCategoryAttributeGroup;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品类属性组中间Mapper接口
|
* 品类属性组中间Mapper接口
|
||||||
|
@ -13,4 +14,5 @@ import com.muyu.product.domain.AsCategoryAttributeGroup;
|
||||||
public interface AsCategoryAttributeGroupMapper extends BaseMapper<AsCategoryAttributeGroup> {
|
public interface AsCategoryAttributeGroupMapper extends BaseMapper<AsCategoryAttributeGroup> {
|
||||||
|
|
||||||
|
|
||||||
|
void addByCategory(@Param("id") Long id, @Param("attributeGroupId") Long attributeGroupId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,5 @@ public interface AsCategoryAttributeGroupService extends IService<AsCategoryAttr
|
||||||
*/
|
*/
|
||||||
public List<AsCategoryAttributeGroup> list(AsCategoryAttributeGroup asCategoryAttributeGroup);
|
public List<AsCategoryAttributeGroup> list(AsCategoryAttributeGroup asCategoryAttributeGroup);
|
||||||
|
|
||||||
void addByCategory(Long id, Long attributeGroupId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,5 +19,5 @@ public interface AsCategoryAttributeService extends IService<AsCategoryAttribute
|
||||||
*/
|
*/
|
||||||
public List<AsCategoryAttribute> list(AsCategoryAttribute asCategoryAttribute);
|
public List<AsCategoryAttribute> list(AsCategoryAttribute asCategoryAttribute);
|
||||||
|
|
||||||
void addByCategory(Long id, Long attributeId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,4 @@ public interface AsCategoryBrandService extends IService<AsCategoryBrand> {
|
||||||
* @return 品类品牌中间集合
|
* @return 品类品牌中间集合
|
||||||
*/
|
*/
|
||||||
public List<AsCategoryBrand> list(AsCategoryBrand asCategoryBrand);
|
public List<AsCategoryBrand> list(AsCategoryBrand asCategoryBrand);
|
||||||
|
|
||||||
void addByCategory(Long id, Long brandId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@Service
|
@Service
|
||||||
public class AsCategoryAttributeGroupServiceImpl extends ServiceImpl<AsCategoryAttributeGroupMapper, AsCategoryAttributeGroup> implements AsCategoryAttributeGroupService {
|
public class AsCategoryAttributeGroupServiceImpl extends ServiceImpl<AsCategoryAttributeGroupMapper, AsCategoryAttributeGroup> implements AsCategoryAttributeGroupService {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AsAttributeGroupMapper asAttributeGroupMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询品类属性组中间列表
|
* 查询品类属性组中间列表
|
||||||
*
|
*
|
||||||
|
@ -46,15 +42,8 @@ public class AsCategoryAttributeGroupServiceImpl extends ServiceImpl<AsCategoryA
|
||||||
queryWrapper.eq(AsCategoryAttributeGroup::getAttributeGroupId, asCategoryAttributeGroup.getAttributeGroupId());
|
queryWrapper.eq(AsCategoryAttributeGroup::getAttributeGroupId, asCategoryAttributeGroup.getAttributeGroupId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return list(queryWrapper);
|
return list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addByCategory(Long id, Long attributeGroupId) {
|
|
||||||
asAttributeGroupMapper.addByCategory(id,attributeGroupId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,5 @@ public class AsCategoryAttributeServiceImpl extends ServiceImpl<AsCategoryAttrib
|
||||||
return list(queryWrapper);
|
return list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addByCategory(Long id, Long attributeId) {
|
|
||||||
asCategoryAttributeMapper.addByCategory(id,attributeId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,4 @@ public class AsCategoryBrandServiceImpl extends ServiceImpl<AsCategoryBrandMappe
|
||||||
return list(queryWrapper);
|
return list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addByCategory(Long id, Long brandId) {
|
|
||||||
asCategoryBrandMapper.addByCategory(id,brandId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,14 +130,19 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updAttributeGroupInfo(Long id, AttributeGroupEditReq attributeGroupEditReq) {
|
public void updAttributeGroupInfo(Long id, AttributeGroupEditReq attributeGroupEditReq) {
|
||||||
asAttributeGroupInfoMapper.delAttributeInfo(id);
|
// asAttributeGroupInfoMapper.delAttributeInfo(id);
|
||||||
List<AttributeInfoSaveReq> attributeLists = attributeGroupEditReq.getAttributeList();
|
// List<AttributeInfoSaveReq> attributeLists = attributeGroupEditReq.getAttributeList();
|
||||||
for (AttributeInfoSaveReq attributeList : attributeLists) {
|
// for (AttributeInfoSaveReq attributeList : attributeLists) {
|
||||||
asAttributeGroupInfoMapper.addAttributeInfo(id,attributeList.getId());
|
// asAttributeGroupInfoMapper.addAttributeInfo(id,attributeList.getId());
|
||||||
|
// }
|
||||||
|
|
||||||
|
asAttributeGroupService.remove(new LambdaQueryWrapper<AsAttributeGroup>().eq(AsAttributeGroup::getAttributeId,id));
|
||||||
|
|
||||||
|
if(null!=attributeGroupEditReq.getAttributeList()){
|
||||||
|
attributeGroupEditReq.getAttributeList().stream().forEach(attributeInfoSaveReq -> {
|
||||||
|
asAttributeGroupInfoMapper.addAttributeInfo(id,attributeInfoSaveReq.getId());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,9 @@ import com.muyu.product.domain.model.TemplateAttributeModel;
|
||||||
import com.muyu.product.domain.resp.CategoryCommonElementResp;
|
import com.muyu.product.domain.resp.CategoryCommonElementResp;
|
||||||
import com.muyu.product.domain.resp.CategoryInfoUpdReq;
|
import com.muyu.product.domain.resp.CategoryInfoUpdReq;
|
||||||
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;
|
||||||
|
@ -62,6 +65,15 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
||||||
@Autowired
|
@Autowired
|
||||||
private AttributeGroupService attributeGroupService;
|
private AttributeGroupService attributeGroupService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AsCategoryAttributeMapper asCategoryAttributeMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AsCategoryBrandMapper asCategoryBrandMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AsCategoryAttributeGroupMapper asCategoryAttributeGroupMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询品类信息列表
|
* 查询品类信息列表
|
||||||
*
|
*
|
||||||
|
@ -288,17 +300,17 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
||||||
|
|
||||||
if(null!=categoryInfoUpdReq.getAttributeInfoList()){
|
if(null!=categoryInfoUpdReq.getAttributeInfoList()){
|
||||||
categoryInfoUpdReq.getAttributeInfoList().stream().forEach(attributeId->{
|
categoryInfoUpdReq.getAttributeInfoList().stream().forEach(attributeId->{
|
||||||
asCategoryAttributeService.addByCategory(id,attributeId);
|
asCategoryAttributeMapper.addByCategory(id,attributeId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(null!=categoryInfoUpdReq.getBrandInfoList()){
|
if(null!=categoryInfoUpdReq.getBrandInfoList()){
|
||||||
categoryInfoUpdReq.getBrandInfoList().stream().forEach(brandId->{
|
categoryInfoUpdReq.getBrandInfoList().stream().forEach(brandId->{
|
||||||
asCategoryBrandService.addByCategory(id,brandId);
|
asCategoryBrandMapper.addByCategory(id,brandId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(null!=categoryInfoUpdReq.getAttributeGroupList()){
|
if(null!=categoryInfoUpdReq.getAttributeGroupList()){
|
||||||
categoryInfoUpdReq.getAttributeGroupList().stream().forEach(attributeGroupId->{
|
categoryInfoUpdReq.getAttributeGroupList().stream().forEach(attributeGroupId->{
|
||||||
asCategoryAttributeGroupService.addByCategory(id,attributeGroupId);
|
asCategoryAttributeGroupMapper.addByCategory(id,attributeGroupId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return b;
|
return b;
|
||||||
|
@ -342,7 +354,7 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
|
||||||
getParentIdListByCateGoryId(cateGoryIdList, cateGoryId);
|
getParentIdListByCateGoryId(cateGoryIdList, cateGoryId);
|
||||||
// 取出和品类相关联的属性组关系 - 中间表
|
// 取出和品类相关联的属性组关系 - 中间表
|
||||||
LambdaQueryWrapper<AsCategoryAttributeGroup> asCategoryAttributeGroupLambdaQueryWrapper = new LambdaQueryWrapper<>(){{
|
LambdaQueryWrapper<AsCategoryAttributeGroup> asCategoryAttributeGroupLambdaQueryWrapper = new LambdaQueryWrapper<>(){{
|
||||||
in(AsCategoryAttributeGroup::getCategoryId, cateGoryIdList);
|
in(AsCategoryAttributeGroup::getCategoryId, cateGoryId);
|
||||||
}};
|
}};
|
||||||
List<AsCategoryAttributeGroup> categoryAttributeGroupList = asCategoryAttributeGroupService.list(asCategoryAttributeGroupLambdaQueryWrapper);
|
List<AsCategoryAttributeGroup> categoryAttributeGroupList = asCategoryAttributeGroupService.list(asCategoryAttributeGroupLambdaQueryWrapper);
|
||||||
List<TemplateAttributeGroupModel> attributeGroupModelList = categoryAttributeGroupList.stream()
|
List<TemplateAttributeGroupModel> attributeGroupModelList = categoryAttributeGroupList.stream()
|
||||||
|
|
|
@ -116,8 +116,8 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo>
|
||||||
ruleInfoRespList.forEach(ruleInfoResp -> {
|
ruleInfoRespList.forEach(ruleInfoResp -> {
|
||||||
LambdaQueryWrapper<ProjectInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ProjectInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(ProjectInfo::getRuleId,ruleInfoResp.getId());
|
lambdaQueryWrapper.eq(ProjectInfo::getRuleId,ruleInfoResp.getId());
|
||||||
List<ProjectInfo> list1 = projectInfoService.list(lambdaQueryWrapper);
|
List<ProjectInfo> projectInfoList = projectInfoService.list(lambdaQueryWrapper);
|
||||||
if(!Collections.isEmpty(list1)){
|
if(!Collections.isEmpty(projectInfoList)){
|
||||||
ruleInfoResp.setFlan(true);
|
ruleInfoResp.setFlan(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,4 +18,9 @@ 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>
|
||||||
|
|
||||||
|
<insert id="addByCategory">
|
||||||
|
insert into as_category_attribute_group (category_id, ) values (#{id},#{attributeId})
|
||||||
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -19,6 +19,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
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="addByCategory">
|
<insert id="addByCategory">
|
||||||
insert into as_category_attribute_group (category_id,attribute_id) values (#{id},#{attributeId})
|
insert into as_category_attribute (category_id,attribute_id) values (#{id},#{attributeId})
|
||||||
</insert>
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -19,6 +19,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select id, category_id, brand_id, remark, create_by, create_time, update_by, update_time from as_category_brand
|
select id, category_id, brand_id, remark, create_by, create_time, update_by, update_time from as_category_brand
|
||||||
</sql>
|
</sql>
|
||||||
<insert id="addByCategory">
|
<insert id="addByCategory">
|
||||||
insert into as_category_attribute_group (category_id,brand_id) values (#{id},#{brandId})
|
insert into brand_info (category_id,brand_id) values (#{id},#{brandId})
|
||||||
</insert>
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue