LantoneProductMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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.LantoneProductMapper">
  5. <!-- 通用查询映射结果 -->
  6. <resultMap id="BaseResultMap" type="com.diagbot.entity.LantoneProduct">
  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="name" property="name"/>
  14. <result column="decription" property="decription"/>
  15. <result column="charge_type" property="chargeType"/>
  16. <result column="url" property="url"/>
  17. <result column="service_status" property="serviceStatus"/>
  18. <result column="trial_status" property="trialStatus"/>
  19. <result column="trial_url" property="trialUrl"/>
  20. <result column="access_type" property="accessType"/>
  21. </resultMap>
  22. <!-- 通用查询映射结果 -->
  23. <resultMap id="BaseResultDTOMap" type="com.diagbot.dto.LantoneProductOrgDTO">
  24. <id column="id" property="id"/>
  25. <result column="is_deleted" property="isDeleted"/>
  26. <result column="gmt_create" property="gmtCreate"/>
  27. <result column="gmt_modified" property="gmtModified"/>
  28. <result column="creator" property="creator"/>
  29. <result column="modifier" property="modifier"/>
  30. <result column="name" property="name"/>
  31. <result column="decription" property="decription"/>
  32. <result column="charge_type" property="chargeType"/>
  33. <result column="url" property="url"/>
  34. <result column="service_status" property="serviceStatus"/>
  35. <result column="trial_status" property="trialStatus"/>
  36. <result column="trial_url" property="trialUrl"/>
  37. <result column="access_type" property="accessType"/>
  38. <result column="start_time" property="startTime"/>
  39. <result column="end_time" property="endTime"/>
  40. <result column="opened_service_status" property="openedServiceStatus"/>
  41. <result column="time" property="time"/>
  42. <result column="service_ids" property="serviceIds"/>
  43. </resultMap>
  44. <select id="productLines" resultType="com.diagbot.dto.ProductLineDTO">
  45. SELECT * FROM `diag_lantone_product` WHERE is_deleted = 'N'
  46. </select>
  47. <select id="productLinesB" resultType="com.diagbot.dto.ProductLineDTO">
  48. SELECT * FROM `diag_lantone_product`
  49. </select>
  50. <!--根据产品名称分页查询-->
  51. <select id="selectProduct" resultType="com.diagbot.dto.LantoneProductDTO">
  52. SELECT
  53. p.id,
  54. p.gmt_create,
  55. p.creator,
  56. p.`name`,
  57. p.decription,
  58. p.charge_type,
  59. p.url,
  60. p.service_status,
  61. p.trial_status,
  62. p.trial_url,
  63. p.access_type,
  64. (
  65. SELECT
  66. COUNT(1)
  67. FROM
  68. diag_opened_products o
  69. WHERE
  70. p.id = o.product_id
  71. AND
  72. o.is_deleted ='N'
  73. ) oppended_num
  74. FROM
  75. `diag_lantone_product` p WHERE p.is_deleted ='N'
  76. <if test="name != null and name != ''">
  77. AND p.name LIKE concat ('%',#{name},'%')
  78. </if>
  79. ORDER BY gmt_create DESC
  80. </select>
  81. <select id="opendedProduct" resultMap="BaseResultMap" parameterType="java.util.Map">
  82. SELECT op.id,op.start_time,op.end_time,op.service_status,pod.time,orn.`name`
  83. from `sys-diagbotman`.diag_opened_products op,`sys-diagbotman`.diag_product_order
  84. pod,`sys-user`.sys_user_organization uor,`sys-user`.sys_organization orn
  85. where pod.num = op.order_id AND uor.user_id =op.user_id AND orn.id =uor.organization_id AND
  86. op.product_id =#{map.id}
  87. <if test="map.servicdStatus !=null and map.servicdStatus !=''">
  88. op.service_status =#{map.serviceStatus}
  89. </if>
  90. </select>
  91. <!--根据用户查询已开通产品-->
  92. <select id="opendedProductByUserId" resultMap="BaseResultDTOMap" parameterType="java.lang.Long">
  93. select a.*,b.start_time,b.end_time,b.service_status as opened_service_status,c.time
  94. from diag_lantone_product a,diag_opened_products b,diag_product_order c,diag_order_details d
  95. where a.id=b.product_id and a.id=d.product_id
  96. and c.num=d.order_num
  97. and d.audit_status=1
  98. and a.is_deleted='N' and b.is_deleted='N' and c.is_deleted='N' and d.is_deleted='N'
  99. -- and (find_in_set('2',a.access_type) or FIND_IN_SET('3',a.access_type))
  100. and b.user_id=#{userId} and c.user_id=#{userId} and d.user_id=#{userId}
  101. </select>
  102. <select id="selectProductByName" resultMap="BaseResultMap">
  103. SELECT * FROM `diag_lantone_product` WHERE is_deleted='N' and `name`=#{name}
  104. </select>
  105. </mapper>