<?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>
|