AttentionPoolMapper.xml 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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.ruoyi.demo.mapper.AttentionPoolDao">
  6. <resultMap type="com.ruoyi.demo.entity.AttentionPool" id="AttentionPoolResult">
  7. <result property="attentionId" column="attention_id"/>
  8. <result property="contact" column="contact"/>
  9. <result property="telephone" column="telephone"/>
  10. <result property="brandId" column="brand_id"/>
  11. <result property="brandName" column="brand_name"/>
  12. <result property="wdId" column="wd_id"/>
  13. <result property="wdName" column="wd_name"/>
  14. <result property="wdAddrInfo" column="wd_addr_info"/>
  15. <result property="userId" column="user_id"/>
  16. <result property="attentionTime" column="attention_time"/>
  17. </resultMap>
  18. <delete id="deleteByAttentionIdAndUserId">
  19. delete from `bl_attention_pool`
  20. <trim prefix="where" prefixOverrides="and">
  21. <if test="userId != null">
  22. user_id = #{userId}
  23. </if>
  24. and attention_id = #{attentionId}
  25. </trim>
  26. </delete>
  27. <delete id="deleteByBrandIdOrWdIdAndUserId">
  28. delete from `bl_attention_pool` where user_id = #{userId}
  29. <if test="brandId != null">
  30. and brand_id = #{brandId} and wd_id = ''
  31. </if>
  32. <if test="wdId != null">
  33. and wd_id = #{wdId}
  34. </if>
  35. </delete>
  36. <select id="searchByMulti" resultMap="AttentionPoolResult">
  37. select * from `bl_attention_pool`
  38. <trim prefix="where" prefixOverrides="and">
  39. <if test="userId != null">
  40. user_id = #{userId}
  41. </if>
  42. <if test="text != null">
  43. and (
  44. contact like concat('%',#{text},'%')
  45. or telephone like concat('%',#{text},'%')
  46. or wd_name like concat('%',#{text},'%')
  47. or wd_addr_info like concat('%',#{text},'%')
  48. or brand_name like concat('%',#{text},'%')
  49. )
  50. </if>
  51. </trim>
  52. order by attention_time desc
  53. </select>
  54. <select id="searchCountByUserId" resultType="java.lang.Integer">
  55. select count(*) from `bl_attention_pool`
  56. <where>
  57. <if test="userId != null">
  58. user_id = #{userId}
  59. </if>
  60. </where>
  61. </select>
  62. <select id="searchByBrandIdOrWdIdAndUserId" resultMap="AttentionPoolResult">
  63. select * from `bl_attention_pool` where user_id = #{userId}
  64. <if test="brandId != null">
  65. and brand_id = #{brandId} and wd_id = ''
  66. </if>
  67. <if test="wdId != null">
  68. and wd_id = #{wdId}
  69. </if>
  70. </select>
  71. <select id="searchByAttentionIdAndUserId" resultMap="AttentionPoolResult">
  72. select * from `bl_attention_pool`
  73. <trim prefix="where" prefixOverrides="and">
  74. <if test="userId != null">
  75. user_id = #{userId}
  76. </if>
  77. and attention_id = #{attentionId}
  78. </trim>
  79. </select>
  80. <select id="selectAllUser" resultType="java.lang.String">
  81. SELECT DISTINCT
  82. user_id
  83. FROM
  84. `bl_attention_pool`;
  85. </select>
  86. <select id="selectCount" resultType="java.lang.Integer">
  87. SELECT
  88. COUNT(*) count
  89. FROM
  90. `bl_attention_pool`
  91. WHERE
  92. user_id = #{userId}
  93. </select>
  94. </mapper>