1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="org.jeecg.modules.dnc.mapper.ProcessStreamMapper">
    <select id="getByUserPerms" resultType="org.jeecg.modules.dnc.entity.ProcessStream">
        select
               p.PROCESS_ID
             , p.product_id
             , p.component_id
             , p.parts_id
             , p.psv_id
             , p.PROCESS_NAME
             , p.PROCESS_CODE
             , p.CRAFT_NO
             , p.PROCESS_TYPE
             , p.PROCESSING_EQUIPMENT_MODEL
             , p.PROCESSING_EQUIPMENT_CODE
             , p.ASSEMBLE_STEP
             , p.ASSEMBLE_NAME
             , p.DESCRIPTION
             , p.CREATE_TIME
             , p.create_by
             , p.UPDATE_TIME
             , p.update_by
             , (select sys_user.realname from sys_user where p.create_by=sys_user.username) as createName
             , (select sys_user.realname from sys_user where p.update_by=sys_user.username) as updateName
        from nc_process_stream p
                 inner join
             (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s
             on p.PROCESS_ID = s.business_id and s.business_type='5'
        where p.delete_flag = 0
    </select>
    <select id="findByPartsAndComponents" resultType="org.jeecg.modules.dnc.entity.ProcessStream">
        SELECT
        *
        FROM
        nc_process_stream ps
        WHERE
        ps.PROCESS_ID IN (
        SELECT
        pss.PROCESS_ID
        FROM
        nc_process_stream pss
        WHERE
        1=1
        <if test="productId != null and productId != ''">
        AND pss.PRODUCT_ID = #{productId}
        </if>
        <if test="componentIds != null and componentIds.size() > 0">
        AND pss.COMPONENT_ID IN
        <foreach collection = "componentIds" item = "componentId" index = "index" open = "(" close= ")" separator = ",">
        #{ componentId }
        </foreach>
        </if>
        AND (
        pss.PARTS_ID IS NULL
        <if test="partsIds != null and partsIds.size() > 0">
        OR pss.PARTS_ID IN
        <foreach collection = "partsIds" item = "partsId" index = "index" open = "(" close = ")" separator = ",">
        #{ partsId }
        </foreach>
        </if>
        )
        );
 
    </select>
</mapper>