|
@@ -90,14 +90,12 @@
|
|
|
ORDER BY count DESC
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
-
|
|
|
<select id="queryComponentsCountByEquipId" resultType="java.util.Map">
|
|
|
SELECT re.obj_from as 'id',count(1) as count,obj.class_code, df.system_code as 'equip_category',df.`name` AS category_name
|
|
|
FROM dt_object obj
|
|
|
join dt_relation re on obj.id = re.obj_to
|
|
|
join dt_define_type df on df.code = obj.class_code
|
|
|
- where obj.valid=TRUE and obj.obj_type='component' and re.rel_code='Eq2Ec'
|
|
|
+ where obj.valid=TRUE AND obj.obj_type='component' AND re.rel_code='Eq2Ec'
|
|
|
and df.project_id in
|
|
|
<foreach collection="projectIds" item="projectId" open="(" close=")" separator="," >
|
|
|
#{projectId}
|
|
@@ -110,4 +108,45 @@
|
|
|
</if>
|
|
|
GROUP BY obj.class_code,re.obj_from,df.system_code,df.name
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="queryEquipComponentsByProjectId" resultType="java.util.Map">
|
|
|
+ SELECT code,name,IFNULL(count,0) 'count' FROM (
|
|
|
+ SELECT DISTINCT code,name,
|
|
|
+ (select count(class_code) from dt_object where obj_type='component'
|
|
|
+ <if test="null!=equipmentId and equipmentId.length>0">
|
|
|
+ AND JSON_CONTAINS(infos, JSON_OBJECT('parentId',#{equipmentId}))
|
|
|
+ </if>
|
|
|
+ AND class_code = code
|
|
|
+ <if test="null!=projectId and projectId.length>0">
|
|
|
+ AND project_id=#{projectId}
|
|
|
+ </if>
|
|
|
+ <if test="null!=groupCode and groupCode.length>0">
|
|
|
+ AND group_code=#{groupCode}
|
|
|
+ </if>
|
|
|
+ GROUP BY class_code
|
|
|
+ ) count
|
|
|
+ FROM dt_define_type
|
|
|
+ WHERE
|
|
|
+ valid=TRUE AND group_code = '0' -- 查询通用定义
|
|
|
+ <if test="null!=category and category.length>0">
|
|
|
+ AND equipment_code = #{category}
|
|
|
+ </if>
|
|
|
+ ) temp
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryDefineInfoByObjType" resultType="java.util.Map">
|
|
|
+ SELECT class_code as code ,(SELECT name FROM dt_define_type WHERE code = class_code LIMIT 1 ) as name
|
|
|
+ FROM dt_object
|
|
|
+ WHERE valid=TRUE
|
|
|
+ <if test="null!=param.objType and param.objType.length>0">
|
|
|
+ AND obj_type=#{param.objType}
|
|
|
+ </if>
|
|
|
+ <if test="null!=param.projectId and param.projectId.length>0">
|
|
|
+ AND project_id=#{param.projectId}
|
|
|
+ </if>
|
|
|
+ <if test="null!=param.groupCode and param.groupCode.length>0">
|
|
|
+ AND group_code=#{param.groupCode}
|
|
|
+ </if>
|
|
|
+ GROUP BY class_code;
|
|
|
+ </select>
|
|
|
</mapper>
|