| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <?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.tuoren.forward.mapper.LogMapper">
- <resultMap id="BaseResultMap" type="com.tuoren.forward.entity.Log">
- <id column="id" jdbcType="VARCHAR" property="id" />
- <result column="ip" jdbcType="VARCHAR" property="ip" />
- <result column="userid" jdbcType="VARCHAR" property="userid" />
- <result column="username" jdbcType="VARCHAR" property="username" />
- <result column="module" jdbcType="VARCHAR" property="module" />
- <result column="operation" jdbcType="VARCHAR" property="operation" />
- <result column="method" jdbcType="VARCHAR" property="method" />
- <result column="status" jdbcType="CHAR" property="status" />
- <result column="url" jdbcType="VARCHAR" property="url" />
- <result column="style" jdbcType="VARCHAR" property="style" />
- <result column="param" jdbcType="VARCHAR" property="param" />
- <result column="body" jdbcType="VARCHAR" property="body" />
- <result column="result" jdbcType="VARCHAR" property="result" />
- <result column="waste" jdbcType="VARCHAR" property="waste" />
- <result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
- </resultMap>
- <sql id="Base_Column_List">
- id, ip, userid, username, module, operation, method, status, url, style, param, body,
- result, waste, createtime
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from log
- where id = #{id,jdbcType=VARCHAR}
- </select>
- <select id="select" parameterType="LogDto" resultType="Log">
- select
- <include refid="Base_Column_List" />
- from log
- <where>
- <if test="username != null and username != ''">
- and username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
- </if>
- <if test="operation != null and operation != ''">
- and operation like CONCAT('%',#{operation,jdbcType=VARCHAR},'%')
- </if>
- <if test="status != null and status != ''">
- and status = #{status,jdbcType=VARCHAR}
- </if>
- <if test="startTime != null">
- and createtime <![CDATA[>=]]> #{startTime,jdbcType=TIMESTAMP}
- </if>
- <if test="endTime != null">
- and createtime <![CDATA[<=]]> #{endTime,jdbcType=TIMESTAMP}
- </if>
- </where>
- <if test="sort != null and sort != ''">
- order by ${sort}
- <if test="order != null "> ${order}</if>
- </if>
- </select>
- <select id="existLoginTodayByUseid" parameterType="java.lang.String" resultType="java.lang.Integer" >
- select 1
- from log
- where operation='登录' and userid=#{userid,jdbcType=VARCHAR}
- and DATEDIFF(current_date(),createtime) =0
- limit 1
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
- delete from log
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- <insert id="insert" parameterType="com.tuoren.forward.entity.Log">
- insert into log (id, ip, userid,
- username, module, operation,
- method, status, url, style,
- param, body, result,
- waste, createtime)
- values (#{id,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, #{userid,jdbcType=VARCHAR},
- #{username,jdbcType=VARCHAR}, #{module,jdbcType=VARCHAR}, #{operation,jdbcType=VARCHAR},
- #{method,jdbcType=VARCHAR}, #{status,jdbcType=CHAR}, #{url,jdbcType=VARCHAR}, #{style,jdbcType=VARCHAR},
- #{param,jdbcType=VARCHAR}, #{body,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR},
- #{waste,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP})
- </insert>
- <insert id="insertSelective" parameterType="com.tuoren.forward.entity.Log">
- insert into log
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="ip != null">
- ip,
- </if>
- <if test="userid != null">
- userid,
- </if>
- <if test="username != null">
- username,
- </if>
- <if test="module != null">
- module,
- </if>
- <if test="operation != null">
- operation,
- </if>
- <if test="method != null">
- method,
- </if>
- <if test="status != null">
- status,
- </if>
- <if test="url != null">
- url,
- </if>
- <if test="style != null">
- style,
- </if>
- <if test="param != null">
- param,
- </if>
- <if test="body != null">
- body,
- </if>
- <if test="result != null">
- result,
- </if>
- <if test="waste != null">
- waste,
- </if>
- <if test="createtime != null">
- createtime,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="ip != null">
- #{ip,jdbcType=VARCHAR},
- </if>
- <if test="userid != null">
- #{userid,jdbcType=VARCHAR},
- </if>
- <if test="username != null">
- #{username,jdbcType=VARCHAR},
- </if>
- <if test="module != null">
- #{module,jdbcType=VARCHAR},
- </if>
- <if test="operation != null">
- #{operation,jdbcType=VARCHAR},
- </if>
- <if test="method != null">
- #{method,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- #{status,jdbcType=CHAR},
- </if>
- <if test="url != null">
- #{url,jdbcType=VARCHAR},
- </if>
- <if test="style != null">
- #{style,jdbcType=VARCHAR},
- </if>
- <if test="param != null">
- #{param,jdbcType=VARCHAR},
- </if>
- <if test="body != null">
- #{body,jdbcType=VARCHAR},
- </if>
- <if test="result != null">
- #{result,jdbcType=VARCHAR},
- </if>
- <if test="waste != null">
- #{waste,jdbcType=VARCHAR},
- </if>
- <if test="createtime != null">
- #{createtime,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.tuoren.forward.entity.Log">
- update log
- <set>
- <if test="ip != null">
- ip = #{ip,jdbcType=VARCHAR},
- </if>
- <if test="userid != null">
- userid = #{userid,jdbcType=VARCHAR},
- </if>
- <if test="username != null">
- username = #{username,jdbcType=VARCHAR},
- </if>
- <if test="module != null">
- module = #{module,jdbcType=VARCHAR},
- </if>
- <if test="operation != null">
- operation = #{operation,jdbcType=VARCHAR},
- </if>
- <if test="method != null">
- method = #{method,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- status = #{status,jdbcType=CHAR},
- </if>
- <if test="url != null">
- url = #{url,jdbcType=VARCHAR},
- </if>
- <if test="style != null">
- style = #{style,jdbcType=VARCHAR},
- </if>
- <if test="param != null">
- param = #{param,jdbcType=VARCHAR},
- </if>
- <if test="body != null">
- body = #{body,jdbcType=VARCHAR},
- </if>
- <if test="result != null">
- result = #{result,jdbcType=VARCHAR},
- </if>
- <if test="waste != null">
- waste = #{waste,jdbcType=VARCHAR},
- </if>
- <if test="createtime != null">
- createtime = #{createtime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.tuoren.forward.entity.Log">
- update log
- set ip = #{ip,jdbcType=VARCHAR},
- userid = #{userid,jdbcType=VARCHAR},
- username = #{username,jdbcType=VARCHAR},
- module = #{module,jdbcType=VARCHAR},
- operation = #{operation,jdbcType=VARCHAR},
- method = #{method,jdbcType=VARCHAR},
- status = #{status,jdbcType=CHAR},
- url = #{url,jdbcType=VARCHAR},
- style = #{style,jdbcType=VARCHAR},
- param = #{param,jdbcType=VARCHAR},
- body = #{body,jdbcType=VARCHAR},
- result = #{result,jdbcType=VARCHAR},
- waste = #{waste,jdbcType=VARCHAR},
- createtime = #{createtime,jdbcType=TIMESTAMP}
- where id = #{id,jdbcType=VARCHAR}
- </update>
- </mapper>
|