123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="cn.newfeifan.mall.module.distri.dal.mysql.dailybill.DailyBillMapper">
- <!--
- 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
- 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
- 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
- 文档可见:https://www.zhongxing.cn/MyBatis/x-plugins/
- -->
- <resultMap id="MerchantDTOResultMap" type="cn.newfeifan.mall.module.distri.service.dailybill.dto.MerchantDTO">
- <id property="merchantId" column="merchantId" />
- <collection property="shopIds" ofType="long" column="merchantId" select="selectShopIdsByMerchantId" />
- </resultMap>
- <update id="updateOrderItemByOrderId">
- update trade_order_item set computation_bill = 1 where order_id in
- <foreach collection="orderIds" item="orderId" open="(" close=")" separator=",">
- #{orderId}
- </foreach>
- </update>
- <select id="getMerchantDTO" resultMap="MerchantDTOResultMap">
- SELECT id AS merchantId FROM sale_merchant
- </select>
- <select id="selectShopIdsByMerchantId" resultType="long">
- SELECT id FROM sale_shop WHERE merchant_id = #{merchantId}
- </select>
- <select id="getOrderDetails"
- resultType="cn.newfeifan.mall.module.distri.service.dailybill.dto.OrderDTO">
- 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,
- o.pay_rmb,o.create_time from trade_order o
- join trade_order_item item on item.order_id = o.id
- where pay_status = 1 and date(o.create_time) < date(now()) and item.computation_bill = 0
- </select>
- <select id="getMerchantName" resultType="java.lang.String">
- select name from sale_merchant where id = #{merchantId}
- </select>
- <select id="getShopName" resultType="java.lang.String">
- select name from sale_shop where id = #{shopId}
- </select>
- </mapper>
|