lanan-system/dl-module-base/src/main/resources/mapper/custom/CustomerCouponMapper.xml
2024-09-24 13:30:27 +08:00

33 lines
1.4 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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.iocoder.yudao.module.custom.mapper.CustomerCouponMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="listByCusId" resultType="cn.iocoder.yudao.module.custom.vo.CustomerCouponRespVO">
SELECT
bcc.*,
dmc.`name` AS couponName,
dmc.type AS couponType,
dmc.car_model AS carModel,
dmc.begin_time AS beginTime,
dmc.end_time AS endTime,
dmc.image AS image,
dam.NAME AS activeName
FROM
base_customer_coupon bcc
LEFT JOIN dl_member_coupon dmc ON bcc.coupon_id = dmc.id
AND dmc.deleted = 0
LEFT JOIN dl_active_main dam ON bcc.active_id = dam.id
AND dam.deleted = 0
WHERE
bcc.cus_id = #{cusId}
AND bcc.deleted = 0
AND bcc.is_valid = 1
</select>
</mapper>