jinlin
2024-09-06 3ecb68c427a627ad8e90d8c555655e7724be2d96
modules/mainPart/src/main/resources/mapper/taskReliability/OperatConditModelDao.xml
@@ -2,14 +2,22 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zt.life.modules.mainPart.taskReliability.dao.OperatConditModelDao">
    <delete id="deleteByOperatConditId">
        delete
        from operat_condit_model
        where operat_condit_id = ${operatConditId}
    </delete>
    <select id="getList" resultType="com.zt.life.modules.mainPart.taskReliability.model.OperatConditModel">
        SELECT a.id ,
               a.pid ,
               a.`NAME` as product,
        SELECT b.id,
               a.id                                                                   as iid,
               a.id                                                                   as product_id,
               a.pid,
               a.`NAME`                                                               as productName,
               c.model_name,
               b.model_id,
               b.id as operatConditModelId
               case when b.is_disabled is null or b.is_disabled = 1 then 1 else 0 end as is_disabled,
               ${operatConditId}                                                      as operatConditId
        FROM product_model a
                 LEFT JOIN operat_condit_model b
                           ON b.product_id = a.id
@@ -31,6 +39,42 @@
        )
          and a.product_type in (4, 3, 2, 10)
          AND a.is_delete = 0
        ORDER BY a.product_type, a.sort
    </select>
    <select id="getModelList" resultType="com.zt.life.modules.mainPart.taskReliability.model.ModelRbd">
        select *
        from model_rbd
        where product_id = ${productId}
          and is_delete = 0
    </select>
    <select id="getModelNodes" resultType="com.zt.life.modules.mainPart.taskReliability.model.ModelNodes">
        SELECT model_id, GROUP_CONCAT(node_id) as nodeIds
        FROM `model_rbd_node`
        group by model_id
    </select>
    <select id="getGKModelTrees" resultType="com.zt.life.modules.mainPart.taskReliability.model.OperatConditModel">
        select
        a.*
        FROM
        operat_condit_model a
        inner join operat_condit b on b.id=a.operat_condit_id
        where
        a.is_delete = 0
        and b.is_delete = 0
        <if test="productId!=null">
            and b.product_id=#{productId}
        </if>
        ORDER BY a.operat_condit_id, a.product_id
    </select>
    <select id="getGKModelAssembled" resultType="com.zt.life.modules.mainPart.taskReliability.model.OperatConditModel">
        select
            a.*
        FROM
            operat_condit_model a
        where
            a.is_delete = 0
        and a.is_disabled = 0
        and a.operat_condit_id=#{gkId}
    </select>
</mapper>