Files
auto-solution/auto-solution-rule/src/main/resources/mapper/rule/FireRuleMapper.xml
2026-03-17 00:36:40 +08:00

114 lines
4.2 KiB
XML

<?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.solution.rule.mapper.FireRuleMapper">
<resultMap id="platformComponentCountMap" type="com.solution.rule.domain.vo.WeaponModelVO">
<result property="platformName" column="platform_name"/>
<result property="componentName" column="component_name"/>
<result property="count" column="count"/>
</resultMap>
<resultMap id="PlatformComponentNamesVOResultMap" type="com.solution.rule.domain.vo.PlatformComponentNamesVO">
<result property="platformName" column="platformName"/>
<result property="platformDescription" column="description"/>
<collection property="componentNames" ofType="java.lang.String">
<result column="componentName"/>
</collection>
</resultMap>
<select id="getWeapon" resultMap="platformComponentCountMap">
SELECT
p.name AS platform_name,
pc.name AS component_name,
COUNT(pc.name) AS count
FROM platform p
LEFT JOIN platform_component pc ON p.id = pc.platform_id
GROUP BY p.id, p.name, pc.name
ORDER BY p.id, pc.name
</select>
<select id="getPlatformComponentNames" resultType="com.solution.rule.domain.vo.WeaponModelVO">
SELECT DISTINCT
p.name AS platformName,
pc.name AS componentName
FROM platform p
INNER JOIN platform_component pc ON p.id = pc.platform_id
WHERE pc.name IS NOT NULL
ORDER BY p.name, pc.name
</select>
<select id="getModuleAndCount" resultType="com.solution.rule.domain.vo.ComponentCountVO">
SELECT
name AS componentName,
COUNT(*) AS count
FROM platform_component
WHERE name IS NOT NULL
GROUP BY name
ORDER BY count DESC;
</select>
<select id="getCommPlatformComponentNames" resultMap="PlatformComponentNamesVOResultMap"
parameterType="java.lang.Integer">
SELECT
p.name AS platformName,
pc.name AS componentName,
p.description AS description
FROM platform p
INNER JOIN platform_component pc ON p.id = pc.platform_id
WHERE pc.type = 'comm'
AND p.scenario_id = #{scenarioId}
</select>
<select id="getComponents" resultType="com.solution.rule.domain.PlatformComponent"
parameterType="java.lang.Integer">
SELECT id,name,type,description,platform_id
FROM platform_component
WHERE platform_id = #{platformId}
</select>
<resultMap id="VPlatformComponentMap" type="com.solution.rule.domain.PlatformComponent">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="description" column="description"/>
<result property="platformId" column="platform_id"/>
<result property="num" column="num"/>
</resultMap>
<select id="findComponentsByPlatformId" resultMap="VPlatformComponentMap">
SELECT * FROM platform_component
WHERE platform_id=#{platformId}
</select>
<resultMap id="VPlatformMap" type="com.solution.rule.domain.Platform">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="description" column="description"/>
<collection property="components"
ofType="com.solution.rule.domain.PlatformComponent"
column="id"
select="findComponentsByPlatformId"/>
</resultMap>
<select id="findPlatformComponents" resultMap="VPlatformMap"
parameterType="java.lang.Integer">
SELECT DISTINCT
p.*,
pc.*
FROM platform p
LEFT JOIN platform_component pc ON p.id = pc.platform_id
WHERE pc.type = 'comm'
AND p.scenario_id = #{scenarioId}
ORDER BY p.name,pc.name
</select>
<select id="findAllPlatformComponents" resultMap="VPlatformMap">
SELECT *
FROM platform
</select>
</mapper>