yangys
2025-11-18 8e944cfabb253fc2556588e308e282586043f7b0
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?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.FixtureMapper">
 
    <resultMap id="fixtureVO" type="com.qianwen.smartman.modules.smis.vo.FixtureVO">
        <id column="id" property="id"/>
        <result column="code" property="code"/>
        <result column="name" property="name"/>
        <result column="description" property="description"/>
        <result column="avatar" property="avatar"/>
        <result column="fixtureStatus" property="fixtureStatus"/>
        <result column="fixtureGroupName" property="fixtureGroupName"/>
        <result column="fixtureGroupId" property="fixtureGroupId"/>
        <result column="in_use" property="inUse"/>
        <result column="trayFixtureId" property="trayFixtureId"/>
        <result column="trayId" property="trayId"/>
        <result column="surfaceId" property="surfaceId"/>
        <result column="trayCode" property="trayCode"/>
        <result column="trayName" property="trayName"/>
        <result column="surfaceCode" property="surfaceCode"/>
        <result column="surfaceName" property="surfaceName"/>
        <collection property="toolAppendixVOList" ofType="com.qianwen.smartman.modules.smis.vo.ToolAppendixVO">
            <id column="fileId" property="id"/>
            <result column="file_length" property="fileLength"/>
            <result column="file_name" property="fileName"/>
            <result column="file_link" property="fileLink"/>
            <result column="object_key" property="objectKey"/>
            <result column="parentId" property="parentId"/>
            <result column="createTime" property="createTime"/>
            <result column="content_type" property="contentType"/>
        </collection>
    </resultMap>
 
    <select id="page" resultMap="fixtureVO">
        SELECT
        f.code,
        f.fixture_status fixtureStatus,
        f.id,
        a.parent_id parentId,
        f.name,
        f.description,
        f.avatar,
        f.in_use,
        a.id fileId,
        a.file_length,
        a.file_name,
        a.file_link,
        a.content_type,
        a.object_key,
        a.create_time createTime,
        g.name fixtureGroupName,
        g.id fixtureGroupId,
        tf.id trayFixtureId,
        tf.tray_id trayId,
        tf.face_id surfaceId,
        t.code trayCode,
        t.name trayName,
        s.code surfaceCode,
        s.name surfaceName
        FROM
        blade_fixture f
        LEFT JOIN blade_common_group_of_item i ON f.id = i.item_id
        LEFT JOIN blade_common_group g ON i.group_id = g.id
        LEFT JOIN blade_tool_appendix a ON f.id = a.parent_id AND a.is_deleted = 0
        LEFT JOIN blade_tray_fixture tf ON tf.fix_id = f.id AND tf.is_deleted = 0
        LEFT JOIN blade_tray t ON t.id = tf.tray_id and t.is_deleted = 0
        LEFT JOIN blade_tray_surface s ON s.id = tf.face_id and s.is_deleted = 0
        WHERE
        f.is_deleted = 0
        AND g.is_deleted = 0
        <if test="groupId != null and groupId != ''">
            and g.id = #{groupId}
        </if>
        <if test="keyword != null and keyword != ''">
            and (f.code Like concat(#{keyword},'%') or f.name Like concat(#{keyword},'%') )
        </if>
        order by f.create_time desc, f.id desc
    </select>
    <select id="detail" resultMap="fixtureVO">
        SELECT f.code,
               f.fixture_status fixtureStatus,
               f.id,
               a.parent_id      parentId,
               f.name,
               f.description,
               f.in_use,
               f.avatar,
               a.id             fileId,
               a.file_length,
               a.file_name,
               a.file_link,
               a.content_type,
               a.object_key,
               a.create_time    createTime,
               g.name           fixtureGroupName,
               g.id             fixtureGroupId,
               tf.id            trayFixtureId,
               tf.tray_id       trayId,
               tf.face_id       surfaceId,
               t.code           trayCode,
               t.name           trayName,
               s.code           surfaceCode,
               s.name           surfaceName
        FROM blade_fixture f
                 LEFT JOIN blade_common_group_of_item i ON f.id = i.item_id
                 LEFT JOIN blade_common_group g ON i.group_id = g.id
                 LEFT JOIN blade_tool_appendix a ON f.id = a.parent_id AND a.is_deleted = 0
                 LEFT JOIN blade_tray_fixture tf ON tf.fix_id = f.id AND tf.is_deleted = 0
                 LEFT JOIN blade_tray t ON t.id = tf.tray_id and t.is_deleted = 0
                 LEFT JOIN blade_tray_surface s ON s.id = tf.face_id and s.is_deleted = 0
        WHERE f.is_deleted = 0
          AND g.is_deleted = 0
          and f.id = #{id}
    </select>
    <select id="listNotIn" resultType="com.qianwen.smartman.modules.smis.vo.FixtureGroupFixtureVO">
        SELECT
        f.code,
        f.id,
        f.name,
        g.id parentId
        FROM
        blade_fixture f
        INNER JOIN blade_common_group_of_item i ON f.id = i.item_id
        INNER JOIN blade_common_group g ON i.group_id = g.id
        WHERE
        f.is_deleted = 0
        and g.is_deleted = 0
        <if test="fixtureIdList != null and fixtureIdList.size > 0">
            and f.id NOT IN
            <foreach collection="fixtureIdList" item="fixtureId" open="(" separator="," close=")">
                #{fixtureId}
            </foreach>
        </if>
    </select>
    <select id="listNotInUse" resultType="com.qianwen.smartman.modules.smis.vo.FixtureGroupFixtureVO">
        SELECT f.code,
               f.id,
               f.name,
               g.id parentId
        FROM blade_fixture f
                 INNER JOIN blade_common_group_of_item i ON f.id = i.item_id
                 INNER JOIN blade_common_group g ON i.group_id = g.id
        WHERE f.is_deleted = 0
          and g.is_deleted = 0
          and f.in_use = 0
    </select>
 
    <select id="groupFixture" resultType="com.qianwen.smartman.modules.smis.vo.GroupTreeVO">
        select bf.id,
               bf.code,
               bf.name,
               bcg.id   parentId,
               0 as isGroup
        from blade_fixture bf
                 inner join blade_common_group_of_item bcgoi on bf.id = bcgoi.item_id
                 inner join blade_common_group bcg on bcgoi.group_id = bcg.id
        where bf.is_deleted = 0
          and bcg.is_deleted = 0
    </select>
</mapper>