AttentionPoolMapper.xml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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.benyun.core.dao.AttentionPoolDao">
  6. <resultMap type="com.benyun.core.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. <select id="searchByMulti" resultMap="AttentionPoolResult">
  28. select * from `bl_attention_pool`
  29. <trim prefix="where" prefixOverrides="and">
  30. <if test="userId != null">
  31. user_id = #{userId}
  32. </if>
  33. <if test="text != null">
  34. and (
  35. contact like concat('%',#{text},'%')
  36. or telephone like concat('%',#{text},'%')
  37. or wd_name like concat('%',#{text},'%')
  38. or wd_addr_info like concat('%',#{text},'%')
  39. or brand_name like concat('%',#{text},'%')
  40. )
  41. </if>
  42. </trim>
  43. </select>
  44. <select id="searchCountByUserId" resultType="java.lang.Integer">
  45. select count(*) from `bl_attention_pool`
  46. <where>
  47. <if test="userId != null">
  48. user_id = #{userId}
  49. </if>
  50. </where>
  51. </select>
  52. </mapper>