feat(oa): 根据订单号查询退换货信息
- 在 GearReturnExchangeBo 中添加 orderId 字段 - 在 GearReturnExchangeMapper 中添加 selectVoPagePlus 方法 - 在 GearReturnExchangeServiceImpl 中实现根据订单号查询退换货信息的逻辑 - 在 GearReturnExchangeVo 中添加与退换货相关的额外字段
This commit is contained in:
@@ -58,5 +58,8 @@ public class GearReturnExchangeBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
//订单id
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
package com.gear.oa.domain.vo;
|
package com.gear.oa.domain.vo;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.gear.common.annotation.ExcelDictFormat;
|
import com.gear.common.annotation.ExcelDictFormat;
|
||||||
import com.gear.common.convert.ExcelDictConvert;
|
import com.gear.common.convert.ExcelDictConvert;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.util.Date;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退换货管理视图对象 gear_return_exchange
|
* 退换货管理视图对象 gear_return_exchange
|
||||||
*
|
*
|
||||||
@@ -37,6 +35,12 @@ public class GearReturnExchangeVo {
|
|||||||
@ExcelProperty(value = "关联订单明细ID")
|
@ExcelProperty(value = "关联订单明细ID")
|
||||||
private Long orderDetailId;
|
private Long orderDetailId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "订单ID")
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户ID
|
* 客户ID
|
||||||
*/
|
*/
|
||||||
@@ -67,5 +71,83 @@ public class GearReturnExchangeVo {
|
|||||||
@ExcelProperty(value = "涉及金额")
|
@ExcelProperty(value = "涉及金额")
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标志(0=正常,1=已删除)
|
||||||
|
*/
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "创建人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "更新人")
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "产品ID")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品编号
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "产品编号")
|
||||||
|
private String productCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "产品名称")
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品分类ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "产品分类ID")
|
||||||
|
private Long categoryId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 明细数量
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "明细数量")
|
||||||
|
private BigDecimal quantity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 明细单位
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "明细单位")
|
||||||
|
private String detailUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 含税单价
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "含税单价")
|
||||||
|
private BigDecimal taxPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无税单价
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "无税单价")
|
||||||
|
private BigDecimal noTaxPrice;
|
||||||
|
//客户名称
|
||||||
|
@ExcelProperty(value = "客户名称")
|
||||||
|
private String customerName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.gear.oa.mapper;
|
package com.gear.oa.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gear.oa.domain.GearReturnExchange;
|
import com.gear.oa.domain.GearReturnExchange;
|
||||||
import com.gear.oa.domain.vo.GearReturnExchangeVo;
|
import com.gear.oa.domain.vo.GearReturnExchangeVo;
|
||||||
import com.gear.common.core.mapper.BaseMapperPlus;
|
import com.gear.common.core.mapper.BaseMapperPlus;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退换货管理Mapper接口
|
* 退换货管理Mapper接口
|
||||||
@@ -12,4 +15,5 @@ import com.gear.common.core.mapper.BaseMapperPlus;
|
|||||||
*/
|
*/
|
||||||
public interface GearReturnExchangeMapper extends BaseMapperPlus<GearReturnExchangeMapper, GearReturnExchange, GearReturnExchangeVo> {
|
public interface GearReturnExchangeMapper extends BaseMapperPlus<GearReturnExchangeMapper, GearReturnExchange, GearReturnExchangeVo> {
|
||||||
|
|
||||||
|
Page<GearReturnExchangeVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<GearReturnExchange> lqw);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gear.oa.service.impl;
|
package com.gear.oa.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.gear.common.utils.StringUtils;
|
import com.gear.common.utils.StringUtils;
|
||||||
import com.gear.common.core.page.TableDataInfo;
|
import com.gear.common.core.page.TableDataInfo;
|
||||||
import com.gear.common.core.domain.PageQuery;
|
import com.gear.common.core.domain.PageQuery;
|
||||||
@@ -44,11 +45,38 @@ public class GearReturnExchangeServiceImpl implements IGearReturnExchangeService
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<GearReturnExchangeVo> queryPageList(GearReturnExchangeBo bo, PageQuery pageQuery) {
|
public TableDataInfo<GearReturnExchangeVo> queryPageList(GearReturnExchangeBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<GearReturnExchange> lqw = buildQueryWrapper(bo);
|
// 首先根据bo.getOrderId查询该订单下的所有明细 然后根据这个明细id查询当前退换货表看看有哪些明细进行了退换货操作
|
||||||
Page<GearReturnExchangeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
// 拿到退换货这些明细的ID去查产品表拿到产品信息
|
||||||
|
QueryWrapper<GearReturnExchange> lqw = buildQueryWrapperPlus(bo);
|
||||||
|
Page<GearReturnExchangeVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private QueryWrapper<GearReturnExchange> buildQueryWrapperPlus(GearReturnExchangeBo bo) {
|
||||||
|
QueryWrapper<GearReturnExchange> queryWrapper = Wrappers.query();
|
||||||
|
|
||||||
|
// 如果传入了订单ID,则查询该订单下的所有退换货记录
|
||||||
|
if (bo.getOrderId() != null) {
|
||||||
|
// 使用子查询方式,根据订单ID查找对应的订单明细ID,再筛选退换货记录
|
||||||
|
queryWrapper.inSql("gre.order_detail_id",
|
||||||
|
"SELECT detail_id FROM gear_order_detail WHERE order_id = " + bo.getOrderId());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 原有的查询条件保持不变
|
||||||
|
queryWrapper.eq(bo.getOrderDetailId() != null, "gre.order_detail_id", bo.getOrderDetailId());
|
||||||
|
queryWrapper.eq(bo.getCustomerId() != null, "gre.customer_id", bo.getCustomerId());
|
||||||
|
queryWrapper.eq(StringUtils.isNotBlank(bo.getType()), "gre.type", bo.getType());
|
||||||
|
queryWrapper.eq(StringUtils.isNotBlank(bo.getReason()), "gre.reason", bo.getReason());
|
||||||
|
queryWrapper.eq(StringUtils.isNotBlank(bo.getStatus()), "gre.status", bo.getStatus());
|
||||||
|
queryWrapper.eq(bo.getAmount() != null, "gre.amount", bo.getAmount());
|
||||||
|
//逻辑删除
|
||||||
|
queryWrapper.eq("gre.del_flag", 0);
|
||||||
|
|
||||||
|
return queryWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询退换货管理列表
|
* 查询退换货管理列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,6 +18,37 @@
|
|||||||
<result property="updateTime" column="update_time"/>
|
<result property="updateTime" column="update_time"/>
|
||||||
<result property="updateBy" column="update_by"/>
|
<result property="updateBy" column="update_by"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
<select id="selectVoPagePlus" resultType="com.gear.oa.domain.vo.GearReturnExchangeVo">
|
||||||
|
SELECT
|
||||||
|
gre.return_exchange_id,
|
||||||
|
gre.order_detail_id,
|
||||||
|
gre.customer_id,
|
||||||
|
gc.name AS customerName,
|
||||||
|
gre.type,
|
||||||
|
gre.reason,
|
||||||
|
gre.status,
|
||||||
|
gre.amount,
|
||||||
|
gre.del_flag,
|
||||||
|
gre.create_time,
|
||||||
|
gre.create_by,
|
||||||
|
gre.update_time,
|
||||||
|
gre.update_by,
|
||||||
|
god.order_id,
|
||||||
|
gp.product_id AS productId,
|
||||||
|
gp.product_code AS productCode,
|
||||||
|
gp.product_name AS productName,
|
||||||
|
gp.category_id AS categoryId,
|
||||||
|
god.quantity AS quantity,
|
||||||
|
god.unit AS detail_unit,
|
||||||
|
god.tax_price AS taxPrice,
|
||||||
|
god.no_tax_price AS noTaxPrice
|
||||||
|
FROM gear_return_exchange gre
|
||||||
|
LEFT JOIN gear_order_detail god ON gre.order_detail_id = god.detail_id
|
||||||
|
LEFT JOIN gear_product gp ON god.product_id = gp.product_id
|
||||||
|
LEFT JOIN gear_customer gc ON gre.customer_id = gc.customer_id
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user