SELECT
t1.*,
t2.app_name,
t3.customer_name,
t3.customer_type,
t3.customer_id AS customerNo,
t4.CONTRACT_NAME,
t4.CONTRACT_ID AS contractNo,
t4.CONTRACT_SIGN
FROM
view_interface AS t1
LEFT JOIN gw_app t2 ON t1.app_id = t2.app_id
LEFT JOIN customer_info AS t3 ON t1.customer_id=t3.id
LEFT JOIN CONTRACT_DETAILS AS t4 ON t1.contract_id=t4.ID
where 1=1
<
if
test
=
"appName!=null and appName != ''"
>
and t2.app_name like CONCAT('%',#{appName},'%')
</
if
>
<
if
test
=
"associateInterface!=null and associateInterface != ''"
>
and t1.associate_interface like CONCAT('%',#{associateInterface},'%')
</
if
>
<
if
test
=
"customerName!=null and customerName != ''"
>
and t3.customer_name like CONCAT('%',#{customerName},'%')
</
if
>
<
if
test
=
"customerType!=null and customerType != ''"
>
and t3.customer_type=#{customerType}
</
if
>
<
if
test
=
"productName!=null and productName != ''"
>
and t1.product_name like CONCAT('%',#{productName},'%')
</
if
>
<
if
test
=
"contractNo!=null and contractNo != ''"
>
and t4.CONTRACT_ID like CONCAT('%',#{contractNo},'%')
</
if
>
<
if
test
=
"contractName!=null and contractName != ''"
>
and t4.CONTRACT_NAME like CONCAT('%',#{contractName},'%')
</
if
>
<
if
test
=
"startTime != null"
>
and t1.start_time
<![CDATA[ >= ]]>
#{startTime}
</
if
>
<
if
test
=
"endTime != null"
>
and t1.end_time
<![CDATA[ <= ]]>
#{endTime}
</
if
>