master
33442 2024-11-19 00:06:20 +08:00
parent 5fef221d30
commit adf42d9e07
18 changed files with 53 additions and 44 deletions

View File

@ -1,9 +1,8 @@
package com.muyu.product.domain;
import java.util.Date;
import java.util.function.Supplier;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

View File

@ -21,6 +21,8 @@ import java.util.List;
@AllArgsConstructor
public class CategoryParentCommonElementResp {
private Long categoryId;
/**
*
*/

View File

@ -12,6 +12,9 @@ import com.muyu.product.domain.model.CategoryInfoSaveModel;
import com.muyu.product.domain.resp.CategoryCommonElementResp;
import com.muyu.product.domain.resp.CategoryInfoUpdReq;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -47,6 +50,8 @@ public class CategoryInfoController extends BaseController {
@Autowired
private CategoryInfoService categoryInfoService;
/**
*
*/
@ -138,9 +143,7 @@ public class CategoryInfoController extends BaseController {
@GetMapping("/parentCommonElement/{categoryId}")
@ApiOperation("通过品类ID获取父级以上的属性集合")
@ApiImplicitParam(name = "categoryId", value = "categoryId", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class, example = "1")
public Result<CategoryParentCommonElementResp> parentCommonElement(
@PathVariable(value = "categoryId") Long categoryId
) {
public Result<CategoryParentCommonElementResp> parentCommonElement(@PathVariable(value = "categoryId") Long categoryId) {
return Result.success(categoryInfoService.parentCommonElement(categoryId));
}
}

View File

@ -91,6 +91,7 @@ public class ProjectInfoController extends BaseController {
return Result.success(projectInfoService.getById(id));
}
/**
*
*/

View File

@ -40,6 +40,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
@RestController
@RequestMapping("/rule")
public class RuleInfoController extends BaseController {
@Autowired
private RuleInfoService ruleInfoService;

View File

@ -3,6 +3,7 @@ package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsCategoryAttributeGroup;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -13,4 +14,5 @@ import com.muyu.product.domain.AsCategoryAttributeGroup;
public interface AsCategoryAttributeGroupMapper extends BaseMapper<AsCategoryAttributeGroup> {
void addByCategory(@Param("id") Long id, @Param("attributeGroupId") Long attributeGroupId);
}

View File

@ -19,6 +19,5 @@ public interface AsCategoryAttributeGroupService extends IService<AsCategoryAttr
*/
public List<AsCategoryAttributeGroup> list(AsCategoryAttributeGroup asCategoryAttributeGroup);
void addByCategory(Long id, Long attributeGroupId);
}

View File

@ -19,5 +19,5 @@ public interface AsCategoryAttributeService extends IService<AsCategoryAttribute
*/
public List<AsCategoryAttribute> list(AsCategoryAttribute asCategoryAttribute);
void addByCategory(Long id, Long attributeId);
}

View File

@ -18,6 +18,4 @@ public interface AsCategoryBrandService extends IService<AsCategoryBrand> {
* @return
*/
public List<AsCategoryBrand> list(AsCategoryBrand asCategoryBrand);
void addByCategory(Long id, Long brandId);
}

View File

@ -23,10 +23,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@Service
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());
}
return list(queryWrapper);
}
@Override
public void addByCategory(Long id, Long attributeGroupId) {
asAttributeGroupMapper.addByCategory(id,attributeGroupId);
}
}

View File

@ -51,8 +51,5 @@ public class AsCategoryAttributeServiceImpl extends ServiceImpl<AsCategoryAttrib
return list(queryWrapper);
}
@Override
public void addByCategory(Long id, Long attributeId) {
asCategoryAttributeMapper.addByCategory(id,attributeId);
}
}

View File

@ -51,8 +51,4 @@ public class AsCategoryBrandServiceImpl extends ServiceImpl<AsCategoryBrandMappe
return list(queryWrapper);
}
@Override
public void addByCategory(Long id, Long brandId) {
asCategoryBrandMapper.addByCategory(id,brandId);
}
}

