把前几天修改的方法换成了mybatis_puls的方法了

main
wuchang2 2024-11-17 22:03:03 +08:00
parent 64124b2bb2
commit c437b1136a
8 changed files with 42 additions and 21 deletions

View File

@ -145,6 +145,7 @@ public class ProjectInfo extends BaseEntity {
.status(projectInfoEditReq.getStatus())
.ruleId(projectInfoEditReq.getRuleId())
.brandId(projectInfoEditReq.getBrandId())
.remark(projectInfoEditReq.getRemark())
.build();
}

View File

@ -29,5 +29,6 @@ public class RuleInfoUpdRes {
private String status;
private String remark;
private List<RuleAttrAddModel> ruleAttrList;
}

View File

@ -56,4 +56,6 @@ public class ProjectAddModel extends BaseEntity {
/** 品牌 */
@ApiModelProperty(name = "品牌", value = "品牌")
private Long brandId;
private String remark;
}

View File

@ -63,4 +63,6 @@ public class ProjectInfoEditReq extends BaseEntity {
@ApiModelProperty(name = "品牌", value = "品牌")
private Long brandId;
private String remark;
}

View File

@ -74,7 +74,7 @@ public interface CategoryInfoService extends IService<CategoryInfo> {
Boolean updId(Long id, CategoryInfoUpdReq categoryInfoUpdReq);
Result del(Long ids);
Result del(Long id);
CategoryInfoUpdReq getUpdById(Long id);

View File

@ -43,6 +43,9 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
@Autowired
private AttributeInfoService attributeInfoService;
@Autowired
private AttributeGroupMapper attributeGroupMapper;
@Autowired
private AttributeGroupUpdMapper attributeGroupUpdMapper;
@ -140,10 +143,12 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
@Override
public void updAs(Long id, AttributeGroupEditReq attributeGroupEditReq) {
attributeGroupUpdMapper.del(id);
List<AttributeInfoSaveReq> attributeList = attributeGroupEditReq.getAttributeList();
for (AttributeInfoSaveReq attributeInfoSaveReq : attributeList) {
attributeGroupUpdMapper.attriAddGroup(id,attributeInfoSaveReq.getId());
attributeGroupService.remove(new LambdaQueryWrapper<AsAttributeGroup>().eq(AsAttributeGroup::getGroupId,id));
if (null!=attributeGroupEditReq.getAttributeList()){
attributeGroupEditReq.getAttributeList().stream().forEach(attributeInfoSaveReq -> {
attributeGroupUpdMapper.attriAddGroup(id,attributeInfoSaveReq.getId());
});
}
}

View File

@ -291,11 +291,17 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
public Boolean updId(Long id, CategoryInfoUpdReq categoryInfoUpdReq) {
Boolean b = categoryInfoMapper.updById(id, categoryInfoUpdReq);
asCategoryAttributeGroupService.remove(new LambdaQueryWrapper<AsCategoryAttributeGroup>().eq(AsCategoryAttributeGroup::getCategoryId,id));
LambdaQueryWrapper<AsCategoryAttributeGroup> groupServiceLambdaQueryWrapper = new LambdaQueryWrapper<>();
groupServiceLambdaQueryWrapper.eq(AsCategoryAttributeGroup::getCategoryId,id);
asCategoryAttributeGroupService.remove(groupServiceLambdaQueryWrapper);
asCategoryAttributeService.remove(new LambdaQueryWrapper<AsCategoryAttribute>().eq(AsCategoryAttribute::getCategoryId,id));
LambdaQueryWrapper<AsCategoryBrand> asCategoryBrandLambdaQueryWrapper = new LambdaQueryWrapper<>();
asCategoryBrandLambdaQueryWrapper.eq(AsCategoryBrand::getCategoryId,id);
asCategoryBrandService.remove(asCategoryBrandLambdaQueryWrapper);
asCategoryBrandService.remove(new LambdaQueryWrapper<AsCategoryBrand>().eq(AsCategoryBrand::getCategoryId,id));
LambdaQueryWrapper<AsCategoryAttribute> asCategoryAttributeLambdaQueryWrapper = new LambdaQueryWrapper<>();
asCategoryAttributeLambdaQueryWrapper.eq(AsCategoryAttribute::getCategoryId,id);
asCategoryAttributeService.remove(asCategoryAttributeLambdaQueryWrapper);
if (null!=categoryInfoUpdReq.getBrandIdList()){
categoryInfoUpdReq.getBrandIdList().stream().forEach(brandId->{
@ -324,17 +330,17 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
QueryWrapper<CategoryInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("parent_id",ids);
List<CategoryInfo> categoryInfos = categoryInfoMapper.selectList(queryWrapper);
if(0 == categoryInfos.size()){//无子级
if(categoryInfos.size()==0){//长度为0 就是没有子集
//是否有商品关联关系
List<ProjectInfo> list = categoryInfoMapper.selectProjectInfoById(ids); // 商品信息对象 project_info
if(0 == list.size()) {//无商品关联
categoryInfoMapper.delete(new LambdaQueryWrapper<CategoryInfo>().eq(CategoryInfo::getId, ids));
return Result.success("删除成功");
if(list.size()==0) {//商品的列表长度为0 就是没有集合
LambdaQueryWrapper<CategoryInfo> eq = new LambdaQueryWrapper<CategoryInfo>().eq(CategoryInfo::getId, ids);
categoryInfoMapper.delete(eq);
return Result.success("删除...成功了...");
}
return Result.error("有商品关联关系无法删除....");
return Result.error("不能删除不能删除因为有商品....");
}
return Result.error("有子级无法删除.....");
return Result.error("不能删除不能删除有孩子.....");
}
@Override
@ -391,6 +397,7 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
return;
}
CategoryInfo categoryInfo = this.getById(cateGoryId);
parentIdList.add(categoryInfo.getId());
getParentIdListByCateGoryId(parentIdList, categoryInfo.getParentId());
}

View File

@ -149,13 +149,16 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo>
@Override
public void updRuleId(Long id, RuleInfoUpdRes ruleInfoUpdRes) {
ruleInfoUpdMapper.del(id);
List<RuleAttrAddModel> ruleAttrList = ruleInfoUpdRes.getRuleAttrList();
for (RuleAttrAddModel ruleAttrAddModel : ruleAttrList) {
List<String> valueList = ruleAttrAddModel.getValueList();
String join = String.join(",",valueList);
ruleInfoUpdMapper.addRuleInfo(id,ruleAttrAddModel.getName(),join);
ruleAttrInfoService.remove(new LambdaQueryWrapper<RuleAttrInfo>().eq(RuleAttrInfo::getRuleId,id));
if (null!=ruleInfoUpdRes.getRuleAttrList()){
ruleInfoUpdRes.getRuleAttrList().stream().forEach(ruleAttrAddModel -> {
List<String> valueList = ruleAttrAddModel.getValueList();
String join = String.join(",", valueList);
ruleInfoUpdMapper.addRuleInfo(id,ruleAttrAddModel.getName(),join);
});
}
}
}