44 lines
1.7 KiB
Plaintext
44 lines
1.7 KiB
Plaintext
<select id="manaSearchHostsInfo" resultMap="HostInfoMapper">
|
|
SELECT
|
|
h.host_id,
|
|
h.host_name,
|
|
h.country,
|
|
h.hosts_source,
|
|
hi.info_type as hi_info_type,
|
|
hi.info_value as hi_info_value,
|
|
hi.part_month as hi_part_month
|
|
FROM (
|
|
SELECT DISTINCT
|
|
h_inner.host_id,
|
|
h_inner.host_name,
|
|
h_inner.country,
|
|
h_inner.hosts_source
|
|
FROM hosts h_inner
|
|
<if test="params.dataStart != null and params.dataEnd != null and params.dataType != null">
|
|
INNER JOIN hosts_info hi_check ON h_inner.host_id = hi_check.hosts_id
|
|
AND hi_check.info_type = #{params.dataType}
|
|
AND CAST(hi_check.info_value AS SIGNED) >= #{params.dataStart}
|
|
AND CAST(hi_check.info_value AS SIGNED) <![CDATA[ <= ]]> #{params.dataEnd}
|
|
</if>
|
|
<where>
|
|
<if test="params.region != null">
|
|
AND h_inner.country IN
|
|
(SELECT country_name FROM country_info WHERE country_group_name = #{params.region})
|
|
</if>
|
|
<if test="params.searchTime != null">
|
|
AND h_inner.update_dt = #{params.searchTime}
|
|
</if>
|
|
<if test="params.userId != null">
|
|
AND h_inner.owner_by = #{params.userId}
|
|
</if>
|
|
<if test="params.tenantId != null">
|
|
AND h_inner.tenant_id = #{params.tenantId}
|
|
</if>
|
|
</where>
|
|
LIMIT #{page.size} OFFSET #{page.current}
|
|
) h
|
|
INNER JOIN hosts_info hi ON h.host_id = hi.hosts_id
|
|
<if test="params.searchTime != null">
|
|
AND hi.part_month = #{params.searchTime}
|
|
</if>
|
|
</select> |