AccountMapper.xml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.cyksj.mapper.AccountMapper">
  4. <select id="getNumOfUser" resultType="java.lang.Integer">
  5. select distinct u.id from `groups_trips` gt inner join `groups_relation` gr on gr.groups_id = gt.id
  6. inner join `user` u on u.id = gr.user_id
  7. where gt.account_id in
  8. <foreach collection="list" item="item" open="(" separator="," close=")">
  9. #{item}
  10. </foreach>
  11. and gt.status = 'validity'
  12. and u.created_time between #{yesZeroDate} and #{thisZeroDate}
  13. </select>
  14. <select id="getExpiredAccountView" resultType="com.cyksj.model.views.ExpiredAccountDataView">
  15. select gr.id as relationId,
  16. a.title as platform,
  17. a.account,
  18. a.us_account,
  19. a.cn_account,
  20. concat(gdk.spec_val,'¥',cast(gdk.price/100 as decimal(10,2))) as 'type',
  21. gr.user_id,
  22. gr.account as userAccount,
  23. u.headimgurl as img,
  24. u.nickname,
  25. gr.start_time as payTime,
  26. gr.expiry_time,
  27. gr.renew_status,
  28. gr.is_handle
  29. from `account` a left join `groups_trips` gt on gt.account_id = a.id
  30. left join `groups_relation` gr on gr.groups_id = gt.id
  31. left join `goods_don_sku` gdk on gdk.id = gt.sku_id
  32. left join `user` u on gr.user_id = u.id
  33. <where>
  34. <if test="goodsId != null">
  35. a.goods_id = #{goodsId}
  36. </if>
  37. <if test="account != null and account != ''">
  38. and a.account like '%${account}%'
  39. </if>
  40. <if test="renewStatus != null">
  41. and gr.renew_status is ${renewStatus}
  42. </if>
  43. <if test="handleStatus != null">
  44. and gr.is_handle is ${handleStatus}
  45. </if>
  46. <if test="cnAccount != null and cnAccount != ''">
  47. and a.cn_account = #{cnAccount}
  48. </if>
  49. <if test="usAccount != null and usAccount != ''">
  50. and a.us_account = #{usAccount}
  51. </if>
  52. <if test="userId != null">
  53. and gr.user_id = #{userId}
  54. </if>
  55. <if test="startTime != null">
  56. and gr.expiry_time >= #{startTime}
  57. </if>
  58. <if test="endTime != null">
  59. and gr.expiry_time &lt; #{endTime}
  60. </if>
  61. and gr.expiry_time &lt; #{now}
  62. order by expiry_time
  63. </where>
  64. </select>
  65. <select id="getNoAppleOneAccount" resultType="com.cyksj.model.entity.Account">
  66. select a.id,
  67. g.title,
  68. g.id as goodsId
  69. from `account` a inner join `goods_don` g on g.id = a.goods_id
  70. where g.type = 1 and g.title != #{appleOne}
  71. </select>
  72. </mapper>