gtsoft-snail-job-server/snail-job-datasource/snail-job-datasource-template/src/main/resources/template/mapper/ServerNodeMapper.xml

43 lines
1.8 KiB
XML
Raw Normal View History

<?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.aizuda.snailjob.template.datasource.persistence.mapper.ServerNodeMapper">
<sql id="insertBatch_Column_List" >
#{item.namespaceId,jdbcType=VARCHAR},
#{item.groupName,jdbcType=VARCHAR},
#{item.hostId,jdbcType=VARCHAR},
#{item.hostIp,jdbcType=VARCHAR},
#{item.hostPort,jdbcType=INTEGER},
#{item.expireAt,jdbcType=TIMESTAMP},
#{item.nodeType,jdbcType=TINYINT},
#{item.extAttrs,jdbcType=VARCHAR},
#{item.createDt,jdbcType=TIMESTAMP}
</sql>
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
INSERT INTO sj_server_node (namespace_id, group_name, host_id, host_ip, host_port,
expire_at, node_type, ext_attrs, create_dt)
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@notOracle()">
VALUES
<foreach collection="list" item="item" open="(" separator="," close=")">
<include refid="insertBatch_Column_List" />
</foreach>
</if>
<if test="@com.aizuda.snailjob.template.datasource.utils.DbUtils@isOracle()">
<foreach collection="list" item="item" separator="UNION ALL">
SELECT
<include refid="insertBatch_Column_List" />
FROM DUAL
</foreach>
</if>
</insert>
<select id="selectActivePodCount"
resultType="com.aizuda.snailjob.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO">
SELECT node_type AS nodeType,
COUNT(*) AS total
2024-05-21 12:54:48 +08:00
FROM sj_server_node
${ew.customSqlSegment}
</select>
</mapper>