| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <?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.xunmei.deploy.dao.HostInfoDao">
- <select id="selectHostInfoPage" parameterType="com.xunmei.deploy.vo.HostInfoVo" resultType="com.xunmei.deploy.vo.HostInfoVo">
- SELECT * FROM
- (
- SELECT t.id,t.hostName,t.hostIp,t.hostMac,t.hostStatus,t.agentVersion,
- h.org_id AS hostOrg,h.org_name AS hostOrgName,h.coreTimeStamp,
- t.register_date as registerDateTime,t.encryption,
- z.zip_version as zipVersion,z.target_version as targetVersion,z.status as updateStatus,
- IF ((( SELECT COUNT(*) FROM deploy_app_run_info WHERE app_type != 'Tool' and host_id = t.id AND running = 0 ) < 1), 1, 0) AS serverStatus
- FROM deploy_host_info t
- LEFT JOIN hv_host_org h ON t.id = h.register_code
- LEFT JOIN deploy_host_zip_info z on t.id = z.host_id
- <where>
- <if test="infoVo.zipVersion != '' and infoVo.zipVersion != null">
- z.zip_version = #{infoVo.zipVersion}
- </if>
- <if test="infoVo.updateStatus != null">
- and z.status = #{infoVo.updateStatus}
- </if>
- <if test="infoVo.targetVersion != '' and infoVo.targetVersion != null">
- and z.target_version = #{infoVo.targetVersion}
- </if>
- <if test="infoVo.hostIp != '' and infoVo.hostIp != null">
- and t.hostIp LIKE CONCAT('%', #{infoVo.hostIp}, '%' )
- </if>
- <!-- <if test="infoVo.mirrorVersion != '' and infoVo.mirrorVersion != null">
- and h.mirror_version LIKE CONCAT('%', #{infoVo.mirrorVersion}, '%' )
- </if>-->
- <if test="infoVo.hostOrg != '' and infoVo.hostOrg != null">
- and h.PATH LIKE CONCAT('%#', #{infoVo.hostOrg}, '#%' )
- </if>
- <if test="infoVo.hostName != '' and infoVo.hostName != null">
- and t.hostName LIKE CONCAT('%', #{infoVo.hostName}, '%' )
- </if>
- <if test="infoVo.hostStatus != null">
- and t.hostStatus = #{infoVo.hostStatus}
- </if>
- <if test="infoVo.agentVersion != '' and infoVo.agentVersion != null">
- and t.agentVersion = #{infoVo.agentVersion}
- </if>
- <if test="infoVo.orgName != '' and infoVo.orgName != null">
- and h.organize_name LIKE CONCAT('%', #{infoVo.orgName}, '%' )
- </if>
- <if test="infoVo.showNoOrgNameFlag != '' and infoVo.showNoOrgNameFlag != null">
- and h.organize_name is null
- </if>
- <if test="infoVo.encryption != null">
- and t.encryption = #{infoVo.encryption}
- </if>
- </where>
- ) h
- <where>
- <if test="infoVo.serverStatus != null">
- h.serverStatus = #{infoVo.serverStatus}
- </if>
- </where>
- order by h.serverStatus asc
- </select>
- <select id="getInfoById" resultType="com.xunmei.deploy.vo.HostInfoVo">
- SELECT
- t.id,
- t.hostName,
- t.hostIp,
- t.hostMac,
- t.hostStatus,
- t.agentVersion,
- h.org_id AS hostOrg,
- h.org_name AS hostOrgName,
- h.coreTimeStamp ,
- t.register_date as registerDateTime,
- z.zip_version as zipVersion,
- z.target_version as targetVersion,
- z.status as updateStatus,
- t.encryption,
- IF ((( SELECT COUNT(*) FROM deploy_app_run_info WHERE app_type != 'Tool' and host_id = t.id AND running = 0 ) < 1), 1, 0) AS serverStatus
- FROM
- deploy_host_info t
- LEFT JOIN hv_host_org h ON t.id = h.register_code
- LEFT JOIN deploy_host_zip_info z on t.id = z.host_id
- where t.id = #{id}
- </select>
- <delete id="deleteAppInfo">
- delete from deploy_app_info where host_info_id = #{hostId};
- </delete>
- <delete id="deleteFrontTask">
- delete from deploy_front_task where host_id = #{hostId};
- </delete>
- <delete id="deleteHostZipInfo">
- delete from deploy_host_zip_info where host_id = #{hostId};
- </delete>
- <delete id="deleteUpgradeTask">
- delete from deploy_upgrade_task where host_id = #{hostId};
- </delete>
- <delete id="deleteUpgradeTaskHis">
- delete from deploy_upgrade_task_his where host_id = #{hostId};
- </delete>
- <delete id="deleteAppInfoExtend">
- delete from deploy_app_info_extend where host_info_id = #{hostId};
- </delete>
- <delete id="deleteAppRunInfo">
- delete from deploy_app_run_info where host_id = #{hostId};
- </delete>
- <delete id="deleteAppRunInfoExtend">
- delete from deploy_app_run_info_extend where host_id = #{hostId};
- </delete>
- <delete id="deleteBatchHostInfo">
- delete from deploy_batch_host_info where host_id = #{hostId};
- </delete>
- <select id="selectByOrg" resultType="com.xunmei.deploy.domain.HostInfo">
- select h.id,h.hostName,h.hostIp,h.hostSystem,h.hostFrame,h.hostMac,h.hostOrg,
- h.hostStatus,h.accessToken,h.expiresIn,h.tokenType,h.scope,h.agentVersion,
- h.isPush,h.tokenCreateTime,h.coreTimeStamp,h.frontTimeStamp,h.upload_version,h.encryption
- from deploy_host_info h
- left join hv_host_org v on h.id = v.register_code
- left join hv_org o on v.org_id = o.org_id
- where 1 =1
- <if test="orgId != '' and orgId != null">
- and o.is_deleted = 0 and o.path like concat('%#', #{orgId}, '#%' )
- </if>
- <if test="agentVersion != '' and agentVersion != null">
- and h.agentVersion = #{agentVersion}
- </if>
- <if test="hostStatus != '' and hostStatus != null">
- and h.hostStatus = #{hostStatus}
- </if>
- <if test="uploadVersion != '' and uploadVersion != null">
- and h.upload_version = #{uploadVersion}
- </if>
- <if test="hostIp != '' and hostIp != null">
- and h.hostIp like CONCAT('%', #{hostIp}, '%' )
- </if>
- </select>
- <select id="selectPage" resultType="com.xunmei.deploy.vo.HostInfoVo">
- SELECT
- h.id,h.hostName,h.hostIp,h.hostSystem,h.hostFrame,h.hostMac,h.hostOrg,h.hostStatus,h.accessToken,h.expiresIn,h.tokenType,h.scope,h.agentVersion,
- if(h.agentVersion=(SELECT h.agentVersion as version FROM deploy_host_info UNION SELECT package_version as version FROM deploy_package_info order by version DESC limit 1 ),0,1) as upgradeFlag,
- h.isPush,h.tokenCreateTime, h.coreTimeStamp,h.frontTimeStamp,h.upload_version,h.encryption,v.org_name AS orgName
- FROM deploy_host_info h
- LEFT JOIN hv_host_org v ON h.id = v.register_code
- LEFT JOIN hv_org o ON v.org_id = o.org_id
- <where>
- <if test="info.hostOrg != '' and info.hostOrg != null">
- o.IS_DELETED = 0 AND o.PATH LIKE CONCAT('%#', #{info.hostOrg}, '#%' )
- </if>
- <if test="info.agentVersion != '' and info.agentVersion != null">
- AND h.agentVersion = #{info.agentVersion}
- </if>
- <if test="info.uploadVersion != '' and info.uploadVersion != null">
- AND h.upload_version = #{info.uploadVersion}
- </if>
- <if test="info.hostIp != '' and info.hostIp != null">
- AND h.hostIp LIKE CONCAT('%', #{info.hostIp}, '%' )
- </if>
- <if test="info.hostStatus != '' and info.hostStatus != null">
- AND h.hostStatus = #{info.hostStatus}
- </if>
- </where>
- </select>
- </mapper>
|