fix: 修复ServiceImpl编译错误,改用普通实现类
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
package com.example.building.service;
|
||||
|
||||
import com.example.building.entity.CategoryAttribute;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 种类属性服务接口
|
||||
*/
|
||||
public interface CategoryAttributeService extends IService<CategoryAttribute> {
|
||||
public interface CategoryAttributeService {
|
||||
|
||||
/**
|
||||
* 获取种类的所有属性
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.example.building.service;
|
||||
|
||||
import com.example.building.entity.ProductAttribute;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 商品属性服务接口
|
||||
*/
|
||||
public interface ProductAttributeService extends IService<ProductAttribute> {
|
||||
public interface ProductAttributeService {
|
||||
|
||||
/**
|
||||
* 获取商品的属性值
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.example.building.service.impl;
|
||||
|
||||
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.mapper.CategoryAttributeMapper;
|
||||
import com.example.building.service.CategoryAttributeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -17,9 +17,12 @@ import java.util.UUID;
|
||||
@Service
|
||||
public class CategoryAttributeServiceImpl implements CategoryAttributeService {
|
||||
|
||||
@Autowired
|
||||
private CategoryAttributeMapper categoryAttributeMapper;
|
||||
|
||||
@Override
|
||||
public List<CategoryAttribute> getByCategoryId(String categoryId) {
|
||||
return this.list(new LambdaQueryWrapper<CategoryAttribute>()
|
||||
return categoryAttributeMapper.selectList(new LambdaQueryWrapper<CategoryAttribute>()
|
||||
.eq(CategoryAttribute::getCategoryId, categoryId)
|
||||
.orderByAsc(CategoryAttribute::getSortOrder));
|
||||
}
|
||||
@@ -28,7 +31,7 @@ public class CategoryAttributeServiceImpl implements CategoryAttributeService {
|
||||
@Transactional
|
||||
public void saveAttributes(String categoryId, List<CategoryAttribute> attrs) {
|
||||
// 删除旧属性
|
||||
this.remove(new LambdaQueryWrapper<CategoryAttribute>()
|
||||
categoryAttributeMapper.delete(new LambdaQueryWrapper<CategoryAttribute>()
|
||||
.eq(CategoryAttribute::getCategoryId, categoryId));
|
||||
|
||||
// 保存新属性
|
||||
@@ -38,7 +41,7 @@ public class CategoryAttributeServiceImpl implements CategoryAttributeService {
|
||||
attr.setAttrId(UUID.randomUUID().toString());
|
||||
attr.setCategoryId(categoryId);
|
||||
attr.setSortOrder(i);
|
||||
this.save(attr);
|
||||
categoryAttributeMapper.insert(attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,7 +49,7 @@ public class CategoryAttributeServiceImpl implements CategoryAttributeService {
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteByCategoryId(String categoryId) {
|
||||
this.remove(new LambdaQueryWrapper<CategoryAttribute>()
|
||||
categoryAttributeMapper.delete(new LambdaQueryWrapper<CategoryAttribute>()
|
||||
.eq(CategoryAttribute::getCategoryId, categoryId));
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.example.building.service.impl;
|
||||
|
||||
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.mapper.ProductAttributeMapper;
|
||||
import com.example.building.service.ProductAttributeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -18,9 +18,12 @@ import java.util.UUID;
|
||||
@Service
|
||||
public class ProductAttributeServiceImpl implements ProductAttributeService {
|
||||
|
||||
@Autowired
|
||||
private ProductAttributeMapper productAttributeMapper;
|
||||
|
||||
@Override
|
||||
public List<ProductAttribute> getByProductId(String productId) {
|
||||
return this.list(new LambdaQueryWrapper<ProductAttribute>()
|
||||
return productAttributeMapper.selectList(new LambdaQueryWrapper<ProductAttribute>()
|
||||
.eq(ProductAttribute::getProductId, productId));
|
||||
}
|
||||
|
||||
@@ -28,7 +31,7 @@ public class ProductAttributeServiceImpl implements ProductAttributeService {
|
||||
@Transactional
|
||||
public void saveProductAttributes(String productId, List<Map<String, Object>> attrs) {
|
||||
// 删除旧属性
|
||||
this.remove(new LambdaQueryWrapper<ProductAttribute>()
|
||||
productAttributeMapper.delete(new LambdaQueryWrapper<ProductAttribute>()
|
||||
.eq(ProductAttribute::getProductId, productId));
|
||||
|
||||
// 保存新属性
|
||||
@@ -40,7 +43,7 @@ public class ProductAttributeServiceImpl implements ProductAttributeService {
|
||||
pa.setAttrId((String) attr.get("attrId"));
|
||||
pa.setAttrName((String) attr.get("attrName"));
|
||||
pa.setAttrValue(String.valueOf(attr.get("attrValue")));
|
||||
this.save(pa);
|
||||
productAttributeMapper.insert(pa);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +51,7 @@ public class ProductAttributeServiceImpl implements ProductAttributeService {
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteByProductId(String productId) {
|
||||
this.remove(new LambdaQueryWrapper<ProductAttribute>()
|
||||
productAttributeMapper.delete(new LambdaQueryWrapper<ProductAttribute>()
|
||||
.eq(ProductAttribute::getProductId, productId));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user