123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ym.mec.biz.dal.dao.TenantInfoDao">
- <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.TenantInfo">
- <id column="id_" jdbcType="INTEGER" property="id"/>
- <result column="name_" jdbcType="VARCHAR" property="name"/>
- <result column="contacts_" jdbcType="VARCHAR" property="contacts"/>
- <result column="phone_" jdbcType="VARCHAR" property="phone"/>
- <result column="address_" jdbcType="VARCHAR" property="address"/>
- <result column="email_" jdbcType="VARCHAR" property="email"/>
- <result column="logo_" jdbcType="VARCHAR" property="logo"/>
- <result column="customer_service_phone_" jdbcType="VARCHAR" property="customerServicePhone"/>
- <result column="remark_" jdbcType="VARCHAR" property="remark"/>
- <result column="tsign_code_" jdbcType="VARCHAR" property="tsignCode"/>
- <result column="tsign_name_" jdbcType="VARCHAR" property="tsignName"/>
- <result column="area_id_" jdbcType="INTEGER" property="areaId"/>
- <result column="domain_name_" jdbcType="VARCHAR" property="domainName"/>
- <result column="data_source_" jdbcType="VARCHAR" property="dataSource"/>
- <result column="pay_state_" jdbcType="INTEGER" property="payState"/>
- <result column="state_" jdbcType="INTEGER" property="state"/>
- <result column="user_id_" jdbcType="INTEGER" property="userId"/>
- <result column="created_by_" jdbcType="INTEGER" property="createdBy"/>
- <result column="created_time_" jdbcType="TIMESTAMP" property="createdTime"/>
- <result column="updated_by_" jdbcType="INTEGER" property="updatedBy"/>
- <result column="updated_time_" jdbcType="TIMESTAMP" property="updatedTime"/>
- </resultMap>
- <sql id="Base_Column_List">
- id_
- , name_, contacts_, phone_, address_, email_, logo_, customer_service_phone_, remark_, domain_name_,
- data_source_, pay_state_, state_, created_by_, created_time_, updated_by_, updated_time_, tsign_code_, tsign_name_,
- area_id_,user_id_
- </sql>
- <resultMap id="TenantInfoInfoResult" type="com.ym.mec.biz.dal.vo.TenantInfoInfoPageVo">
- <!-- 机构基础信息-->
- <id column="id_" jdbcType="INTEGER" property="id"/>
- <result column="name_" jdbcType="VARCHAR" property="name"/>
- <result column="contacts_" jdbcType="VARCHAR" property="contacts"/>
- <result column="phone_" jdbcType="VARCHAR" property="phone"/>
- <result column="pay_state_" jdbcType="INTEGER" property="payState"/>
- <result column="state_" jdbcType="INTEGER" property="state"/>
- <result column="real_name_" jdbcType="VARCHAR" property="createdName"/>
- <!-- 机构产品信息-->
- <result column="serve_name_" jdbcType="VARCHAR" property="serveName"/>
- <result column="student_up_limit_" jdbcType="INTEGER" property="studentUpLimit"/>
- <result column="expiry_date_" jdbcType="TIMESTAMP" property="expireDate"/>
- </resultMap>
- <select id="queryPage" parameterType="map" resultMap="TenantInfoInfoResult">
- SELECT a.`id_`,
- a.`name_`,
- a.`contacts_`,
- a.`phone_`,
- a.`pay_state_`,
- a.`state_`,
- u.`real_name_`,
- c.`name_` AS serve_name_,
- d.`student_up_limit_`,
- b.`expiry_date_`
- FROM tenant_info AS a
- LEFT JOIN tenant_product_info AS b ON a.`id_` = b.`tenant_id_`
- LEFT JOIN platform_serve AS c ON b.`serve_id_` = c.`id_`
- LEFT JOIN platform_serve_detail AS d ON b.`serve_detail_id_` = d.`id_` AND c.`id_` = d.`serve_id_`
- LEFT JOIN sys_user AS u ON a.`created_by_` = u.`id_`
- <where>
- <if test="param.search != null ">
- AND (
- a.`id_` LIKE CONCAT('%', #{param.search},'%')
- OR a.`name_` LIKE CONCAT('%', #{param.search},'%')
- OR a.`phone_` LIKE CONCAT('%', #{param.search},'%')
- )
- </if>
- <if test="param.createdName != null ">
- AND u.`real_name_` LIKE CONCAT('%', #{param.createdName},'%')
- </if>
- <if test="param.payState != null ">
- AND a.`pay_state_` = #{param.payState}
- </if>
- <if test="param.state != null ">
- AND a.`state_` = #{param.state}
- </if>
- <if test="param.startDate != null">
- AND a.`created_time_` <![CDATA[ >= ]]> #{param.startDate}
- </if>
- <if test="param.endDate != null ">
- AND a.`created_time_` <![CDATA[ <= ]]> #{param.endDate}
- </if>
- </where>
- </select>
- <select id="queryTenantInfoProductSumm" resultType="com.ym.mec.biz.dal.entity.TenantProductSumm">
- SELECT t.*, ps.name_ as serverName,
- tp.pay_date_ as expiryDate,
- tp.expiry_date_ as expiryDateEnd,
- tp.expiry_count_ as expiryCount,
- tp.expiry_unit_ as expiryUnit,
- ta.balance_ as balance,
- ta.frozen_amount_ as frozenAmount,
- psd.student_up_limit_ as studentUpLimit
- FROM `tenant_info` t
- left join tenant_assets_info ta on ta.tenant_id_ = t.id_
- left join tenant_product_info tp on tp.tenant_id_ = t.id_
- left join platform_serve ps on tp.serve_id_ = ps.id_
- left join platform_serve_detail psd on tp.serve_detail_id_ = psd.id_
- where t.id_ = #{tenantId}
- </select>
- <select id="getOpenTenant" resultType="com.ym.mec.biz.dal.entity.TenantInfo">
- SELECT * FROM tenant_info WHERE id_ = #{tenantId} AND state_ = 1
- </select>
- <select id="queryTenantInfoByOrgan" resultType="com.ym.mec.biz.dal.entity.TenantInfo">
- select * from tenant_info
- where id_ = (select id_ from organization where tenant_id_ = #{tenantId})
- </select>
- </mapper>
|