|  | @@ -392,14 +392,12 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 查询订单记录 -->
 | 
	
		
			
				|  |  |      <select id="findRecordCount" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  | -        SELECT count(1) FROM cloud_teacher_order cto
 | 
	
		
			
				|  |  | -        LEFT JOIN tenant_order_record tor ON tor.id_ = cto.platform_order_id_
 | 
	
		
			
				|  |  | +        SELECT count(1) FROM tenant_order_record tor
 | 
	
		
			
				|  |  | +        LEFT JOIN cloud_teacher_order cto ON tor.id_ = cto.platform_order_id_
 | 
	
		
			
				|  |  |          LEFT JOIN student s ON cto.student_id_ = s.user_id_
 | 
	
		
			
				|  |  |          LEFT JOIN sys_user u ON cto.student_id_ = u.id_
 | 
	
		
			
				|  |  | -        LEFT JOIN SUBJECT sj ON s.subject_id_list_ = sj.id_
 | 
	
		
			
				|  |  |          <where>
 | 
	
		
			
				|  |  | -            cto.tenant_id_ = #{tenantId} AND cto.status_ = 2 AND tor.order_no_ is not null AND tor.trans_no_ is not null
 | 
	
		
			
				|  |  | -            AND tor.order_type_ = 'CLOUD_TEACHER'
 | 
	
		
			
				|  |  | +            cto.tenant_id_ = #{tenantId} AND tor.order_type_ = 'CLOUD_TEACHER' AND tor.order_state_ = 1
 | 
	
		
			
				|  |  |              <if test="queryCondition != null and queryCondition != ''">
 | 
	
		
			
				|  |  |                  AND (u.username_ LIKE CONCAT('%', #{queryCondition}, '%') or u.phone_ = #{queryCondition} or u.id_ = #{queryCondition})
 | 
	
		
			
				|  |  |              </if>
 | 
	
	
		
			
				|  | @@ -426,32 +424,29 @@
 | 
	
		
			
				|  |  |                  WHEN 5 THEN '年' ELSE ''
 | 
	
		
			
				|  |  |                  END AS typeName,
 | 
	
		
			
				|  |  |              cto.time_ AS time,
 | 
	
		
			
				|  |  | -            sj.id_ AS subject,
 | 
	
		
			
				|  |  | -            sj.name_ AS subjectName,
 | 
	
		
			
				|  |  |              u.tenant_id_ AS tenantId,
 | 
	
		
			
				|  |  |              u.username_ AS name,
 | 
	
		
			
				|  |  |              u.phone_ AS phone,
 | 
	
		
			
				|  |  |              tor.order_no_ as orderNo,
 | 
	
		
			
				|  |  |              tor.trans_no_ as transNo,
 | 
	
		
			
				|  |  | -            tor.created_time_ as orderTime
 | 
	
		
			
				|  |  | -        FROM cloud_teacher_order cto
 | 
	
		
			
				|  |  | -        LEFT JOIN tenant_order_record tor ON tor.id_ = cto.platform_order_id_
 | 
	
		
			
				|  |  | +            tor.created_time_ as orderTime,
 | 
	
		
			
				|  |  | +            cto.pay_amount_ as amount
 | 
	
		
			
				|  |  | +        FROM tenant_order_record tor
 | 
	
		
			
				|  |  | +        LEFT JOIN cloud_teacher_order cto ON tor.id_ = cto.platform_order_id_
 | 
	
		
			
				|  |  |          LEFT JOIN student s ON cto.student_id_ = s.user_id_
 | 
	
		
			
				|  |  |          LEFT JOIN sys_user u ON cto.student_id_ = u.id_
 | 
	
		
			
				|  |  | -        LEFT JOIN subject sj ON s.subject_id_list_ = sj.id_
 | 
	
		
			
				|  |  |          <where>
 | 
	
		
			
				|  |  | -            cto.tenant_id_ = #{tenantId} AND cto.status_ = 2 AND tor.order_no_ is not null AND tor.trans_no_ is not null
 | 
	
		
			
				|  |  | -            AND tor.order_type_ = 'CLOUD_TEACHER'
 | 
	
		
			
				|  |  | +            cto.tenant_id_ = #{tenantId} AND tor.order_type_ = 'CLOUD_TEACHER' AND tor.order_state_ = 1
 | 
	
		
			
				|  |  |              <if test="queryCondition != null and queryCondition != ''">
 | 
	
		
			
				|  |  |                  AND (u.username_ LIKE CONCAT('%', #{queryCondition}, '%') or u.phone_ = #{queryCondition} or u.id_ = #{queryCondition})
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="orderNo != null and orderNo != ''">
 | 
	
		
			
				|  |  |                  AND tor.order_no_ LIKE CONCAT('%', #{orderNo}, '%')
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | -            <if test="startTime != null and startTime != ''">
 | 
	
		
			
				|  |  | +            <if test="startTime != null">
 | 
	
		
			
				|  |  |                  <![CDATA[ AND tor.created_time_ >= #{startTime} ]]>
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  | -            <if test="endTime != null and startTime != ''">
 | 
	
		
			
				|  |  | +            <if test="endTime != null">
 | 
	
		
			
				|  |  |                  <![CDATA[ AND tor.created_time_ <= #{endTime} ]]>
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |          </where>
 |