<?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.gxwebsoft.oa.mapper.OaAssetsServerMapper">

    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM oa_assets_server a
        <where>
            <if test="param.serverId != null">
                AND a.server_id = #{param.serverId}
            </if>
            <if test="param.name != null">
                AND a.name LIKE CONCAT('%', #{param.name}, '%')
            </if>
            <if test="param.code != null">
                AND a.code LIKE CONCAT('%', #{param.code}, '%')
            </if>
            <if test="param.type != null">
                AND a.type LIKE CONCAT('%', #{param.type}, '%')
            </if>
            <if test="param.brand != null">
                AND a.brand LIKE CONCAT('%', #{param.brand}, '%')
            </if>
            <if test="param.configuration != null">
                AND a.configuration LIKE CONCAT('%', #{param.configuration}, '%')
            </if>
            <if test="param.account != null">
                AND a.account LIKE CONCAT('%', #{param.account}, '%')
            </if>
            <if test="param.password != null">
                AND a.password LIKE CONCAT('%', #{param.password}, '%')
            </if>
            <if test="param.brandAccount != null">
                AND a.brand_account LIKE CONCAT('%', #{param.brandAccount}, '%')
            </if>
            <if test="param.brandPassword != null">
                AND a.brand_password LIKE CONCAT('%', #{param.brandPassword}, '%')
            </if>
            <if test="param.panel != null">
                AND a.panel LIKE CONCAT('%', #{param.panel}, '%')
            </if>
            <if test="param.panelAccount != null">
                AND a.panel_account LIKE CONCAT('%', #{param.panelAccount}, '%')
            </if>
            <if test="param.panelPassword != null">
                AND a.panel_password LIKE CONCAT('%', #{param.panelPassword}, '%')
            </if>
            <if test="param.financeAmount != null">
                AND a.finance_amount = #{param.financeAmount}
            </if>
            <if test="param.financeYears != null">
                AND a.finance_years = #{param.financeYears}
            </if>
            <if test="param.financeRenew != null">
                AND a.finance_renew = #{param.financeRenew}
            </if>
            <if test="param.financeCustomerName != null">
                AND a.finance_customer_name LIKE CONCAT('%', #{param.financeCustomerName}, '%')
            </if>
            <if test="param.financeCustomerContact != null">
                AND a.finance_customer_contact LIKE CONCAT('%', #{param.financeCustomerContact}, '%')
            </if>
            <if test="param.financeCustomerPhone != null">
                AND a.finance_customer_phone LIKE CONCAT('%', #{param.financeCustomerPhone}, '%')
            </if>
            <if test="param.customerId != null">
                AND a.customer_id = #{param.customerId}
            </if>
            <if test="param.customerName != null">
                AND a.customer_name LIKE CONCAT('%', #{param.customerName}, '%')
            </if>
            <if test="param.openPort != null">
                AND a.open_port LIKE CONCAT('%', #{param.openPort}, '%')
            </if>
            <if test="param.content != null">
                AND a.content LIKE CONCAT('%', #{param.content}, '%')
            </if>
            <if test="param.startTime != null">
                AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%')
            </if>
            <if test="param.endTime != null">
                AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%')
            </if>
            <if test="param.isTop != null">
                AND a.is_top LIKE CONCAT('%', #{param.isTop}, '%')
            </if>
            <if test="param.visibility != null">
                AND a.visibility LIKE CONCAT('%', #{param.visibility}, '%')
            </if>
            <if test="param.btSign != null">
                AND a.bt_sign LIKE CONCAT('%', #{param.btSign}, '%')
            </if>
            <if test="param.sortNumber != null">
                AND a.sort_number = #{param.sortNumber}
            </if>
            <if test="param.comments != null">
                AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
            </if>
            <if test="param.companyId != null">
                AND a.company_id = #{param.companyId}
            </if>
            <if test="param.userId != null">
                AND a.user_id = #{param.userId}
            </if>
            <if test="param.organizationId != null">
                AND a.organization_id = #{param.organizationId}
            </if>
            <if test="param.status != null">
                AND a.status LIKE CONCAT('%', #{param.status}, '%')
            </if>
            <if test="param.deleted != null">
                AND a.deleted = #{param.deleted}
            </if>
            <if test="param.deleted == null">
                AND a.deleted = 0
            </if>
            <if test="param.createTimeStart != null">
                AND a.create_time &gt;= #{param.createTimeStart}
            </if>
            <if test="param.createTimeEnd != null">
                AND a.create_time &lt;= #{param.createTimeEnd}
            </if>
        </where>
    </sql>

    <!-- 分页查询 -->
    <select id="selectPageRel" resultType="com.gxwebsoft.oa.entity.OaAssetsServer">
        <include refid="selectSql"></include>
    </select>

    <!-- 查询全部 -->
    <select id="selectListRel" resultType="com.gxwebsoft.oa.entity.OaAssetsServer">
        <include refid="selectSql"></include>
    </select>

</mapper>
