|
@@ -91,7 +91,7 @@
|
|
|
</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
|
|
|
+ SELECT re.obj_from as 'id',count(1) as count,obj.class_code, df.equipment_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
|
|
@@ -108,32 +108,29 @@
|
|
|
<if test="null!=projectId and projectId.length>0">
|
|
|
AND obj.project_id=#{projectId}
|
|
|
</if>
|
|
|
- GROUP BY obj.class_code,re.obj_from,df.system_code,df.name
|
|
|
+ GROUP BY obj.class_code,re.obj_from,df.equipment_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 dt_define_type.`code`,dt_define_type.`name`,IFNULL(temp.count,0) AS count FROM dt_define_type
|
|
|
+ LEFT JOIN (SELECT dt_object.class_code,COUNT(dt_object.id) AS count FROM dt_object
|
|
|
+ INNER JOIN dt_relation ON (dt_relation.obj_to=dt_object.id AND dt_object.obj_type='component'
|
|
|
+ <if test="null!=equipmentId and equipmentId.length>0">
|
|
|
+ AND dt_relation.obj_from=#{equipmentId}
|
|
|
+ </if>
|
|
|
+ AND dt_relation.graph_code='MechSubset' AND dt_relation.rel_code='Eq2Ec'
|
|
|
+ <if test="null!=projectId and projectId.length>0">
|
|
|
+ AND dt_object.project_id=#{projectId}
|
|
|
+ </if>
|
|
|
+ <if test="null!=groupCode and groupCode.length>0">
|
|
|
+ AND dt_object.group_code=#{groupCode}
|
|
|
+ </if>
|
|
|
+ AND dt_object.valid=TRUE AND dt_relation.valid=TRUE) GROUP BY dt_object.class_code) AS temp
|
|
|
+ ON(temp.class_code=dt_define_type.`code`) WHERE dt_define_type.obj_type='component'
|
|
|
+ <if test="null!=category and category.length>0">
|
|
|
+ AND dt_define_type.`code` LIKE CONCAT(#{category},'%')
|
|
|
+ </if>
|
|
|
+ AND dt_define_type.project_id='0' AND dt_define_type.group_code = '0' AND dt_define_type.valid=TRUE;
|
|
|
</select>
|
|
|
|
|
|
<select id="queryDefineInfoByObjType" resultType="java.util.Map">
|