PromoterUserMapper.xml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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.ytpm.dao.PromoterUserMapper">
  4. <insert id="insertPromoter">
  5. insert into yt_platform_user_promoter
  6. (relation_id, platform_user_id, promoter_user_id, ditch_id, app_id, share_rate, start_time, end_time,
  7. operator_id, operator_time)
  8. values (#{promoter.relationId},
  9. #{promoter.platformUserId},
  10. #{promoter.promoterUserId},
  11. #{promoter.ditchId},
  12. #{promoter.appId},
  13. #{promoter.shareRate},
  14. #{promoter.startTime},
  15. #{promoter.endTime},
  16. #{promoter.operatorId},
  17. #{promoter.operatorTime});
  18. </insert>
  19. <update id="updatePromoter">
  20. update yt_platform_user_promoter set
  21. <if test="promoter.platformUserId != null and promoter.platformUserId != ''">
  22. platform_user_id = #{promoter.platformUserId},
  23. </if>
  24. <if test="promoter.promoterUserId != null and promoter.promoterUserId != ''">
  25. promoter_user_id = #{promoter.promoterUserId},
  26. </if>
  27. <if test="promoter.ditchId != null">
  28. ditch_id = #{promoter.ditchId},
  29. </if>
  30. <if test="promoter.appId != null">
  31. app_id = #{promoter.appId},
  32. </if>
  33. <if test="promoter.shareRate != null and promoter.shareRate != ''">
  34. share_rate = #{promoter.shareRate},
  35. </if>
  36. <if test="promoter.endTime != null">
  37. end_time = #{promoter.endTime},
  38. </if>
  39. operator_time = #{promoter.operatorTime}
  40. where relation_id = #{promoter.relationId}
  41. </update>
  42. <select id="selectPromoterByAppId" resultType="com.ytpm.agent.model.YtPlatformUserPromoter">
  43. select relation_id,
  44. platform_user_id,
  45. promoter_user_id,
  46. ditch_id,
  47. app_id,
  48. share_rate,
  49. start_time,
  50. end_time,
  51. operator_id,
  52. operator_time
  53. from yt_platform_user_promoter
  54. where app_id = #{appId}
  55. and (end_time is null or end_time <![CDATA[ <= ]]> current_date())
  56. limit 1
  57. </select>
  58. <select id="selectPromoterByUserId" resultType="com.ytpm.agent.model.YtPlatformUserPromoter">
  59. select relation_id,
  60. platform_user_id,
  61. promoter_user_id,
  62. ditch_id,
  63. app_id,
  64. share_rate,
  65. start_time,
  66. end_time,
  67. operator_id,
  68. operator_time
  69. from yt_platform_user_promoter
  70. where promoter_user_id = #{userId}
  71. and (end_time is null or end_time <![CDATA[ <= ]]> current_date())
  72. order by start_time
  73. </select>
  74. </mapper>