除暖

关于Mybatis 分页

电脑版发表于:2021/10/25 16:56

方法调用



持久层接口

List<mattersJionDto> queryBuildJoin(@Param("str_rows") String str_rows,@Param("rows") Integer rows,
                                        @Param("pages") Integer pages, @Param("build_Name")String build_Name);

mapper的xml

<!--  在mapper的写法  -->
    <select id="queryBuildJoin" resultType="mattersJionDto">
        select <if test="rows!=null">top ${str_rows} </if> b.build_Name,m.matter_Name,m.matter_Number,m.end_time
        from Builds b join Matters m on b.Id=m.build_id
        <where>
            <if test="build_Name!=null">and b.build_Name=#{build_Name}</if>
            <if test="pages!=null">and b.Id not
                in( select top (#{rows}*(#{pages}-1)) Id from Builds order by Id)
            </if>
        </where>
    </select>


关于TNBLOG
TNBLOG,技术分享。技术交流:群号677373950
ICP备案 :渝ICP备18016597号-1
App store Android
精彩评论
{{item.replyName}}
{{item.content}}
{{item.time}}
{{subpj.replyName}}
@{{subpj.beReplyName}}{{subpj.content}}
{{subpj.time}}
猜你喜欢