View File

@ -130,14 +130,19 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
@Override
public void updAttributeGroupInfo(Long id, AttributeGroupEditReq attributeGroupEditReq) {
asAttributeGroupInfoMapper.delAttributeInfo(id);
List<AttributeInfoSaveReq> attributeLists = attributeGroupEditReq.getAttributeList();
for (AttributeInfoSaveReq attributeList : attributeLists) {
asAttributeGroupInfoMapper.addAttributeInfo(id,attributeList.getId());
// asAttributeGroupInfoMapper.delAttributeInfo(id);
// List<AttributeInfoSaveReq> attributeLists = attributeGroupEditReq.getAttributeList();
// for (AttributeInfoSaveReq attributeList : attributeLists) {
// 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());
});
}
}
}

View File

@ -13,6 +13,9 @@ import com.muyu.product.domain.model.TemplateAttributeModel;
import com.muyu.product.domain.resp.CategoryCommonElementResp;
import com.muyu.product.domain.resp.CategoryInfoUpdReq;
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.service.*;
import lombok.extern.slf4j.Slf4j;
@ -62,6 +65,15 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
@Autowired
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()){
categoryInfoUpdReq.getAttributeInfoList().stream().forEach(attributeId->{
asCategoryAttributeService.addByCategory(id,attributeId);
asCategoryAttributeMapper.addByCategory(id,attributeId);
});
}
if(null!=categoryInfoUpdReq.getBrandInfoList()){
categoryInfoUpdReq.getBrandInfoList().stream().forEach(brandId->{
asCategoryBrandService.addByCategory(id,brandId);
asCategoryBrandMapper.addByCategory(id,brandId);
});
}
if(null!=categoryInfoUpdReq.getAttributeGroupList()){
categoryInfoUpdReq.getAttributeGroupList().stream().forEach(attributeGroupId->{
asCategoryAttributeGroupService.addByCategory(id,attributeGroupId);
asCategoryAttributeGroupMapper.addByCategory(id,attributeGroupId);
});
}
return b;
@ -342,7 +354,7 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
getParentIdListByCateGoryId(cateGoryIdList, cateGoryId);
// 取出和品类相关联的属性组关系 - 中间表
LambdaQueryWrapper<AsCategoryAttributeGroup> asCategoryAttributeGroupLambdaQueryWrapper = new LambdaQueryWrapper<>(){{
in(AsCategoryAttributeGroup::getCategoryId, cateGoryIdList);
in(AsCategoryAttributeGroup::getCategoryId, cateGoryId);
}};
List<AsCategoryAttributeGroup> categoryAttributeGroupList = asCategoryAttributeGroupService.list(asCategoryAttributeGroupLambdaQueryWrapper);
List<TemplateAttributeGroupModel> attributeGroupModelList = categoryAttributeGroupList.stream()

View File

@ -116,8 +116,8 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo>
ruleInfoRespList.forEach(ruleInfoResp -> {
LambdaQueryWrapper<ProjectInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ProjectInfo::getRuleId,ruleInfoResp.getId());
List<ProjectInfo> list1 = projectInfoService.list(lambdaQueryWrapper);
if(!Collections.isEmpty(list1)){
List<ProjectInfo> projectInfoList = projectInfoService.list(lambdaQueryWrapper);
if(!Collections.isEmpty(projectInfoList)){
ruleInfoResp.setFlan(true);
}
});

View File

@ -18,4 +18,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectAsCategoryAttributeGroupVo">
select id, category_id, attribute_group_id, remark, create_by, create_time, update_by, update_time from as_category_attribute_group
</sql>
<insert id="addByCategory">
insert into as_category_attribute_group (category_id, ) values (#{id},#{attributeId})
</insert>
</mapper>

View File

@ -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
</sql>
<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>
</mapper>

View File

@ -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
</sql>
<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>
</mapper>