1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| <?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="com.stylefeng.guns.modular.system.dao.UserMerchantCouponMapper">
|
| <select id="getUserList" resultType="map">
| SELECT
| b.nickName nickName,
| c.`name` companyName,
| b.phone,
| '用户' type
| FROM
| t_user_merchant_coupon a
| LEFT JOIN t_user b ON ( a.userId = b.id AND a.userType = 1 )
| LEFT JOIN t_company c ON b.companyId = c.id
| WHERE
| userType = 1
| AND merchantActivityId = #{id}
| GROUP BY
| a.userId
| UNION ALL
|
| SELECT
| d.`name` nickName,
| e.`name` companyName,
| d.phone,
| '司机' type
| FROM
| t_user_merchant_coupon a
| LEFT JOIN t_driver d ON ( a.userId = d.id AND a.userType = 2 )
| LEFT JOIN t_company e ON d.companyId = e.id
| WHERE
| userType = 2
| AND merchantActivityId = #{id}
| GROUP BY
| a.userId
| </select>
| </mapper>
|
|