|
@@ -0,0 +1,135 @@
|
|
|
+<?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.css.simulation.resource.system.mapper.ClusterMapper" >
|
|
|
+
|
|
|
+
|
|
|
+ <!--查询集群列表-->
|
|
|
+ <select id="getClusterList" parameterType="api.common.pojo.param.system.ClusterParam" resultType="api.common.pojo.vo.system.ClusterVO">
|
|
|
+ select
|
|
|
+ p.id,
|
|
|
+ u.id as user_id,
|
|
|
+ u.username,
|
|
|
+ u.use_type,
|
|
|
+ IFNULL(p.num_simulation_license,0) as num_simulation_license,
|
|
|
+ IFNULL(p.num_dynamic_license,0) as num_dynamic_license,
|
|
|
+ p.date_simulation_license,
|
|
|
+ p.date_dynamic_license,
|
|
|
+ p.modify_time
|
|
|
+ from system_user u
|
|
|
+ left join system_cluster p on u.id = p.user_id
|
|
|
+ <where>
|
|
|
+ u.is_deleted = '0' and u.visible = '1'
|
|
|
+ and u.role_code = #{roleCode,jdbcType=VARCHAR}
|
|
|
+ </where>
|
|
|
+ <if test="createUserId != null and createUserId != ''">
|
|
|
+ and u.create_user_id = #{createUserId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="userName != null and userName != ''">
|
|
|
+ and u.username like CONCAT('%',#{userName,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="modifyTimeStart != null and modifyTimeStart != ''">
|
|
|
+ and p.modify_time >= #{modifyTimeStart}
|
|
|
+ </if>
|
|
|
+ <if test="modifyTimeEnd != null and modifyTimeEnd != ''">
|
|
|
+ and p.modify_time <= #{modifyTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="dueTimeStart != null and dueTimeStart != ''">
|
|
|
+ and (p.date_simulation_license >= #{dueTimeStart} or p.date_dynamic_license >= #{dueTimeStart})
|
|
|
+ </if>
|
|
|
+ <if test="dueTimeEnd != null and dueTimeEnd != ''">
|
|
|
+ and (p.date_simulation_license <= #{dueTimeEnd} or p.date_dynamic_license <= #{dueTimeEnd})
|
|
|
+ </if>
|
|
|
+ order by modify_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 新增集群配置信息-->
|
|
|
+ <insert id="insert" parameterType="api.common.pojo.po.system.ClusterPO">
|
|
|
+ INSERT INTO system_cluster(
|
|
|
+ id,
|
|
|
+ user_id,
|
|
|
+ num_simulation_license,
|
|
|
+ date_simulation_license,
|
|
|
+ num_dynamic_license,
|
|
|
+ date_dynamic_license,
|
|
|
+ create_time,
|
|
|
+ modify_time,
|
|
|
+ create_user_id,
|
|
|
+ modify_user_id,
|
|
|
+ is_deleted
|
|
|
+ )
|
|
|
+ VALUES(
|
|
|
+ #{id,jdbcType=VARCHAR},
|
|
|
+ #{userId,jdbcType=VARCHAR},
|
|
|
+ #{numSimulationLicense,jdbcType=INTEGER},
|
|
|
+ #{dateSimulationLicense,jdbcType=TIMESTAMP},
|
|
|
+ #{numDynamicLicense,jdbcType=INTEGER},
|
|
|
+ #{dateDynamicLicense,jdbcType=TIMESTAMP},
|
|
|
+ #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ #{modifyTime,jdbcType=TIMESTAMP},
|
|
|
+ #{createUserId,jdbcType=VARCHAR},
|
|
|
+ #{modifyUserId,jdbcType=VARCHAR},
|
|
|
+ #{isDeleted,jdbcType=VARCHAR}
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 修改参数配置信息-->
|
|
|
+ <update id="deleteById" parameterType="api.common.pojo.po.system.ClusterPO">
|
|
|
+ update system_cluster set
|
|
|
+ is_deleted = #{isDeleted,jdbcType=VARCHAR},
|
|
|
+ modify_time = #{modifyTime,jdbcType=TIMESTAMP},
|
|
|
+ modify_user_id = #{modifyUserId,jdbcType=VARCHAR}
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!--查询集群修改历史记录-->
|
|
|
+ <select id="getClusterHistory" parameterType="api.common.pojo.param.system.ClusterParam" resultType="api.common.pojo.vo.system.ClusterVO">
|
|
|
+ select
|
|
|
+ id,
|
|
|
+ IFNULL(num_simulation_license,0) as num_simulation_license,
|
|
|
+ IFNULL(num_dynamic_license,0) as num_dynamic_license,
|
|
|
+ date_simulation_license,
|
|
|
+ date_dynamic_license,
|
|
|
+ modify_time
|
|
|
+ from system_cluster
|
|
|
+ <where>
|
|
|
+ is_deleted = '1'
|
|
|
+ </where>
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
+ and user_id = #{userId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ order by modify_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--查询已分配未到期节点数量-->
|
|
|
+ <select id="getClusterNum" parameterType="api.common.pojo.param.system.ClusterParam" resultType="java.util.HashMap">
|
|
|
+ select
|
|
|
+ (
|
|
|
+ select
|
|
|
+ sum(p.num_simulation_license)
|
|
|
+ from system_user u
|
|
|
+ left join system_cluster p on u.id = p.user_id
|
|
|
+ <where>
|
|
|
+ u.is_deleted = '0' and u.visible = '1'
|
|
|
+ and p.date_simulation_license >= NOW()
|
|
|
+ and u.role_code = #{roleCode,jdbcType=VARCHAR}
|
|
|
+ </where>
|
|
|
+ <if test="createUserId != null and createUserId != ''">
|
|
|
+ and u.create_user_id = #{createUserId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ ) as totalSimulation, (
|
|
|
+ select
|
|
|
+ sum(p.num_dynamic_license)
|
|
|
+ from system_user u
|
|
|
+ left join system_cluster p on u.id = p.user_id
|
|
|
+ <where>
|
|
|
+ u.is_deleted = '0' and u.visible = '1'
|
|
|
+ and p.date_dynamic_license >= NOW()
|
|
|
+ and u.role_code = #{roleCode,jdbcType=VARCHAR}
|
|
|
+ </where>
|
|
|
+ <if test="createUserId != null and createUserId != ''">
|
|
|
+ and u.create_user_id = #{createUserId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ ) as totalDynamic
|
|
|
+ </select>
|
|
|
+</mapper>
|