后台服务
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.

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