@@ -1,9 +1,10 @@
package cn.efunbox.dao;
import java.util.List;
-import java.util.Map;
-import cn.efunbox.model.Recommend;;
+import org.apache.ibatis.annotations.Param;
+
+import cn.efunbox.model.Recommend;
public interface RecommendMapper {
/**
@@ -22,5 +23,5 @@ public interface RecommendMapper {
* 搜索
* @return
*/
- List<Recommend> search(int age, int sex, int limit, int offset);
+ List<Recommend> search(@Param("age") int age, @Param("sex") int sex, @Param("limit") int limit, @Param("offset") int offset);
}
@@ -7,9 +7,9 @@
</select>
<!-- 搜索 -->
- <select id="search" parameterType="map" resultType="Recommend" >
+ <select id="search" resultType="Recommend" >
select * from film_recmd
- where age=#{param1} and sex=#{param2}
- order by score desc limit #{param3} offset #{param4}
+ where age=#{age} and sex=#{sex}
+ order by score desc limit #{limit} offset #{offset}
</mapper>
@@ -1,6 +1,8 @@
package cn.efunbox.service.impl;
+import java.util.HashMap;
+import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -33,5 +35,4 @@ public class RecommendServiceImpl implements IRecommendService {
return recmdMapper.search(age, sex, limit, offset);
-