TenantInfoMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.ym.mec.biz.dal.dao.TenantInfoDao">
  4. <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.TenantInfo">
  5. <id column="id_" jdbcType="INTEGER" property="id"/>
  6. <result column="name_" jdbcType="VARCHAR" property="name"/>
  7. <result column="contacts_" jdbcType="VARCHAR" property="contacts"/>
  8. <result column="phone_" jdbcType="VARCHAR" property="phone"/>
  9. <result column="address_" jdbcType="VARCHAR" property="address"/>
  10. <result column="email_" jdbcType="VARCHAR" property="email"/>
  11. <result column="logo_" jdbcType="VARCHAR" property="logo"/>
  12. <result column="customer_service_phone_" jdbcType="VARCHAR" property="customerServicePhone"/>
  13. <result column="remark_" jdbcType="VARCHAR" property="remark"/>
  14. <result column="tsign_code_" jdbcType="VARCHAR" property="tsignCode"/>
  15. <result column="tsign_name_" jdbcType="VARCHAR" property="tsignName"/>
  16. <result column="area_id_" jdbcType="INTEGER" property="areaId"/>
  17. <result column="domain_name_" jdbcType="VARCHAR" property="domainName"/>
  18. <result column="data_source_" jdbcType="VARCHAR" property="dataSource"/>
  19. <result column="pay_state_" jdbcType="INTEGER" property="payState"/>
  20. <result column="state_" jdbcType="INTEGER" property="state"/>
  21. <result column="user_id_" jdbcType="INTEGER" property="userId"/>
  22. <result column="created_by_" jdbcType="INTEGER" property="createdBy"/>
  23. <result column="created_time_" jdbcType="TIMESTAMP" property="createdTime"/>
  24. <result column="updated_by_" jdbcType="INTEGER" property="updatedBy"/>
  25. <result column="updated_time_" jdbcType="TIMESTAMP" property="updatedTime"/>
  26. </resultMap>
  27. <sql id="Base_Column_List">
  28. id_
  29. , name_, contacts_, phone_, address_, email_, logo_, customer_service_phone_, remark_, domain_name_,
  30. data_source_, pay_state_, state_, created_by_, created_time_, updated_by_, updated_time_, tsign_code_, tsign_name_,
  31. area_id_,user_id_
  32. </sql>
  33. <resultMap id="TenantInfoInfoResult" type="com.ym.mec.biz.dal.vo.TenantInfoInfoPageVo">
  34. <!-- 机构基础信息-->
  35. <id column="id_" jdbcType="INTEGER" property="id"/>
  36. <result column="name_" jdbcType="VARCHAR" property="name"/>
  37. <result column="contacts_" jdbcType="VARCHAR" property="contacts"/>
  38. <result column="phone_" jdbcType="VARCHAR" property="phone"/>
  39. <result column="pay_state_" jdbcType="INTEGER" property="payState"/>
  40. <result column="state_" jdbcType="INTEGER" property="state"/>
  41. <result column="real_name_" jdbcType="VARCHAR" property="createdName"/>
  42. <!-- 机构产品信息-->
  43. <result column="serve_name_" jdbcType="VARCHAR" property="serveName"/>
  44. <result column="student_up_limit_" jdbcType="INTEGER" property="studentUpLimit"/>
  45. <result column="expiry_date_" jdbcType="TIMESTAMP" property="expireDate"/>
  46. </resultMap>
  47. <select id="queryPage" parameterType="map" resultMap="TenantInfoInfoResult">
  48. SELECT a.`id_`,
  49. a.`name_`,
  50. a.`contacts_`,
  51. a.`phone_`,
  52. a.`pay_state_`,
  53. a.`state_`,
  54. u.`real_name_`,
  55. c.`name_` AS serve_name_,
  56. d.`student_up_limit_`,
  57. b.`expiry_date_`
  58. FROM tenant_info AS a
  59. LEFT JOIN tenant_product_info AS b ON a.`id_` = b.`tenant_id_`
  60. LEFT JOIN platform_serve AS c ON b.`serve_id_` = c.`id_`
  61. LEFT JOIN platform_serve_detail AS d ON b.`serve_detail_id_` = d.`id_` AND c.`id_` = d.`serve_id_`
  62. LEFT JOIN sys_user AS u ON a.`created_by_` = u.`id_`
  63. <where>
  64. <if test="param.search != null ">
  65. AND (
  66. a.`id_` LIKE CONCAT('%', #{param.search},'%')
  67. OR a.`name_` LIKE CONCAT('%', #{param.search},'%')
  68. OR a.`phone_` LIKE CONCAT('%', #{param.search},'%')
  69. )
  70. </if>
  71. <if test="param.createdName != null ">
  72. AND u.`real_name_` LIKE CONCAT('%', #{param.createdName},'%')
  73. </if>
  74. <if test="param.payState != null ">
  75. AND a.`pay_state_` = #{param.payState}
  76. </if>
  77. <if test="param.state != null ">
  78. AND a.`state_` = #{param.state}
  79. </if>
  80. <if test="param.startDate != null">
  81. AND a.`created_time_` <![CDATA[ >= ]]> #{param.startDate}
  82. </if>
  83. <if test="param.endDate != null ">
  84. AND a.`created_time_` <![CDATA[ <= ]]> #{param.endDate}
  85. </if>
  86. </where>
  87. </select>
  88. <select id="queryTenantInfoProductSumm" resultType="com.ym.mec.biz.dal.entity.TenantProductSumm">
  89. SELECT t.*, ps.name_ as serverName,
  90. tp.pay_date_ as expiryDate,
  91. tp.expiry_date_ as expiryDateEnd,
  92. tp.expiry_count_ as expiryCount,
  93. tp.expiry_unit_ as expiryUnit,
  94. ta.balance_ as balance,
  95. ta.frozen_amount_ as frozenAmount,
  96. psd.student_up_limit_ as studentUpLimit
  97. FROM `tenant_info` t
  98. left join tenant_assets_info ta on ta.tenant_id_ = t.id_
  99. left join tenant_product_info tp on tp.tenant_id_ = t.id_
  100. left join platform_serve ps on tp.serve_id_ = ps.id_
  101. left join platform_serve_detail psd on tp.serve_detail_id_ = psd.id_
  102. where t.id_ = #{tenantId}
  103. </select>
  104. <select id="getOpenTenant" resultType="com.ym.mec.biz.dal.entity.TenantInfo">
  105. SELECT * FROM tenant_info WHERE id_ = #{tenantId} AND state_ = 1
  106. </select>
  107. <select id="queryTenantInfoByOrgan" resultType="com.ym.mec.biz.dal.entity.TenantInfo">
  108. select * from tenant_info
  109. where id_ = (select id_ from organization where tenant_id_ = #{tenantId})
  110. </select>
  111. </mapper>