src/main/java/service/CategoryService.java

(完整代码) 932B

package service;

import mapper.CategoryMapper;
import model.Category;
import model.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class CategoryService implements CategoryInt{

    @Autowired
    CategoryMapper categoryMapper;
    @Override
    public List<Category> listTwoCategory(){
        return categoryMapper.selectTwo();
    }
    @Override
    public Category getCategory(int id){
        return categoryMapper.selectByPrimaryKey(id);
    }
    @Override
    public List<Category> listAll(){
        return categoryMapper.selectAll();
    }
    @Override
    public void delete(int id){
        categoryMapper.deleteByPrimaryKey(id);
    }
    @Override
    public Integer insert(Category category){
        categoryMapper.insert(category);
        return categoryMapper.selectNew(category.getName());
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。