service层
List channelList =adChannelMapper.findByNameAndPage(dto.getPage(), dto.getSize(), dto.getChannel());
mapper层
public List findByNameAndPage(int page,int size, String channel);
sql
<mapper namespace="com.heima.apis.admin.mapper.AdChannelMapper">
<select id="findByNameAndPage" resultType="com.heima.model.admin.pojos.AdChannel">
select* from ad_channel where name like CONCAT('%',#{channel},'%') limit #{page},#{size}
</select>
</mapper>
必须添加这个CONCAT('%',#{channel},'%'),不然查不出。
网友评论