后台服务
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

95 рядки
3.4 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.WxQuestionOneselfUserMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxQuestionOneselfUser">
  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="user_name" jdbcType="VARCHAR" property="userName"/>
  10. <result column="user_sex" jdbcType="TINYINT" property="userSex"/>
  11. <result column="user_phone" jdbcType="VARCHAR" property="userPhone"/>
  12. <result column="question_id" jdbcType="BIGINT" property="questionId"/>
  13. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  14. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  15. </resultMap>
  16. <sql id="allColumns">
  17. `id`,`tenant_id`,`parent_tenant_id`, `user_id`, `user_name`, `user_sex`, `user_phone`, `question_id`,
  18. `create_date`,`update_date`
  19. </sql>
  20. <sql id="dynamicWhereConditions">
  21. where 1 = 1
  22. <if test=" null != id ">
  23. and `id` = #{id}
  24. </if>
  25. <if test=" null != tenantId and '' != tenantId">
  26. and `tenant_id` = #{tenantId}
  27. </if>
  28. <if test=" null != parentTenantId and '' != parentTenantId">
  29. and `parent_tenant_id` = #{parentTenantId}
  30. </if>
  31. <if test=" null != userId ">
  32. and `user_id` = #{userId}
  33. </if>
  34. <if test=" null != userName ">
  35. and `user_name` like concat('%', #{userName},'%')
  36. </if>
  37. <if test=" null != userPhone ">
  38. and `user_phone` like concat('%', #{userPhone},'%')
  39. </if>
  40. <if test=" null != userSex ">
  41. and `user_sex` = #{userSex}
  42. </if>
  43. <if test=" null != questionId ">
  44. and `question_id` = #{questionId}
  45. </if>
  46. <if test=" null != startDate ">
  47. and `create_date` &gt;= #{startDate}
  48. </if>
  49. <if test=" null != endDate ">
  50. and `create_date` &lt;= #{endDate}
  51. </if>
  52. <if test=" null != ids ">
  53. and id in
  54. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  55. #{idItem}
  56. </foreach>
  57. </if>
  58. <if test=" null != sortColumns">order by ${sortColumns}</if>
  59. </sql>
  60. <select id="findList" parameterType="com.iformall.domain.po.WxQuestionOneselfUser" resultMap="BaseResultMap">
  61. select
  62. <include refid="allColumns"/>
  63. from wx_question_oneself_user
  64. <include refid="dynamicWhereConditions"/>
  65. </select>
  66. <select id="countQuestion" parameterType="com.iformall.domain.po.WxQuestionOneselfUser" resultType="java.lang.Integer">
  67. select count(1)
  68. from wx_question_oneself_user
  69. where `user_id` = #{userId}
  70. and `question_id` = #{questionId}
  71. <if test=" null != tenantId and '' != tenantId">
  72. and `tenant_id` = #{tenantId}
  73. </if>
  74. <if test=" null != parentTenantId and '' != parentTenantId">
  75. and `parent_tenant_id` = #{parentTenantId}
  76. </if>
  77. </select>
  78. </mapper>