You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

115 lines
4.1 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.iformall.mapper.MallUserActionMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.MallUserAction">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="user_id" jdbcType="BIGINT" property="userId" />
  7. <result column="type" jdbcType="INTEGER" property="type" />
  8. <result column="ip" jdbcType="VARCHAR" property="ip" />
  9. <result column="action_desc" jdbcType="VARCHAR" property="actionDesc" />
  10. <result column="action_time" jdbcType="TIMESTAMP" property="actionTime" />
  11. </resultMap>
  12. <sql id="allColumns">
  13. `id`,`user_id`,`type`,`ip`,`action_desc`,`action_time`
  14. </sql>
  15. <sql id="dynamicWhereConditions">
  16. where 1 = 1
  17. <if test=" null != id ">
  18. and `id` = #{id}
  19. </if>
  20. <if test=" null != userId ">
  21. and `user_id` = #{userId}
  22. </if>
  23. <if test=" null != type ">
  24. and `type` = #{type}
  25. </if>
  26. <if test=" null != ip ">
  27. and `ip` like concat('%', #{ip},'%')
  28. </if>
  29. <if test=" null != actionDesc ">
  30. and `action_desc` like concat('%', #{actionDesc},'%')
  31. </if>
  32. <if test=" null != actionTime ">
  33. and `action_time` = #{actionTime}
  34. </if>
  35. <if test=" null != ids ">
  36. and id in
  37. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  38. #{idItem}
  39. </foreach>
  40. </if>
  41. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  42. </sql>
  43. <select id="findList" parameterType="com.iformall.domain.po.MallUserAction" resultMap="BaseResultMap">
  44. select <include refid="allColumns" />
  45. from mall_user_action
  46. <include refid="dynamicWhereConditions" />
  47. </select>
  48. <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.MallUserActionVo">
  49. <id column="id" jdbcType="BIGINT" property="id" />
  50. <result column="user_id" jdbcType="BIGINT" property="userId" />
  51. <result column="type" jdbcType="INTEGER" property="type" />
  52. <result column="ip" jdbcType="VARCHAR" property="ip" />
  53. <result column="action_desc" jdbcType="VARCHAR" property="actionDesc" />
  54. <result column="action_time" jdbcType="TIMESTAMP" property="actionTime" />
  55. <result column="name" jdbcType="VARCHAR" property="name" />
  56. </resultMap>
  57. <sql id="allVoColumns">
  58. mua.`id`,mua.`user_id`,mua.`type`,mua.`ip`,mua.`action_desc`,mua.`action_time`,mui.`name`
  59. </sql>
  60. <sql id="dynamicVoWhereConditions">
  61. where 1 = 1
  62. <if test=" null != id ">
  63. and mua.`id` = #{id}
  64. </if>
  65. <if test=" null != userId ">
  66. and mua.`user_id` = #{userId}
  67. </if>
  68. <if test=" null != name ">
  69. and mui.`name` like concat('%', #{name},'%')
  70. </if>
  71. <if test=" null != type ">
  72. and mua.`type` = #{type}
  73. </if>
  74. <if test=" null != ip ">
  75. and mua.`ip` like concat('%', #{ip},'%')
  76. </if>
  77. <if test=" null != actionDesc ">
  78. and mua.`action_desc` like concat('%', #{actionDesc},'%')
  79. </if>
  80. <if test=" null != actionTime ">
  81. and mua.`action_time` = #{actionTime}
  82. </if>
  83. <if test=" null != startdate and null!=enddate">
  84. and mua.`action_time` between #{startdate} and #{enddate}
  85. </if>
  86. <if test=" null != ids ">
  87. and mua.id in
  88. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  89. #{idItem}
  90. </foreach>
  91. </if>
  92. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  93. <if test=" null == sortColumns"> order by mua.`action_time` desc, mua.`id` desc </if>
  94. </sql>
  95. <select id="findListVo" parameterType="com.iformall.domain.vo.MallUserActionVo" resultMap="VoBaseResultMap">
  96. select <include refid="allVoColumns" />
  97. from mall_user_action mua
  98. left join mall_user_info mui on mua.user_id = mui.id
  99. <include refid="dynamicVoWhereConditions" />
  100. </select>
  101. </mapper>