ServiceTokenMapper.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.diagbot.mapper.ServiceTokenMapper">
  5. <!-- 通用查询映射结果 -->
  6. <resultMap id="BaseResultMap" type="com.diagbot.entity.ServiceToken">
  7. <id column="id" property="id"/>
  8. <result column="is_deleted" property="isDeleted"/>
  9. <result column="gmt_create" property="gmtCreate"/>
  10. <result column="gmt_modified" property="gmtModified"/>
  11. <result column="creator" property="creator"/>
  12. <result column="modifier" property="modifier"/>
  13. <result column="product_service_id" property="productServiceId"/>
  14. <result column="app_key_id" property="appKeyId"/>
  15. <result column="app_key_secret" property="appKeySecret"/>
  16. <result column="type" property="type"/>
  17. <result column="status" property="status"/>
  18. <result column="starting_date" property="startingDate"/>
  19. <result column="expiring_date" property="expiringDate"/>
  20. <result column="remark" property="remark"/>
  21. </resultMap>
  22. <select id="getByAppkeyAndSecret" parameterType="java.util.Map" resultType="com.diagbot.entity.ServiceTokenWithUser">
  23. SELECT a.*, c.user_id user_id FROM `diag_service_token` a, diag_product_service b, diag_service_info c
  24. where a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N'
  25. and a.app_key_id = #{appkey} and a.app_key_secret = #{secret} and a.product_service_id = b.id and b.service_id = c.id
  26. </select>
  27. <select id="getTryTokenCount" parameterType="java.util.Map" resultType="Integer">
  28. SELECT COUNT(a.id) FROM `diag_service_token` a, diag_product_service b, diag_service_info c
  29. where a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N'
  30. and a.product_service_id = b.id and b.service_id = c.id and a.type = 3
  31. and c.user_id = #{userId} and b.product_id = #{productId}
  32. </select>
  33. <select id="getTryTokenByUserIdAndProductId" parameterType="java.util.Map" resultMap="BaseResultMap">
  34. SELECT
  35. a.*
  36. FROM `diag_service_token` a, diag_product_service b, diag_service_info c
  37. where a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N'
  38. and a.product_service_id = b.id and b.service_id = c.id and a.type = 3
  39. and c.user_id = #{userId} and b.product_id = #{productId}
  40. </select>
  41. <select id="getByAppkeyAndSecretAndProduct" parameterType="java.util.Map" resultType="com.diagbot.entity.wrapper.ServiceTokenWrapper">
  42. SELECT
  43. st.*, ps.product_id, lp.service_status, si.user_id
  44. FROM
  45. diag_service_token st,
  46. diag_product_service ps,
  47. diag_service_info si,
  48. diag_lantone_product lp
  49. WHERE
  50. st.product_service_id = ps.id
  51. AND ps.service_id = si.id
  52. AND ps.product_id = lp.id
  53. AND st.is_deleted = 'N'
  54. AND ps.is_deleted = 'N'
  55. AND si.is_deleted = 'N'
  56. AND lp.is_deleted = 'N'
  57. AND ps.product_id = #{productId}
  58. AND st.app_key_id = #{appkey} and st.app_key_secret = #{secret}
  59. </select>
  60. </mapper>