按关键字查询,产品使用热度查询,利率高低排序,按类别查询。

master
istars 7 years ago
parent 605b6ac776
commit 6b37f9b170

@ -13,7 +13,7 @@ public interface productMapper {
@Select("select * from product where productName = #{category}") @Select("select * from product where productName = #{category}")
public List<Product> findByCategory(String category); public List<Product> findByCategory(String category);
@Select("select * from product where intrate = #{intrate} order by intrate DESC") @Select("select * from product where intrate = #{intrate} order by intrate ASC")
public List<Product> findByIntrate(float intrate); public List<Product> findByIntrate(float intrate);
@Select("select * from product where productNum = #{productNum}") @Select("select * from product where productNum = #{productNum}")

@ -14,8 +14,8 @@ public interface usageDateMapper {
@Select("select * from usagedate") @Select("select * from usagedate")
public List<UsageDate> select(); public List<UsageDate> select();
@Select("select productNum from usageDate group by productNum order by count(productNum) ASC") @Select("select productNum from usageDate group by productNum order by count(productNum) DESC")
public List<Integer> findByCount(); public List<Integer> selectByCount();
@Insert("insert into usagedate(checkNum, productNum, userNum," + @Insert("insert into usagedate(checkNum, productNum, userNum," +
" bankAccount, bankNum, year, amount, startTime)" + " bankAccount, bankNum, year, amount, startTime)" +

@ -32,7 +32,7 @@ public class ProductSearchServiceImpl implements ProductSearchService {
@Override @Override
public List<Product> findByCount(){ public List<Product> findByCount(){
List<Product> productList = new ArrayList<Product>(); List<Product> productList = new ArrayList<Product>();
List<Integer> listusage = usageDateMapper.findByCount(); List<Integer> listusage = usageDateMapper.selectByCount();
int[] arr = listusage.stream().mapToInt(Integer::valueOf).toArray(); int[] arr = listusage.stream().mapToInt(Integer::valueOf).toArray();
for(int i=0;i<arr.length;i++){ for(int i=0;i<arr.length;i++){
product = productMapper.selectProductByProductNum(arr[i]); product = productMapper.selectProductByProductNum(arr[i]);

Loading…
Cancel
Save