|
@@ -5,7 +5,7 @@
|
|
|
<mapper namespace="com.persagy.dmp.rwd.define.dao.ObjectInfoMapper">
|
|
|
<!-- 类型如果重复则会出现多条,因此这里先用distinct容错.将基础类型的信息点与非基础信息点一起返回,且class_code改为对应的非基础对象类型 -->
|
|
|
<sql id="SelectColumns">
|
|
|
- select distinct
|
|
|
+ distinct
|
|
|
dt_define_info.id, dt_define_info.code, dt_define_info.name, dt_define_info.alias_code,
|
|
|
dt_define_info.alias_name, dt_define_type.code as class_code, dt_define_info.group_code,
|
|
|
dt_define_info.project_id,dt_define_info.category,dt_define_info.first_tag,
|
|
@@ -40,30 +40,58 @@
|
|
|
and dt_define_info.project_id != dt_define_info.group_code then 600
|
|
|
else 0 end)
|
|
|
</sql>
|
|
|
- <select id="queryByClassCodes" resultType="com.persagy.dmp.define.entity.ObjectInfoDefine">
|
|
|
- select ${ew.sqlSelect}
|
|
|
- from (
|
|
|
- <include refid="SelectColumns"/>
|
|
|
- from dt_define_type inner join dt_define_info on dt_define_info.class_code in (dt_define_type.code, dt_define_type.obj_type)
|
|
|
+ <!-- 按项目查询信息点(包含上级信息点) -->
|
|
|
+ <sql id="InfoTableSQL">
|
|
|
+ select
|
|
|
+ <include refid="SelectColumns"/>
|
|
|
+ from dt_define_type inner join dt_define_info on dt_define_info.class_code in (dt_define_type.code, dt_define_type.obj_type)
|
|
|
and dt_define_type.valid = 1 and dt_define_info.valid = 1
|
|
|
- <if test="projectIds!=null and projectIds.size>0">
|
|
|
+ <if test="projectIds!=null and projectIds.size>0">
|
|
|
<foreach collection="projectIds" item="projectId" separator="," open=" and dt_define_info.project_id IN (" close=")">
|
|
|
#{projectId}
|
|
|
</foreach>
|
|
|
- </if>
|
|
|
- where exists(select 1 from (
|
|
|
- select dt_define_type.code class_code, dt_define_info.code code, max(<include refid="ShowLevelSQL"/>) max_show_level
|
|
|
- from dt_define_type inner join dt_define_info on dt_define_info.class_code in (dt_define_type.code, dt_define_type.obj_type)
|
|
|
- and dt_define_type.valid = 1 and dt_define_info.valid = 1
|
|
|
- <if test="projectIds!=null and projectIds.size>0">
|
|
|
- <foreach collection="projectIds" item="projectId" separator="," open="where dt_define_info.project_id IN (" close=")">
|
|
|
- #{projectId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- group by dt_define_type.code, dt_define_info.code
|
|
|
- ) T
|
|
|
- where T.class_code = dt_define_type.code and T.code = dt_define_info.code and T.max_show_level = <include refid="ShowLevelSQL"/>)
|
|
|
- ) dt_define_info
|
|
|
+ </if>
|
|
|
+ where exists(select 1 from (
|
|
|
+ select dt_define_type.code class_code, dt_define_info.code code, max(<include refid="ShowLevelSQL"/>) max_show_level
|
|
|
+ from dt_define_type inner join dt_define_info on dt_define_info.class_code in (dt_define_type.code, dt_define_type.obj_type)
|
|
|
+ and dt_define_type.valid = 1 and dt_define_info.valid = 1
|
|
|
+ <if test="projectIds!=null and projectIds.size>0">
|
|
|
+ <foreach collection="projectIds" item="projectId" separator="," open="where dt_define_info.project_id IN (" close=")">
|
|
|
+ #{projectId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ group by dt_define_type.code, dt_define_info.code
|
|
|
+ ) T
|
|
|
+ where T.class_code = dt_define_type.code and T.code = dt_define_info.code and T.max_show_level = <include refid="ShowLevelSQL"/>)
|
|
|
+ </sql>
|
|
|
+ <select id="queryByClassCodes" resultType="com.persagy.dmp.define.entity.ObjectInfoDefine">
|
|
|
+ select ${ew.sqlSelect}
|
|
|
+ from ( <include refid="InfoTableSQL"/> ) dt_define_info
|
|
|
+ WHERE ${ew.expression.sqlSegment}
|
|
|
+ </select>
|
|
|
+ <select id="queryCollectInfos" resultType="java.util.Map">
|
|
|
+ select dt_object.id, dt_object.local_id, dt_object.local_name, dt_define_info.class_code, dt_define_type.name as class_name,
|
|
|
+ dt_define_info.code, dt_define_info.name,dt_define_info.first_tag, dt_define_info.data_type,dt_define_info.category,
|
|
|
+ json_unquote(json_extract(dt_object.infos, concat('$.', dt_define_info.code))) as info_value
|
|
|
+ from ( <include refid="InfoTableSQL"/> ) dt_define_info
|
|
|
+ inner join dt_define_type on dt_define_info.class_code = dt_define_type.code and dt_define_type.valid = 1
|
|
|
+ inner join dt_object on dt_object.class_code = dt_define_info.class_code and dt_object.valid = 1 and dt_define_info.code not in ('localId','localName')
|
|
|
WHERE ${ew.expression.sqlSegment}
|
|
|
</select>
|
|
|
+ <select id="queryCollectReport" resultType="java.util.Map">
|
|
|
+ select count(1) as all_num, sum(case when category = 'STATIC' then 1 else 0 end) as static_num,
|
|
|
+ sum(case when category = 'STATIC' and info_value is not null then 1 else 0 end) as static_value_num,
|
|
|
+ sum(case when category != 'STATIC' then 1 else 0 end) as dynamic_num,
|
|
|
+ sum(case when category != 'STATIC' and info_value is not null then 1 else 0 end) as dynamic_value_num
|
|
|
+ from (
|
|
|
+ select dt_object.id, dt_object.local_id, dt_object.local_name, dt_define_info.class_code, dt_define_type.name as class_name,
|
|
|
+ dt_define_info.code, dt_define_info.name,dt_define_info.first_tag, dt_define_info.data_type,dt_define_info.category,
|
|
|
+ json_unquote(json_extract(dt_object.infos, concat('$.', dt_define_info.code))) as info_value
|
|
|
+ from ( <include refid="InfoTableSQL"/> ) dt_define_info
|
|
|
+ inner join dt_define_type on dt_define_info.class_code = dt_define_type.code and dt_define_type.valid = 1
|
|
|
+ inner join dt_object on dt_object.class_code = dt_define_info.class_code and dt_object.valid = 1 and dt_define_info.code not in ('localId','localName')
|
|
|
+ WHERE ${ew.expression.sqlSegment}
|
|
|
+ ) R
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|