mybatis-plus连表分页查
2021-07-22 本文已影响0人
Raral
List<AppDisease> appDiseases = appDiseaseMapper.selectDieaseList(bo.getPageStart(),bo.getPageSize(),bo);
public interface AppDiseaseMapper extends BaseMapper<AppDisease> {
public List<AppDisease> selectDieaseList(@Param("pageStart") Integer pageStart,@Param("pageSize") Integer pageSize, @Param("bo") AppDiseaseQueryBo bo);
}
<select id="selectDieaseList" parameterType="com.ruoyi.system.bo.AppDiseaseQueryBo" resultType="com.ruoyi.system.domain.AppDisease">
select * from app_disease WHERE 1 = 1
limit #{pageStart},#{pageSize}
</select>
···java
<select id="selectCouponListByIno" resultType="com.gzsz.shop.api.shop.bean.ShopPool">
select a.*,b.cost_amount,b.model_code as counType,
d.face_log as goods_pic, d.is_super,d.s_cycle_times,d.s_cycle,d.s_times, d.sty_bg_url_l,d.sty_bg_url_m,d.sty_bg_url_s
from
(
select
<include refid="base_shop_pool"/>
from t_cs_shop_coupon t
<where>
status = 1 and stock > 0 and pool_code != 3
<if test="couponIno != null and couponIno != ''">
and coupon_ino = #{couponIno}
</if>
<if test="poolCode != null">
and pool_code = #{poolCode}
</if>
<if test="searchParam != null and searchParam != ''">
and coupon_name like concat('%',#{searchParam},'%')
</if>
<if test="couponAtno != null and couponAtno != ''">
and coupon_atno = #{couponAtno}
</if>
</where>
<choose>
<when test="sortField == 1 and sort == 0 ">
order by create_time asc
</when>
<when test="sortField == 1 and sort == 1 ">
order by create_time desc
</when>
<when test="sortField == 3 and sort == 0 ">
order by sale_price asc
</when>
<when test="sortField == 3 and sort == 1 ">
order by sale_price desc
</when>
<when test="sortField == 2 and sort == 0 ">
order by initial_num - stock asc
</when>
<when test="sortField == 2 and sort == 1 ">
order by initial_num - stock desc
</when>
<otherwise>
order by create_time desc
</otherwise>
</choose>
<if test="pageStart != null and size != null">
LIMIT #{pageStart}, #{size}
</if>
) a
left join t_cs_act_acctype b on b.atno = a.coupon_atno
left join t_cs_act_acctype_ext d on d.atno = b.atno
<if test="sortField == 1 and sort == 0 ">
order by create_time asc
</if>
<if test="sortField == 1 and sort == 1 ">
order by create_time desc
</if>
<if test="sortField == 3 and sort == 0 ">
order by sale_price asc
</if>
<if test="sortField == 3 and sort == 1 ">
order by sale_price desc
</if>
<if test="sortField == 2 and sort == 0 ">
order by initial_num - stock asc
</if>
<if test="sortField == 2 and sort == 1 ">
order by initial_num - stock desc
</if>
</select>