DailyBillMapper.xml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.newfeifan.mall.module.distri.dal.mysql.dailybill.DailyBillMapper">
  4. <!--
  5. 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  6. 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  7. 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  8. 文档可见:https://www.zhongxing.cn/MyBatis/x-plugins/
  9. -->
  10. <resultMap id="MerchantDTOResultMap" type="cn.newfeifan.mall.module.distri.service.dailybill.dto.MerchantDTO">
  11. <id property="merchantId" column="merchantId" />
  12. <collection property="shopIds" ofType="long" column="merchantId" select="selectShopIdsByMerchantId" />
  13. </resultMap>
  14. <update id="updateOrderItemByOrderId">
  15. update trade_order_item set computation_bill = 1 where order_id in
  16. <foreach collection="orderIds" item="orderId" open="(" close=")" separator=",">
  17. #{orderId}
  18. </foreach>
  19. </update>
  20. <select id="getMerchantDTO" resultMap="MerchantDTOResultMap">
  21. SELECT id AS merchantId FROM sale_merchant
  22. </select>
  23. <select id="selectShopIdsByMerchantId" resultType="long">
  24. SELECT id FROM sale_shop WHERE merchant_id = #{merchantId}
  25. </select>
  26. <select id="getOrderDetails"
  27. resultType="cn.newfeifan.mall.module.distri.service.dailybill.dto.OrderDTO">
  28. select o.id,o.no,o.product_count,o.delivery_price,o.pay_price,o.refund_status,o.refund_price,o.pay_integral,o.refund_integral,o.shop_id,o.merchant_id,
  29. o.pay_rmb,o.create_time from trade_order o
  30. join trade_order_item item on item.order_id = o.id
  31. where pay_status = 1 and date(o.create_time) &lt; date(now()) and item.computation_bill = 0
  32. </select>
  33. <select id="getMerchantName" resultType="java.lang.String">
  34. select name from sale_merchant where id = #{merchantId}
  35. </select>
  36. <select id="getShopName" resultType="java.lang.String">
  37. select name from sale_shop where id = #{shopId}
  38. </select>
  39. </mapper>