<?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="doumeemes.dao.business.BackOrderDetailMapper"> 
 | 
  
 | 
  <resultMap id="BaseResultMap" type="doumeemes.dao.business.model.BackOrderDetail"> 
 | 
    <id column="ID" jdbcType="INTEGER" property="id"/> 
 | 
    <result column="DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
    <result column="CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
    <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
    <result column="UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
    <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
    <result column="REMARK" jdbcType="VARCHAR" property="remark"/> 
 | 
    <result column="ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/> 
 | 
    <result column="ORDER_DEPART_ID" jdbcType="INTEGER" property="orderDepartId"/> 
 | 
    <result column="BACKORDER_ID" jdbcType="INTEGER" property="backorderId"/> 
 | 
    <result column="MATERIAL_ID" jdbcType="INTEGER" property="materialId"/> 
 | 
    <result column="BATCH" jdbcType="VARCHAR" property="batch"/> 
 | 
    <result column="APPLIANCE_ID" jdbcType="INTEGER" property="applianceId"/> 
 | 
    <result column="PROCEDURE_ID" jdbcType="INTEGER" property="procedureId"/> 
 | 
    <result column="NUM" jdbcType="DECIMAL" property="num"/> 
 | 
  </resultMap> 
 | 
  <sql id="Base_Column_List"> 
 | 
    `ID`, `DELETED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `REMARK`, `ROOT_DEPART_ID`, `ORDER_DEPART_ID`, `BACKORDER_ID`, `MATERIAL_ID`, `BATCH`, `APPLIANCE_ID`, `NUM` 
 | 
  </sql> 
 | 
  <select id="selectList" parameterType="doumeemes.dao.business.model.BackOrderDetail" resultMap="BaseResultMap"> 
 | 
    select a.*, b.code as applianceCode,d.name as materialName,d.code as materialCode 
 | 
    ,f.name as procedureName,u.`NAME` as unitName,u.id as unitId 
 | 
    from `back_order_detail` a 
 | 
    left join appliances b on a.APPLIANCE_ID = b.ID 
 | 
    left join material_distribute c on a.MATERIAL_ID = c.ID 
 | 
    left join material d on c.MATERIAL_ID=d.id 
 | 
    left join procedures f on f.ID=a.PROCEDURE_ID 
 | 
    left join unit u on u.ID=c.UNIT_ID 
 | 
    left join backorder o on o.ID=a.BACKORDER_ID 
 | 
    <where> 
 | 
      <if test="id != null"> 
 | 
        AND `a`.`ID` = #{id} 
 | 
      </if> 
 | 
      <if test="deleted != null"> 
 | 
        AND `a`.`DELETED` = #{deleted} 
 | 
      </if> 
 | 
      <if test="backorderId != null"> 
 | 
        AND `a`.`BACKORDER_ID` = #{backorderId} 
 | 
      </if> 
 | 
      <if test="rootDepartId != null"> 
 | 
        AND `a`.`ROOT_DEPART_ID` = #{rootDepartId} 
 | 
      </if> 
 | 
    </where> 
 | 
  </select> 
 | 
  
 | 
</mapper> 
 |