43 lines
1.2 KiB
XML
43 lines
1.2 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
<mapper namespace="com.kri.gwcf.review.back.persistence.mapper.kon.KonMapper">
|
|
|
|
<sql id="BaseDataSelect">
|
|
SELECT DISTINCT
|
|
JSON_VALUE(DJ.[VALUE], '$.SC') AS IDKEY,
|
|
DV.[value] AS performance_id
|
|
FROM [DATA] DA WITH(NOLOCK)
|
|
CROSS APPLY OPENJSON([DATJSON]) DJ
|
|
CROSS APPLY OPENJSON(DJ.[value]) DV
|
|
WHERE PKEY = '2605013_B'
|
|
AND [Status] = 10
|
|
AND JSON_VALUE(DJ.[VALUE], '$.SC') IS NOT NULL
|
|
AND JSON_VALUE(DJ.[VALUE], '$.SC') != ''
|
|
AND DV.[KEY] LIKE 'Q1%'
|
|
AND [SURVEY_TYPE] = #{surveyType}
|
|
</sql>
|
|
|
|
<select id="findPerformanceApplyCount" resultType="PerformanceApplyCountDto">
|
|
WITH Base AS (
|
|
<include refid="BaseDataSelect"/>
|
|
)
|
|
SELECT performance_id, COUNT(1) AS apply_cnt
|
|
FROM Base
|
|
GROUP BY performance_id
|
|
</select>
|
|
|
|
<select id="findPerformanceApplyUser" resultType="PerformanceApplyUserDto">
|
|
WITH Base AS (
|
|
<include refid="BaseDataSelect"/>
|
|
)
|
|
SELECT performance_id, IDKEY AS user_id
|
|
FROM Base
|
|
WHERE performance_id = #{performanceId}
|
|
GROUP BY performance_id, IDKEY
|
|
</select>
|
|
|
|
</mapper>
|