BusinessOpportunitiesMapper.xml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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.BusinessOpportunitiesDao">
  6. <resultMap type="com.benyun.core.entity.BusinessOpportunitiesClue" id="ClueResult">
  7. <result property="clueId" column="clue_id"/>
  8. <result property="attentionId" column="attention_id"/>
  9. <result property="contact" column="contact"/>
  10. <result property="telephone" column="telephone"/>
  11. <result property="followUpCount" column="follow_up_count"/>
  12. <result property="userId" column="user_id"/>
  13. <result property="createTime" column="create_time"/>
  14. </resultMap>
  15. <update id="updateFollowUpCountByClueIdAndUserId">
  16. UPDATE `bl_business_opportunities_clue`
  17. SET follow_up_count = #{count}
  18. <trim prefix="where" prefixOverrides="and">
  19. <if test="userId != null">
  20. user_id = #{userId}
  21. </if>
  22. and clue_id = #{clueId}
  23. </trim>
  24. </update>
  25. <delete id="deleteByAttentionIdAndUserId">
  26. delete from `bl_business_opportunities_clue`
  27. <trim prefix="where" prefixOverrides="and">
  28. <if test="userId != null">
  29. user_id = #{userId}
  30. </if>
  31. and attention_id = #{attentionId}
  32. </trim>
  33. </delete>
  34. <select id="searchCountByUserId" resultType="java.lang.Integer">
  35. select count(*) from `bl_business_opportunities_clue`
  36. <where>
  37. <if test="userId != null">
  38. user_id = #{userId}
  39. </if>
  40. </where>
  41. </select>
  42. <select id="searchByClueIdOrAttentionIdAndUserId" resultMap="ClueResult">
  43. select * from `bl_business_opportunities_clue`
  44. <trim prefix="where" prefixOverrides="and">
  45. <if test="userId != null">
  46. user_id = #{userId}
  47. </if>
  48. <if test="clueId != null">
  49. and clue_id = #{clueId}
  50. </if>
  51. <if test="attentionId != null">
  52. and attention_id = #{attentionId}
  53. </if>
  54. </trim>
  55. </select>
  56. <select id="searchAllByMulti" resultMap="ClueResult">
  57. select * from `bl_business_opportunities_clue`
  58. <trim prefix="where" prefixOverrides="and">
  59. <if test="userId != null">
  60. user_id = #{userId}
  61. </if>
  62. <if test="text != null">
  63. and (contact like concat('%',#{text},'%')
  64. or telephone like concat('%',#{text},'%'))
  65. </if>
  66. </trim>
  67. </select>
  68. </mapper>