ShopSettlementMapper.xml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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.shopsettlement.ShopSettlementMapper">
  4. <!--
  5. 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  6. 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  7. 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  8. 文档可见:https://www.zhongxing.cn/MyBatis/x-plugins/
  9. -->
  10. <resultMap id="BaseResultMap" type="cn.newfeifan.mall.module.distri.service.dailybill.dto.OrderDTO">
  11. <id column="id" property="id" />
  12. <collection ofType="list" property="items" select="getOrderItem" column="id">
  13. </collection>
  14. </resultMap>
  15. <update id="setOrderItemById">
  16. update trade_order_item
  17. set settlement_time = now()
  18. where id in
  19. <foreach item="ids" collection="ids" open="(" separator="," close=")">
  20. #{ids}
  21. </foreach>
  22. </update>
  23. <select id="getOrderByMerchantIdWithsShopId"
  24. resultMap="BaseResultMap">
  25. select id,no from trade_order
  26. where pay_status = 1
  27. and deleted = 0
  28. and status = 30
  29. and shop_id = #{shopId}
  30. and merchant_id = #{merchantId}
  31. and date(receiving_time) <![CDATA[ <= ]]> DATE_SUB(now(),INTERVAL 7 DAY)
  32. </select>
  33. <select id="getOrderItem" resultType="cn.newfeifan.mall.module.distri.service.dailybill.dto.OrderItemDTO">
  34. select id,order_id,count,price,delivery_price,pay_price,high_precision_price,promotion_fee,cost_price,pay_integral,pay_rmb from trade_order_item
  35. where deleted = 0
  36. and settlement_time is null
  37. and after_sale_status = 0
  38. and order_id = #{id}
  39. </select>
  40. <select id="getShopName" resultType="java.lang.String">
  41. select name from sale_shop where id = #{shopId}
  42. </select>
  43. </mapper>