mybatis-plus

目录

 

 

 

1.联表查询


 

 

1.联表查询

 

    public IPage<ReceiveOrder> pageList(ReceiveOrderParam params) {
        Page<ReceiveOrder> page = new Page<>(params.getPageNumber(), params.getPageSize());
        receiveOrderMapper.pageList(page, getWrapperLeft(params));
        return page;
    }

    /**
     *  wrod wro
     *  页面分页查询关联detail查询 构建查询条件
     * @param params
     * @return
     */
    public QueryWrapper getWrapperLeft(ReceiveOrderParam params) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.like(StringUtils.isNotEmpty(params.getGoodsOwnerCode()), "wro.goods_owner_code", params.getGoodsOwnerCode());
        queryWrapper.like(StringUtils.isNotEmpty(params.getReceiveOrderNo()), "wro.receive_order_no", params.getReceiveOrderNo());
        queryWrapper.eq(StringUtils.isNotEmpty(params.getType()), "wro.type", params.getType());
        queryWrapper.like(StringUtils.isNotEmpty(params.getStatus()), "wro.status", params.getStatus());
        queryWrapper.like(StringUtils.isNotEmpty(params.getSupplierName()), "wro.supplier_name", params.getSupplierName());
        queryWrapper.like(StringUtils.isNotEmpty(params.getGoodsName()), "wrod.goods_name", params.getGoodsName());
        queryWrapper.like(StringUtils.isNotEmpty(params.getPoNo()), "wro.po_no", params.getPoNo());
        queryWrapper.like(StringUtils.isNotEmpty(params.getPutawayStatus()), "wro.putaway_status", params.getPutawayStatus());
        if (StringUtils.isNotEmpty(params.getCreateTime())) {
            String[] split = params.getCreateTime().split(GaeaConstant.SPLIT);
            queryWrapper.between("wro.create_time", split[0], split[1]);
        }
        if (StringUtils.isNotBlank(params.getOrder())) {
            if (BusinessConstant.ASC.equals(params.getSort())) {
                queryWrapper.orderByAsc("wro." + GaeaUtils.camelToUnderline(params.getOrder()));
            } else {
                queryWrapper.orderByDesc("wro." + GaeaUtils.camelToUnderline(params.getOrder()));
            }
        }
            return queryWrapper;
    }

mapper

    String PAGELIST_SQL = " DISTINCT wro.id,wro.org_code,wro.warehouse_code,wro.receive_order_no,wro.type,wro.status," +
            "wro.goods_owner_code,wro.supplier_code,wro.supplier_name,wro.po_no,wro.putaway_status,wro.enabled," +
            "wro.create_by,wro.create_time,wro.update_by,wro.update_time,wro.version";

    @Select(" SELECT " + PAGELIST_SQL + " FROM wms_receive_order wro"
            + " LEFT JOIN wms_receive_order_detail wrod ON wrod.receive_order_id = wro.id "
            + " ${ew.customSqlSegment}")
    Page<ReceiveOrder> pageList(Page<ReceiveOrder> page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper);

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值