提交 3c59a887 authored 作者: Whispa's avatar Whispa

commit

上级 476fca2c
......@@ -89,7 +89,7 @@ public class ItemController {
try {
List<TbCfStationItem> list = repository.searchAllItems(name);
List<SearchModel> list = repository.searchAllItems(name);
return new Result<>(list);
}catch (Exception e){
System.out.println(e.getMessage());
......
package com.example.afrishop_v3.models;
public class SearchModel {
private String itemName;
}
package com.example.afrishop_v3.repository;
import com.example.afrishop_v3.models.SearchModel;
import com.example.afrishop_v3.models.TbCfStationItem;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
......@@ -20,8 +21,8 @@ public interface TbCfStationItemRepository extends PagingAndSortingRepository<Tb
Page<TbCfStationItem> getItemsByImageSearch(@Param("tags") String[] tags,@Param("num") Long num, Pageable pageable);
@Query(value = "select a from #{#entityName} a order by a.itemTop desc,a.sort asc,a.createTime desc")
Page<TbCfStationItem> findAllItems(Pageable pageable);
@Query(value = "select a.item_id,a.item_code,a.item_name,a.item_brief,a.item_category,a.item_price,a.discount_price,a.item_url,a.item_img,a.item_tags,a.item_label,a.item_num,a.item_collection_num,a.item_count,a.item_sku,a.item_top,a.supplier,a.platform_code,a.platform_name,a.enable_flag,a.create_time,a.item_categorytwo,a.item_descrition_id,a.sort,a.template from tb_cf_station_item a where a.item_name LIKE CONCAT('%',?1,'%') or MATCH(a.item_name, a.item_brief) AGAINST(CONCAT(?1,'*') IN BOOLEAN MODE) order by a.item_top desc,a.sort asc,a.create_time desc limit 50",nativeQuery = true)
List<TbCfStationItem> searchAllItems(@Param("name") String name);
@Query(value = "select a.item_id,a.item_code,a.item_name as itemName,a.item_brief,a.item_category,a.item_price,a.discount_price,a.item_url,a.item_img,a.item_tags,a.item_label,a.item_num,a.item_collection_num,a.item_count,a.item_sku,a.item_top,a.supplier,a.platform_code,a.platform_name,a.enable_flag,a.create_time,a.item_categorytwo,a.item_descrition_id,a.sort,a.template from tb_cf_station_item a where a.item_name LIKE CONCAT('%',?1,'%') or MATCH(a.item_name, a.item_brief) AGAINST(CONCAT(?1,'*') IN BOOLEAN MODE) order by a.item_top desc,a.sort asc,a.create_time desc limit 50",nativeQuery = true)
List<SearchModel> searchAllItems(@Param("name") String name);
Page<TbCfStationItem> findAllByItemNameContainingOrItemTagsContaining(String itemName, String itemTags, Pageable pageable);
Page<TbCfStationItem> findByItemCategory(String itemName, Pageable pageable);
List<TbCfStationItem> findAllByItemDescritionId(String id);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论