刘小明
2024-08-26 0c479f17e5f9ff3ad638f3af783cf22b0a77fbd0
pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml
@@ -29,6 +29,8 @@
                     select="com.dy.pmsGlobal.daoPr.PrBatchNumberMapper.selectBatchNoById" fetchType="eager"/>
        <association property="processName" column="process_id" javaType="java.lang.Long"
                     select="com.dy.pmsGlobal.daoPr.PrProductionProcessMapper.selectProcessNameById" fetchType="eager"/>
        <association property="orderName" column="order_id" javaType="java.lang.Long"
                     select="com.dy.pmsGlobal.daoPr.PrOrderMapper.selectOrderNameById" fetchType="eager" />
        <collection property="process" ofType="com.dy.pmsGlobal.pojoPr.PrProductionProcess"
                    select="com.dy.pmsGlobal.daoPr.PrProductionProcessMapper.selectByPrimaryKey" fetchType="eager"
                    column="process_id"/>
@@ -55,6 +57,7 @@
                    select="com.dy.pmsGlobal.daoPr.PrProductionProcessMapper.selectByProcessId" fetchType="eager"
                    column="process_id"/>
    </resultMap>
    <sql id="Base_Column_List">
        id,order_id
@@ -404,4 +407,33 @@
        set deleted = 1
        where id = #{id}
    </update>
    <select id="countByPlanIdAndNodeId" resultType="java.lang.Long">
        select count(1) from pr_assembly_plan ap
        left join pr_production_node pn on ap.process_id = pn.process_id
        where ap.id = #{planId}  and pn.id= #{nodeId}
    </select>
    <resultMap id="jsonResultMap" type="java.util.HashMap">
        <id column="planId" property="planId"/>
        <result column="planName" property="planName"/>
        <result column="status" property="status"/>
        <collection property="nodes" javaType="java.util.HashMap">
            <result column="content" property="content"/>
            <result column="nodeId" property="nodeId"/>
        </collection>
    </resultMap>
    <select id="selectByPlanName" resultMap="jsonResultMap">
        select ap.id planId,ap.name planName,ap.`status`,pn.id nodeId,pn.content from pr_assembly_plan ap
        left join pr_production_node pn on ap.process_id = pn.process_id
        where status != -1
        <if test="planName != null and planName!= null">
            and ap.name like concat('%', #{planName}, '%')
        </if>
    </select>
</mapper>