|
|
@@ -81,19 +81,15 @@ public interface PosFoodMapper extends BaseMapper<PosFood>
|
|
|
*/
|
|
|
@Select("<script>" +
|
|
|
"SELECT id, fl_id, mdid, name, image, price, introduce, recommend, sort, language, stacking_up, to_examine " +
|
|
|
- "FROM (" +
|
|
|
- " SELECT id, fl_id, mdid, name, image, price, introduce, recommend, sort, language, stacking_up, to_examine, " +
|
|
|
- " ROW_NUMBER() OVER (PARTITION BY mdid ORDER BY id DESC) as rn " +
|
|
|
- " FROM pos_food " +
|
|
|
- " WHERE mdid IN " +
|
|
|
- " <foreach collection='storeIds' item='storeId' open='(' separator=',' close=')'>" +
|
|
|
- " #{storeId}" +
|
|
|
- " </foreach>" +
|
|
|
- " AND to_examine = '1' " +
|
|
|
- " AND language = #{language}" +
|
|
|
- ") AS ranked_foods " +
|
|
|
- "WHERE rn <= #{limitPerStore} " +
|
|
|
- "ORDER BY mdid, id DESC" +
|
|
|
+ "FROM pos_food f " +
|
|
|
+ "WHERE f.mdid IN " +
|
|
|
+ "<foreach collection='storeIds' item='storeId' open='(' separator=',' close=')'>" +
|
|
|
+ " #{storeId}" +
|
|
|
+ "</foreach>" +
|
|
|
+ "AND f.to_examine = '1' " +
|
|
|
+ "AND f.language = #{language} " +
|
|
|
+ "AND (SELECT COUNT(*) FROM pos_food f2 WHERE f2.mdid = f.mdid AND f2.id > f.id AND f2.to_examine = '1' AND f2.language = #{language}) < #{limitPerStore} " +
|
|
|
+ "ORDER BY f.mdid, f.id DESC" +
|
|
|
"</script>")
|
|
|
List<PosFood> selectFoodsByStoreIdsWithLimit(@Param("storeIds") List<Long> storeIds,
|
|
|
@Param("language") String language,
|