jeecg-boot多表分页列表查询
看效果
代码
//@AutoLog(value = "订单-分页列表查询")
@ApiOperation(value="订单-分页列表查询", notes="订单-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MlOrderTable>> queryPageList(MlOrderTable mlOrderTable,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Page<MlOrderTable> page = new Page<MlOrderTable>(pageNo, pageSize);
QueryWrapper<MlOrderTable> queryWrapper = QueryGenerator.initQueryWrapper(mlOrderTable, req.getParameterMap());
//IPage<MlOrderTable> pageList = mlOrderTableService.page(page, queryWrapper);
IPage<MlOrderTable> pageList = mlOrderTableService.queryPageList(page, mlOrderTable);
return Result.OK(pageList);
}
IPage<MlOrderTable> queryPageList(Page page, MlOrderTable mlOrderTable);
@Override
public IPage<MlOrderTable> queryPageList(Page page, MlOrderTable mlOrderTable) {
return baseMapper.queryPageList(page,mlOrderTable);
}
IPage<MlOrderTable> queryPageList(Page page, @Param("query") MlOrderTable mlOrderTable);
<select id="queryPageList" resultType="org.jeecg.modules.demo.system.entity.MlOrderTable">
select o.id orderId,s.name storeName,p.name productName ,d.quantity
,o.total_amount totalAmount,p.sweetness,p.size,p.temperature,o.type
from ml_order o
left join ml_store s on s.id = o.store_id
left join ml_order_detail d on d.order_id = o.id
left join ml_product p on p.id = d.product_id
<where>
<if test="query.orderId != null and query.orderId != ''">
and o.id = #{query.orderId}
</if>
</where>
order by o.created_at desc
</select>