fuliqi
2024-10-17 8546b3d285af4235a0ef615a0c6e89486ae2c806
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
<?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.ycl.jxkg.mapper.UserEventLogMapper">
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.entity.UserEventLog">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="user_id" jdbcType="INTEGER" property="userId"/>
        <result column="user_name" jdbcType="VARCHAR" property="userName"/>
        <result column="real_name" jdbcType="VARCHAR" property="realName"/>
        <result column="content" jdbcType="VARCHAR" property="content"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , user_id, user_name, real_name, content, create_time
    </sql>
 
 
    <select id="getUserEventLogByUserId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_user_event_log
        where user_id=#{value}
        order by id desc
        limit 10
    </select>
 
    <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.domain.vo.admin.user.UserEventPageRequestVO">
        select
        <include refid="Base_Column_List"/>
        from t_user_event_log
        <where>
            <if test="userId != null">
                and user_id= #{userId}
            </if>
            <if test="userName != null">
                and user_name= #{userName}
            </if>
        </where>
    </select>
 
 
    <select id="selectCountByDate" resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name, COUNT(create_time) as value
        from
            (
            SELECT DATE_FORMAT(create_time, '%Y-%m-%d') as create_time from t_user_event_log
            WHERE create_time between #{startTime} and #{endTime}
            ) a
        GROUP BY create_time
    </select>
 
 
</mapper>