| | |
| | | </delete> |
| | | |
| | | <select id="searchNodes" resultType="com.zt.life.core.dto.SearchNodesDto"> |
| | | SELECT INFO_ID AS id, |
| | | LABEL AS name, |
| | | CONNECT_GROUP AS groups, |
| | | LAYER AS level |
| | | SELECT info_id AS id, |
| | | label AS name, |
| | | layer AS level, |
| | | connect_group AS `GROUPS` |
| | | from zt_boat_tree |
| | | where label like '%${name}%' |
| | | and CONNECT_GROUP like '%${pid}%' |
| | | group by INFO_ID |
| | | order by LABEL |
| | | and connect_group like '%${pid}%' |
| | | group by info_id |
| | | order by label |
| | | </select> |
| | | |
| | | <select id="getNamesByIds" resultType="com.zt.common.entity.MapData"> |
| | | SELECT INFO_ID AS id, |
| | | LABEL AS name |
| | | SELECT info_id AS id, |
| | | label AS name |
| | | from zt_boat_tree |
| | | where INFO_ID in (${ids}) |
| | | where info_id in (${ids}) |
| | | and layer in ('side','system1','system2','equipment','componentFolder') |
| | | group by INFO_ID |
| | | group by info_id |
| | | order by name |
| | | </select> |
| | | |
| | | <select id="getAll" resultType="com.zt.life.core.model.ZtProduct"> |
| | | select * |
| | | from ( |
| | | SELECT ID as dataId, |
| | | INFO_ID AS productId, |
| | | LABEL AS name, |
| | | CONNECT_ID AS parentProductId, |
| | | CONNECT_GROUP AS parentProductIds, |
| | | LAYER AS level, |
| | | PROJECT, |
| | | SORT, |
| | | ISDELETE AS is_delete, |
| | | CREATE_BY AS CREATEOR, |
| | | CREATE_TIME AS CREATE_DATE, |
| | | SELECT id as dataId, |
| | | info_id AS productId, |
| | | label AS name, |
| | | connect_id AS parentProductId, |
| | | connect_group AS parentProductIds, |
| | | layer AS level, |
| | | project, |
| | | sort, |
| | | isdelete AS is_delete, |
| | | create_by AS CREATEOR, |
| | | create_time AS CREATE_DATE, |
| | | case when exists(select 1 from eqpt_used c where b.info_ID = c.product_id) then 0 else 1 end |
| | | as hasNotData |
| | | FROM (SELECT A.* |
| | | -- ROW_NUMBER() OVER (PARTITION BY A.INFO_ID ORDER BY A.CREATE_TIME desc) AS NEWINDEX |
| | | FROM ZT_BOAT_TREE A |
| | | where ISDELETE = 0 |
| | | FROM zt_boat_tree A |
| | | where isdelete = 0 |
| | | ) B |
| | | ) c order by sort |
| | | </select> |
| | | |
| | | <select id="getAllNodes" resultType="com.zt.life.core.model.ZtProduct"> |
| | | SELECT data_Id, |
| | | product_Id, |
| | | SELECT data_id, |
| | | product_id, |
| | | name, |
| | | parent_Product_Id, |
| | | parent_Product_Ids, |
| | | parent_product_id, |
| | | parent_product_ids, |
| | | level |
| | | FROM VIEW_ZT_BOAT_TREE |
| | | where level is not null and name is not null and product_Id is not null |
| | | FROM view_zt_boat_tree |
| | | where level is not null and name is not null and product_id is not null |
| | | </select> |
| | | |
| | | <select id="getTreeNodes" resultType="com.zt.life.core.model.ZtProduct"> |
| | | select * from ( |
| | | SELECT b.*, |
| | | case when exists(select 1 from view_zt_boat_tree c where b.product_id = c.parent_Product_Id and c.IS_DELETE=0 and c.level in ('system1','system2','equipment')) then 0 else 1 end |
| | | case when exists(select 1 from view_zt_boat_tree c where b.product_id = c.parent_product_id and c.is_delete=0 and c.level in ('system1','system2','equipment')) then 0 else 1 end |
| | | as leaf, |
| | | case when exists(select 1 from product_data c where c.id = b.product_id and hasLifeData = 1) then 0 else 1 end |
| | | case when exists(select 1 from product_data c where c.id = b.product_id ) then 0 else 1 end |
| | | as hasNotData |
| | | FROM view_zt_boat_tree B |
| | | where IS_DELETE = 0 |
| | | where is_delete = 0 |
| | | <if test="pid!=null and pid!=''"> |
| | | and parent_Product_Id=#{pid} and level in ('system1','system2','equipment') |
| | | and parent_product_id=#{pid} and level in ('system1','system2','equipment') |
| | | </if> |
| | | <if test="pid==null or pid==''"> |
| | | and level in ('side') |
| | |
| | | |
| | | <select id="getShipList" resultType="com.zt.life.core.model.ZtProduct"> |
| | | SELECT |
| | | ID as dataId, |
| | | INFO_ID AS productId, |
| | | LABEL AS name, |
| | | CONNECT_ID AS parentProductId, |
| | | CONNECT_GROUP AS parentProductIds, |
| | | LAYER AS level, |
| | | PROJECT, |
| | | SORT, |
| | | ISDELETE AS is_delete, |
| | | CREATE_BY AS CREATEOR, |
| | | CREATE_TIME AS CREATE_DATE |
| | | id as dataId, |
| | | info_id AS productId, |
| | | label AS name, |
| | | connect_id AS parentProductId, |
| | | connect_group AS parentProductIds, |
| | | layer AS level, |
| | | project, |
| | | sort, |
| | | isdelete AS is_delete, |
| | | create_by AS CREATEOR, |
| | | create_time AS CREATE_DATE |
| | | |
| | | FROM ZT_BOAT_TREE A |
| | | where a.ISDELETE = 0 and a.LAYER='side' |
| | | FROM zt_boat_tree A |
| | | where a.isdelete = 0 and a.layer='side' |
| | | <if test="localAear!=null and localAear != ''"> |
| | | and INFO_ID in (select ship_id from SYS_AREA_SHIP where area='${localAear}') |
| | | and info_id in (select ship_id from sys_area_ship where area='${localAear}') |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | FROM view_zt_boat_tree |
| | | WHERE 1=1 AND is_delete=0 |
| | | <if test='pid=="0"'> |
| | | and product_id IN( SELECT SHIP_ID |
| | | and product_id IN( SELECT ship_id |
| | | FROM |
| | | SYS_AREA_SHIP |
| | | sys_area_ship |
| | | WHERE |
| | | AREA = 'sy' |
| | | area = 'sy' |
| | | ) |
| | | </if> |
| | | <if test="pid!='0'.toString()"> |
| | | and Parent_Product_ID = #{pid} |
| | | and parent_product_id = #{pid} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getSubList" parameterType="java.lang.String" resultType="com.zt.life.core.model.ZtProduct"> |
| | | SELECT INFO_ID as product_id, LABEL as name, layer level |
| | | SELECT info_id as product_id, label as name, layer level |
| | | FROM zt_boat_tree |
| | | WHERE 1=1 AND ISDELETE=0 |
| | | WHERE 1=1 AND isdelete=0 |
| | | <if test='pid=="0"'> |
| | | layer = 'side' |
| | | </if> |
| | |
| | | and CONCAT(',',#{ids},',') like CONCAT('%,',product_id,',%') |
| | | </if> |
| | | <if test="ids==null or ids==''"> |
| | | and Parent_Product_ID = -1 |
| | | and parent_product_id = -1 |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | product_id AS id, |
| | | name |
| | | FROM view_zt_boat_tree A |
| | | where a.IS_DELETE = 0 |
| | | where a.is_delete = 0 |
| | | <if test="shipId!=null"> |
| | | and PARENT_PRODUCT_IDS like concat('%,',#{shipId},',%') |
| | | and parent_product_ids like concat('%,',#{shipId},',%') |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | view_zt_boat_tree b |
| | | where a.level in ('side','system1','system2','equipment','componentFolder') |
| | | and b.product_id = '${id}' |
| | | and (concat(',',b.parent_Product_Ids,',') like concat('%,',a.product_id,',%') or b.product_id = a.product_id) |
| | | and (concat(',',b.parent_product_ids,',') like concat('%,',a.product_id,',%') or b.product_id = a.product_id) |
| | | order by level2 |
| | | ) c |
| | | </select> |
| | | |
| | | <select id="getOneByProductId" resultType="com.zt.life.core.model.ZtProduct"> |
| | | SELECT `p`.`ID` AS `data_id`, |
| | | `p`.`INFO_ID` AS `product_Id`, |
| | | `p`.`LABEL` AS `name`, |
| | | `p`.`CONNECT_ID` AS `parent_Product_Id`, |
| | | `p`.`CONNECT_GROUP` AS `parent_Product_Ids`, |
| | | `p`.`LAYER` AS `level`, |
| | | `p`.`PROJECT` AS `PROJECT`, |
| | | `p`.`SORT` AS `SORT`, |
| | | `p`.`ISDELETE` AS `is_delete`, |
| | | `p`.`CREATE_BY` AS `CREATEOR`, |
| | | `p`.`CREATE_TIME` AS `CREATE_DATE` |
| | | SELECT `p`.`id` as `data_id`, |
| | | `p`.`info_id` as `product_id`, |
| | | `p`.`label` as `name`, |
| | | `p`.`connect_id` as `parent_product_id`, |
| | | `p`.`connect_group` as `parent_product_ids`, |
| | | `p`.`layer` as `level`, |
| | | `p`.`project` as `project`, |
| | | `p`.`sort` as `sort`, |
| | | `p`.`isdelete` as `is_delete`, |
| | | `p`.`create_by` as `createor`, |
| | | `p`.`create_time` as `create_date` |
| | | FROM zt_boat_tree p |
| | | WHERE p.isdelete = 0 |
| | | and p.info_id =concat(#{productId}) |
| | |
| | | </select> |
| | | |
| | | <select id="getByProductIdList" resultType="com.zt.life.core.model.ZtProduct"> |
| | | SELECT `p`.`ID` AS `data_id`, |
| | | `p`.`INFO_ID` AS `product_Id`, |
| | | `p`.`LABEL` AS `name`, |
| | | `p`.`CONNECT_ID` AS `parent_Product_Id`, |
| | | `p`.`CONNECT_GROUP` AS `parent_Product_Ids`, |
| | | `p`.`LAYER` AS `level`, |
| | | `p`.`PROJECT` AS `PROJECT`, |
| | | `p`.`SORT` AS `SORT`, |
| | | `p`.`ISDELETE` AS `is_delete`, |
| | | `p`.`CREATE_BY` AS `CREATEOR`, |
| | | `p`.`CREATE_TIME` AS `CREATE_DATE` |
| | | SELECT `p`.`id` as `data_id`, |
| | | `p`.`info_id` as `product_id`, |
| | | `p`.`label` as `name`, |
| | | `p`.`connect_id` as `parent_product_id`, |
| | | `p`.`connect_group` as `parent_product_ids`, |
| | | `p`.`layer` as `level`, |
| | | `p`.`project` as `project`, |
| | | `p`.`sort` as `sort`, |
| | | `p`.`isdelete` as `is_delete`, |
| | | `p`.`create_by` as `createor`, |
| | | `p`.`create_time` as `create_date` |
| | | FROM zt_boat_tree p |
| | | WHERE p.isdelete = 0 |
| | | and (concat(',',#{parentProductIds},',') like concat('%,',p.info_id,',%')) |
| | | and p.layer in ('model','side','system1','system2','equipment','componentFolder') |
| | | group by INFO_ID |
| | | group by info_id |
| | | </select> |
| | | |
| | | <select id="getByProductId" resultType="com.zt.life.core.model.ZtProduct"> |
| | |
| | | ,p6.product_id as deviceProductId |
| | | ,p6.name as deviceName |
| | | FROM view_zt_boat_tree p |
| | | left join view_zt_boat_tree p2 on concat(',',p.parent_Product_Ids,',',p.product_id,',') like concat('%,',p2.product_id,',%') and p2.level = 'model' |
| | | left join view_zt_boat_tree p3 on concat(',',p.parent_Product_Ids,',',p.product_id,',') like concat('%,',p3.product_id,',%') and p3.level = 'side' |
| | | left join view_zt_boat_tree p4 on concat(',',p.parent_Product_Ids,',',p.product_id,',') like concat('%,',p4.product_id,',%') and p4.level = 'system1' |
| | | left join view_zt_boat_tree p5 on concat(',',p.parent_Product_Ids,',',p.product_id,',') like concat('%,',p5.product_id,',%') and p5.level = 'system2' |
| | | left join view_zt_boat_tree p6 on concat(',',p.parent_Product_Ids,',',p.product_id,',') like concat('%,',p6.product_id,',%') and p6.level in ('equipment','componentFolder') |
| | | left join view_zt_boat_tree p2 on concat(',',p.parent_product_ids,',',p.product_id,',') like concat('%,',p2.product_id,',%') and p2.level = 'model' |
| | | left join view_zt_boat_tree p3 on concat(',',p.parent_product_ids,',',p.product_id,',') like concat('%,',p3.product_id,',%') and p3.level = 'side' |
| | | left join view_zt_boat_tree p4 on concat(',',p.parent_product_ids,',',p.product_id,',') like concat('%,',p4.product_id,',%') and p4.level = 'system1' |
| | | left join view_zt_boat_tree p5 on concat(',',p.parent_product_ids,',',p.product_id,',') like concat('%,',p5.product_id,',%') and p5.level = 'system2' |
| | | left join view_zt_boat_tree p6 on concat(',',p.parent_product_ids,',',p.product_id,',') like concat('%,',p6.product_id,',%') and p6.level in ('equipment','componentFolder') |
| | | WHERE p.is_delete = 0 and p.product_id =concat(#{productId}) |
| | | limit 1 |
| | | </select> |