|
- <?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.imitate.common.k8s.mapper.WindowsInfoMapper" >
- <resultMap id="BaseResultMap" type="com.imitate.common.k8s.pojo.WindowsInfo" >
- <id column="id" property="id" jdbcType="BIGINT" />
- <result column="uniq_id" property="uniqId" jdbcType="VARCHAR" />
- <result column="instance_id" property="instanceId" jdbcType="VARCHAR" />
- <result column="user_id" property="userID" jdbcType="VARCHAR" />
- <result column="port" property="port" jdbcType="VARCHAR" />
- <result column="vnc_port" property="vncPort" jdbcType="VARCHAR" />
- <result column="template_name" property="templateName" jdbcType="VARCHAR" />
- <result column="auto_release_time" property="autoReleaseTime" jdbcType="TIMESTAMP" />
- <result column="forward_table_id" property="forwardTableId" jdbcType="VARCHAR" />
- <result column="forward_entry_id" property="forwardEntryId" jdbcType="VARCHAR" />
- <result column="vnc_forward_entry_id" property="vncForwardEntryId" jdbcType="VARCHAR" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
- <result column="status" property="status" jdbcType="INTEGER" />
-
- </resultMap>
- <sql id="Base_Column_List" >
- id, uniq_id, instance_id, user_id, port, vnc_port, template_name, auto_release_time, forward_table_id, forward_entry_id, vnc_forward_entry_id, status
- </sql>
-
- <select id="selectByUniqId" resultMap="BaseResultMap" parameterType="java.lang.String" >
- select
- <include refid="Base_Column_List" />
- from windows_info
- where uniq_id = #{uniqId,jdbcType=VARCHAR} and status = 0 limit 1
- </select>
-
- <select id="selectByUserId" resultMap="BaseResultMap" parameterType="java.lang.String" >
- select
- <include refid="Base_Column_List" />
- from windows_info
- where user_id = #{userID,jdbcType=VARCHAR}
- and status = 0
- </select>
-
- <select id="selectByTpiId" resultMap="BaseResultMap" parameterType="java.lang.String" >
- select
- <include refid="Base_Column_List" />
- from windows_info
- where uniq_id like concat( #{tpiId,jdbcType=VARCHAR} , '%') and status = 0
- </select>
-
- <select id="selectUniqIdByAutoReleaseTime" resultType="java.lang.String" parameterType="com.imitate.common.k8s.pojo.WindowsInfo">
- SELECT uniq_id FROM windows_info
- where status = 0
- <if test="autoReleaseTime != null">
- and auto_release_time < #{autoReleaseTime,jdbcType=TIMESTAMP}
- </if>
- </select>
- <select id="selectNotForwardEntryHost" resultMap="BaseResultMap" >
- SELECT
- <include refid="Base_Column_List" />
- FROM windows_info
- WHERE (forward_entry_id IS NULL OR (vnc_port IS NOT NULL AND vnc_forward_entry_id IS NULL)) and status = 0
- </select>
-
- <delete id="deleteByUniqId" parameterType="java.lang.String" >
- update windows_info set status = -1
- where uniq_id = #{uniqId,jdbcType=VARCHAR}
- </delete>
-
- <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id"
- parameterType="com.imitate.common.k8s.pojo.WindowsInfo" >
- insert into windows_info
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- id,
- </if>
- <if test="uniqId != null" >
- uniq_id,
- </if>
- <if test="instanceId != null" >
- instance_id,
- </if>
- <if test="userID != null" >
- user_id,
- </if>
- <if test="port != null" >
- port,
- </if>
- <if test="vncPort != null" >
- vnc_port,
- </if>
- <if test="templateName != null" >
- template_name,
- </if>
- <if test="autoReleaseTime != null" >
- auto_release_time,
- </if>
- <if test="forwardTableId != null" >
- forward_table_id,
- </if>
- <if test="forwardEntryId != null" >
- forward_entry_id,
- </if>
- <if test="vncForwardEntryId != null" >
- vnc_forward_entry_id,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="updateTime != null" >
- update_time,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- #{id,jdbcType=BIGINT},
- </if>
- <if test="uniqId != null" >
- #{uniqId,jdbcType=VARCHAR},
- </if>
- <if test="instanceId != null" >
- #{instanceId,jdbcType=VARCHAR},
- </if>
- <if test="userID != null" >
- #{userID,jdbcType=VARCHAR},
- </if>
- <if test="port != null" >
- #{port,jdbcType=VARCHAR},
- </if>
- <if test="vncPort != null" >
- #{vncPort,jdbcType=VARCHAR},
- </if>
- <if test="templateName != null" >
- #{templateName,jdbcType=VARCHAR},
- </if>
- <if test="autoReleaseTime != null" >
- #{autoReleaseTime,jdbcType=TIMESTAMP},
- </if>
- <if test="forwardTableId != null" >
- #{forwardTableId,jdbcType=VARCHAR},
- </if>
- <if test="forwardEntryId != null" >
- #{forwardEntryId,jdbcType=VARCHAR},
- </if>
- <if test="vncForwardEntryId != null" >
- #{vncForwardEntryId,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateTime != null" >
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <update id="updateByUniqIdSelective" parameterType="com.imitate.common.k8s.pojo.WindowsInfo" >
- update windows_info
- <set >
- <if test="instanceId != null" >
- instance_id = #{instanceId,jdbcType=VARCHAR},
- </if>
- <if test="userID != null" >
- user_id = #{userID,jdbcType=VARCHAR},
- </if>
- <if test="port != null" >
- port = #{port,jdbcType=INTEGER},
- </if>
- <if test="vncPort != null" >
- vnc_port = #{vncPort,jdbcType=INTEGER},
- </if>
- <if test="templateName != null" >
- template_name = #{templateName,jdbcType=VARCHAR},
- </if>
- <if test="autoReleaseTime != null" >
- auto_release_time = #{autoReleaseTime,jdbcType=TIMESTAMP},
- </if>
- <if test="forwardTableId != null" >
- forward_table_id = #{forwardTableId,jdbcType=VARCHAR},
- </if>
- <if test="forwardEntryId != null" >
- forward_entry_id = #{forwardEntryId,jdbcType=VARCHAR},
- </if>
- <if test="vncForwardEntryId != null" >
- vnc_forward_entry_id = #{vncForwardEntryId,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateTime != null" >
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where uniq_id = #{uniqId,jdbcType=VARCHAR}
- </update>
- </mapper>
|