<?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="cn.pluss.platform.mapper.DeviceTransferDetailMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.pluss.platform.entity.DeviceTransferDetail">
        <id column="id" property="id" />
        <result column="tid" property="tid" />
        <result column="deviceNo" property="deviceNo" />
        <result column="createTime" property="createTime" />
        <result column="batchNo" property="batchNo" />
    </resultMap>


    <select id="selectListByTid" resultType="cn.pluss.platform.vo.DeviceTransferDetailVO">
        SELECT dtd.*,
               ds.snNo,
               dt.name as deviceName,
               IF(ds.status = '3',ds.actMercName,'未绑定') as bindDesc,
               ds.inStockTime
        from tb_pluss_device_transfer_detail dtd
        left join tb_pluss_device_stock ds on  dtd.deviceNo = ds.snNo
        left join tb_pluss_device_type dt on  ds.`code` = dt.`code`
        where dtd.tid = #{tid}
    </select>
</mapper>
