yangys
2024-09-04 04c57331cf84c8f606c2838dcb6fe5463fb9b68c
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
<?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.cps.mapper.TraySurfaceMapper">
 
 
    <select id="listTraySurface" resultType="com.qianwen.smartman.modules.cps.vo.TraySurfaceVO">
        select bts.id,
               bts.tray_id   trayId,
               bts.name,
               bts.code,
               program_code  programCode,
               bts.in_use    inUse,
               count(btf.id) fixtureNum
        from blade_tray_surface bts
                 left join blade_tray_fixture btf on bts.id = btf.face_id and btf.is_deleted = 0
        where bts.is_deleted = 0
          and bts.tray_id = #{trayId}
        group by bts.id, bts.tray_id, bts.name, bts.code, program_code, bts.in_use
        order by bts.code
    </select>
 
    <select id="listByTrayCodeName" resultType="com.qianwen.smartman.modules.cps.entity.TraySurface">
        select bts.id,
        tray_id trayId,
        bts.name,
        bts.code,
        program_code programCode,
        bts.in_use inUse
        from blade_tray_surface bts
        INNER JOIN blade_tray bt on bts.tray_id = bt.id
        where bts.is_deleted = 0
        and bt.is_deleted = 0
        <if test="ew!=null">
            and ${ew.sqlSegment}
        </if>
    </select>
 
    <select id="removeFixture" resultType="java.lang.Integer">
        select count(*)
        from blade_fixture bf
        where bf.is_deleted = 0
          and exists(select *
                     from blade_production_craft_process_related_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.face_id = #{faceId}
                                    and btf.tray_id = #{trayId})
            )
    </select>
</mapper>