<?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>
|