fix: 修复ServiceImpl编译错误,改用普通实现类
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Agent
2026-03-29 14:53:33 +00:00
parent ac599762da
commit fe60e7647b
4 changed files with 18 additions and 14 deletions

View File

@@ -1,13 +1,12 @@
package com.example.building.service; package com.example.building.service;
import com.example.building.entity.CategoryAttribute; import com.example.building.entity.CategoryAttribute;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
/** /**
* 种类属性服务接口 * 种类属性服务接口
*/ */
public interface CategoryAttributeService extends IService<CategoryAttribute> { public interface CategoryAttributeService {
/** /**
* 获取种类的所有属性 * 获取种类的所有属性

View File

@@ -1,14 +1,13 @@
package com.example.building.service; package com.example.building.service;
import com.example.building.entity.ProductAttribute; import com.example.building.entity.ProductAttribute;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 商品属性服务接口 * 商品属性服务接口
*/ */
public interface ProductAttributeService extends IService<ProductAttribute> { public interface ProductAttributeService {
/** /**
* 获取商品的属性值 * 获取商品的属性值

View File

@@ -1,10 +1,10 @@
package com.example.building.service.impl; package com.example.building.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.building.entity.CategoryAttribute; import com.example.building.entity.CategoryAttribute;
import com.example.building.mapper.CategoryAttributeMapper; import com.example.building.mapper.CategoryAttributeMapper;
import com.example.building.service.CategoryAttributeService; import com.example.building.service.CategoryAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -17,9 +17,12 @@ import java.util.UUID;
@Service @Service
public class CategoryAttributeServiceImpl implements CategoryAttributeService { public class CategoryAttributeServiceImpl implements CategoryAttributeService {
@Autowired
private CategoryAttributeMapper categoryAttributeMapper;
@Override @Override
public List<CategoryAttribute> getByCategoryId(String categoryId) { public List<CategoryAttribute> getByCategoryId(String categoryId) {
return this.list(new LambdaQueryWrapper<CategoryAttribute>() return categoryAttributeMapper.selectList(new LambdaQueryWrapper<CategoryAttribute>()
.eq(CategoryAttribute::getCategoryId, categoryId) .eq(CategoryAttribute::getCategoryId, categoryId)
.orderByAsc(CategoryAttribute::getSortOrder)); .orderByAsc(CategoryAttribute::getSortOrder));
} }
@@ -28,7 +31,7 @@ public class CategoryAttributeServiceImpl implements CategoryAttributeService {
@Transactional @Transactional
public void saveAttributes(String categoryId, List<CategoryAttribute> attrs) { public void saveAttributes(String categoryId, List<CategoryAttribute> attrs) {
// 删除旧属性 // 删除旧属性
this.remove(new LambdaQueryWrapper<CategoryAttribute>() categoryAttributeMapper.delete(new LambdaQueryWrapper<CategoryAttribute>()
.eq(CategoryAttribute::getCategoryId, categoryId)); .eq(CategoryAttribute::getCategoryId, categoryId));
// 保存新属性 // 保存新属性
@@ -38,7 +41,7 @@ public class CategoryAttributeServiceImpl implements CategoryAttributeService {
attr.setAttrId(UUID.randomUUID().toString()); attr.setAttrId(UUID.randomUUID().toString());
attr.setCategoryId(categoryId); attr.setCategoryId(categoryId);
attr.setSortOrder(i); attr.setSortOrder(i);
this.save(attr); categoryAttributeMapper.insert(attr);
} }
} }
} }
@@ -46,7 +49,7 @@ public class CategoryAttributeServiceImpl implements CategoryAttributeService {
@Override @Override
@Transactional @Transactional
public void deleteByCategoryId(String categoryId) { public void deleteByCategoryId(String categoryId) {
this.remove(new LambdaQueryWrapper<CategoryAttribute>() categoryAttributeMapper.delete(new LambdaQueryWrapper<CategoryAttribute>()
.eq(CategoryAttribute::getCategoryId, categoryId)); .eq(CategoryAttribute::getCategoryId, categoryId));
} }
} }

View File

@@ -1,10 +1,10 @@
package com.example.building.service.impl; package com.example.building.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.building.entity.ProductAttribute; import com.example.building.entity.ProductAttribute;
import com.example.building.mapper.ProductAttributeMapper; import com.example.building.mapper.ProductAttributeMapper;
import com.example.building.service.ProductAttributeService; import com.example.building.service.ProductAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -18,9 +18,12 @@ import java.util.UUID;
@Service @Service
public class ProductAttributeServiceImpl implements ProductAttributeService { public class ProductAttributeServiceImpl implements ProductAttributeService {
@Autowired
private ProductAttributeMapper productAttributeMapper;
@Override @Override
public List<ProductAttribute> getByProductId(String productId) { public List<ProductAttribute> getByProductId(String productId) {
return this.list(new LambdaQueryWrapper<ProductAttribute>() return productAttributeMapper.selectList(new LambdaQueryWrapper<ProductAttribute>()
.eq(ProductAttribute::getProductId, productId)); .eq(ProductAttribute::getProductId, productId));
} }
@@ -28,7 +31,7 @@ public class ProductAttributeServiceImpl implements ProductAttributeService {
@Transactional @Transactional
public void saveProductAttributes(String productId, List<Map<String, Object>> attrs) { public void saveProductAttributes(String productId, List<Map<String, Object>> attrs) {
// 删除旧属性 // 删除旧属性
this.remove(new LambdaQueryWrapper<ProductAttribute>() productAttributeMapper.delete(new LambdaQueryWrapper<ProductAttribute>()
.eq(ProductAttribute::getProductId, productId)); .eq(ProductAttribute::getProductId, productId));
// 保存新属性 // 保存新属性
@@ -40,7 +43,7 @@ public class ProductAttributeServiceImpl implements ProductAttributeService {
pa.setAttrId((String) attr.get("attrId")); pa.setAttrId((String) attr.get("attrId"));
pa.setAttrName((String) attr.get("attrName")); pa.setAttrName((String) attr.get("attrName"));
pa.setAttrValue(String.valueOf(attr.get("attrValue"))); pa.setAttrValue(String.valueOf(attr.get("attrValue")));
this.save(pa); productAttributeMapper.insert(pa);
} }
} }
} }
@@ -48,7 +51,7 @@ public class ProductAttributeServiceImpl implements ProductAttributeService {
@Override @Override
@Transactional @Transactional
public void deleteByProductId(String productId) { public void deleteByProductId(String productId) {
this.remove(new LambdaQueryWrapper<ProductAttribute>() productAttributeMapper.delete(new LambdaQueryWrapper<ProductAttribute>()
.eq(ProductAttribute::getProductId, productId)); .eq(ProductAttribute::getProductId, productId));
} }
} }