yangys
2024-10-30 c27b939fa5fa6ce4d712f7e9ced2ad811d69d5ec
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
<?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="com.qianwen.smartman.modules.smis.mapper.TrayMapper">
 
 
    <select id="groupTray" resultType="com.qianwen.smartman.modules.smis.vo.TrayTreeVO">
        select bt.id,
               bt.code,
               bt.name,
               bcg.id parentId,
               0 as   isGroup
        from blade_tray bt
                 LEFT JOIN blade_common_group_of_item bcgoi ON bt.id = bcgoi.item_id
                 LEFT JOIN blade_common_group bcg on bcgoi.group_id = bcg.id and bcg.is_deleted = 0
        where bt.is_deleted = 0
    </select>
 
    <select id="unUsedGroupTray" resultType="com.qianwen.smartman.modules.smis.vo.TrayTreeVO">
        select bt.id,
               bt.code,
               bt.name,
               bcg.id parentId,
               0 as   isGroup
        from blade_tray bt
                 LEFT JOIN blade_common_group_of_item bcgoi ON bt.id = bcgoi.item_id
                 LEFT JOIN blade_common_group bcg on bcgoi.group_id = bcg.id and bcg.is_deleted = 0
        where bt.is_deleted = 0
          and bt.in_use = 0
    </select>
 
    <select id="removeFaceFixture" resultType="java.lang.Integer">
        select count(*)
        from blade_fixture bf
        where bf.is_deleted = 0
        and exists(select *
        from prod_craft_process_ref_fixture bpcprf
        where bpcprf.fixture_id = bf.id
        and exists(select *
        from blade_tray_fixture btf
        where bpcprf.fixture_id = btf.fix_id
        and btf.is_deleted = 0
        and btf.tray_id in
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>)
        )
    </select>
 
</mapper>