地质所 沉降监测网建设项目
zmk
2024-05-15 9e3afc6d0fa514f986d3fea40fa23124e6fb5070
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?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.javaweb.platform.mapper.UserLoginCountMapper">
    
    <resultMap type="UserLoginCount" id="UserLoginCountResult">
        <result property="id"    column="id"    />
        <result property="userName"    column="user_name"    />
        <result property="loginTime"    column="login_time"    />
        <result property="count"    column="count"    />
        <result property="type"    column="type"    />
    </resultMap>
 
    <sql id="selectUserLoginCountVo">
        select id, user_name, login_time, count, type from js_user_login_count
    </sql>
 
    <select id="selectUserLoginCountList" parameterType="UserLoginCount" resultMap="UserLoginCountResult">
        <include refid="selectUserLoginCountVo"/>
        <where>  
            <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
            <if test="loginTime != null "> and DATE_FORMAT(login_time,'%Y-%m-%d') = DATE_FORMAT(#{loginTime},'%Y-%m-%d')</if>
            <!-- <if test="count != null "> and count = #{count}</if> -->
            <if test="type != null  and type != ''"> and type = #{type}</if>
        </where>
        order by login_time desc
    </select>
    
    <select id="selectUserLoginCountById" parameterType="String" resultMap="UserLoginCountResult">
        <include refid="selectUserLoginCountVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertUserLoginCount" parameterType="UserLoginCount">
        insert into js_user_login_count
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">id,</if>
            <if test="userName != null  and userName != ''">user_name,</if>
            <if test="loginTime != null ">login_time,</if>
            <if test="count != null ">count,</if>
            <if test="type != null  and type != ''">type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">#{id},</if>
            <if test="userName != null  and userName != ''">#{userName},</if>
            <if test="loginTime != null ">#{loginTime},</if>
            <if test="count != null ">#{count},</if>
            <if test="type != null  and type != ''">#{type},</if>
         </trim>
    </insert>
 
    <update id="updateUserLoginCount" parameterType="UserLoginCount">
        update js_user_login_count
        <trim prefix="SET" suffixOverrides=",">
            <if test="userName != null  and userName != ''">user_name = #{userName},</if>
            <if test="loginTime != null ">login_time = #{loginTime},</if>
            <if test="count != null ">count = #{count},</if>
            <if test="type != null  and type != ''">type = #{type},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteUserLoginCountById" parameterType="String">
        delete from js_user_login_count where id = #{id}
    </delete>
 
    <delete id="deleteUserLoginCountByIds" parameterType="String">
        delete from js_user_login_count where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>