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