SysLogininforMapper.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zd.system.mapper.SysLogininforMapper">
  6. <resultMap type="com.zd.system.api.domain.SysLogininfor" id="SysLogininforResult">
  7. <id property="infoId" column="info_id"/>
  8. <result property="userName" column="user_name"/>
  9. <result property="status" column="status"/>
  10. <result property="ipaddr" column="ipaddr"/>
  11. <result property="msg" column="msg"/>
  12. <result property="accessTime" column="access_time"/>
  13. </resultMap>
  14. <insert id="insertLogininfor" parameterType="com.zd.system.api.domain.SysLogininfor">
  15. insert into sys_logininfor (user_name, status, ipaddr, msg, access_time,
  16. user_id,dept_id )
  17. values (#{userName}, #{status}, #{ipaddr}, #{msg}, sysdate(),
  18. #{userId}, #{deptId} )
  19. </insert>
  20. <select id="selectLogininforList" parameterType="com.zd.system.api.domain.SysLogininfor"
  21. resultMap="SysLogininforResult">
  22. select info_id, user_name, ipaddr, status, msg, access_time from sys_logininfor t
  23. <where>
  24. <if test="ipaddr != null and ipaddr != ''">
  25. AND ipaddr like concat('%', #{ipaddr}, '%')
  26. </if>
  27. <if test="status != null and status != ''">
  28. AND status = #{status}
  29. </if>
  30. <if test="userName != null and userName != ''">
  31. AND user_name like concat('%', #{userName}, '%')
  32. </if>
  33. <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
  34. and date_format(access_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
  35. </if>
  36. <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
  37. and date_format(access_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
  38. </if>
  39. <if test="searchValue != null and searchValue != ''">
  40. and (
  41. ipaddr like concat('%', #{searchValue}, '%') or
  42. user_name like concat('%', #{searchValue}, '%')
  43. )
  44. </if>
  45. <!-- 数据范围过滤 -->
  46. ${params.dataScope}
  47. </where>
  48. order by info_id desc
  49. </select>
  50. <delete id="deleteLogininforByIds" >
  51. delete from sys_logininfor where info_id in
  52. <foreach collection="array" item="infoId" open="(" separator="," close=")">
  53. #{infoId}
  54. </foreach>
  55. </delete>
  56. <update id="cleanLogininfor">
  57. truncate table sys_logininfor
  58. </update>
  59. </mapper>