When I use the statemant, there is always a problem,
Parameter 'item' not found.
And this is my sql statemant:
<select id="getTest" resultType="java.util.HashMap" parameterType="java.util.List">
<![CDATA[
SELECT COUNT(*) AS commentCount, WORK_ID AS workId FROM TB_COMMENT WHERE TB_COMMENT.WORK_ID IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
GROUP BY TB_COMMENT.WORK_ID
]]>
</select>
And this is my java statemant:
@MapKey("workId")
public Map<Integer, String> getTest(List<Integer> workIds)throws DataAccessException;
The implement:
@Resource
private StatusMapper statusMapper;
List<Integer> list = new ArrayList<>();
for (WorkModel i : pictures)
if(!TextUtils.isEmpty(i.getUserId()))
list.add(Integer.parseInt(i.getUserId()));
Map<Integer,String> tset = statusMapper.getTest(list);
Any help is hopful, thanks.
OK, It seems that in , the dynamic sql can't parse, and I remove them, it works. Thanks people who spends time here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.