Pu Zhibing
2025-05-16 4c99ee7028c3fe58a2cd4b8273b22c75c45574fc
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?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.SysRedPacketRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.SysRedPacketRecord">
        <id column="id" property="id" />
        <result column="money" property="money" />
        <result column="insertTime" property="insertTime" />
        <result column="companyId" property="companyId" />
        <result column="name" property="name" />
        <result column="type" property="type" />
        <result column="totalMoney" property="totalMoney" />
        <result column="laveMoney" property="laveMoney" />
        <result column="startMoney" property="startMoney" />
        <result column="endMoney" property="endMoney" />
        <result column="effective" property="effective" />
        <result column="companyType" property="companyType" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, money, insertTime, companyId, name, type, totalMoney, laveMoney, startMoney, endMoney, effective, companyType
    </sql>
    <select id="getList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
        SELECT
        c.id,
        c.money,
        c.insertTime,
        c.companyId,
        c.state,
        c.userId,
        u.nickName,
        u.phone
        FROM
        t_user_red_packet_record c
        LEFT JOIN t_user u ON c.userId = u.id
 
        WHERE 1=1
        <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''">
            and (c.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
        </if>
        <if test="userName != null and userName !=''">
            and u.nickName like CONCAT('%',#{userName},'%')
        </if>
        <if test="userPhone != null and userPhone !=''">
            and u.phone like CONCAT('%',#{userPhone},'%')
        </if>
        <if test="couponActivityId != null">
            and c.redPacketActivityId=#{couponActivityId}
        </if>
        <if test="state != null and state !=''">
            and c.state=#{state}
        </if>
    </select>
 
</mapper>