You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
953 B

package com.demo.service.impl;
import com.demo.dao.CategoryMapper;
import com.demo.dao.ProductMapper;
import com.demo.pojo.Category;
import com.demo.pojo.CategoryExample;
import com.demo.pojo.Product;
import com.demo.service.ForeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ForeServiceImpl implements ForeService {
@Autowired
private CategoryMapper categoryMapper;
@Autowired
private ProductMapper productMapper;
@Override
public List<Category> listToThree() {
CategoryExample example = new CategoryExample();
example.createCriteria().andIdBetween(1,4); //从1开始计数
List<Category> categories = categoryMapper.selectByExample(example);
return categories;
}
@Override
public List<Product> getFivePro() {
return productMapper.randFive();
}
}