<?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.ext.CheckAttrExtMapper"> 
 | 
  
 | 
  <!-- 管理页面查询 --> 
 | 
  <resultMap id="CheckAttrExtListVO" type="doumeemes.dao.ext.vo.CheckAttrExtListVO" autoMapping="true"> 
 | 
    <id column="ID" jdbcType="INTEGER" property="id"/> 
 | 
    <association property="pmodel" javaType="doumeemes.dao.business.model.Procedures"> 
 | 
      <id column="PMODEL_ID" jdbcType="INTEGER" property="id"/> 
 | 
      <result column="PMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
      <result column="PMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
      <result column="PMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
      <result column="PMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
      <result column="PMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
      <result column="PMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> 
 | 
      <result column="PMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/> 
 | 
      <result column="PMODEL_DEPART_ID" jdbcType="INTEGER" property="departId"/> 
 | 
      <result column="PMODEL_CODE" jdbcType="VARCHAR" property="code"/> 
 | 
      <result column="PMODEL_NAME" jdbcType="VARCHAR" property="name"/> 
 | 
      <result column="PMODEL_SORTNUM" jdbcType="INTEGER" property="sortnum"/> 
 | 
      <result column="PMODEL_ORG_ID" jdbcType="INTEGER" property="orgId"/> 
 | 
      <result column="PMODEL_USER_ID" jdbcType="INTEGER" property="userId"/> 
 | 
      <result column="PMODEL_PICKING_WAREHOUSE_ID" jdbcType="INTEGER" property="pickingWarehouseId"/> 
 | 
      <result column="PMODEL_PRODUCE_WAREHOUSE_ID" jdbcType="INTEGER" property="produceWarehouseId"/> 
 | 
      <result column="PMODEL_LEVEL" jdbcType="TINYINT" property="level"/> 
 | 
    </association> 
 | 
  </resultMap> 
 | 
  <select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryCheckAttrExtDTO" resultMap="CheckAttrExtListVO"> 
 | 
    SELECT 
 | 
      `a`.`ID`, 
 | 
      `a`.`DELETED`, 
 | 
      `a`.`CREATE_USER`, 
 | 
      `a`.`CREATE_TIME`, 
 | 
      `a`.`UPDATE_USER`, 
 | 
      `a`.`UPDATE_TIME`, 
 | 
      `a`.`REMARK`, 
 | 
      `a`.`ROOT_DEPART_ID`, 
 | 
      `a`.`PROCEDURE_ID`, 
 | 
      `a`.`TYPE`, 
 | 
      `a`.`SORTNUM`, 
 | 
      `a`.`STATUS`, 
 | 
      `a`.`TIPS`, 
 | 
      `a`.`NAME`, 
 | 
    a.IS_REQUIRED, 
 | 
    `pmodel`.`ID` AS PMODEL_ID, 
 | 
    `pmodel`.`DELETED` AS PMODEL_DELETED, 
 | 
    `pmodel`.`CREATE_USER` AS PMODEL_CREATE_USER, 
 | 
    `pmodel`.`CREATE_TIME` AS PMODEL_CREATE_TIME, 
 | 
    `pmodel`.`UPDATE_USER` AS PMODEL_UPDATE_USER, 
 | 
    `pmodel`.`UPDATE_TIME` AS PMODEL_UPDATE_TIME, 
 | 
    `pmodel`.`REMARK` AS PMODEL_REMARK, 
 | 
    `pmodel`.`ROOT_DEPART_ID` AS PMODEL_ROOT_DEPART_ID, 
 | 
    `pmodel`.`DEPART_ID` AS PMODEL_DEPART_ID, 
 | 
    `pmodel`.`CODE` AS PMODEL_CODE, 
 | 
    `pmodel`.`NAME` AS PMODEL_NAME, 
 | 
    `pmodel`.`SORTNUM` AS PMODEL_SORTNUM, 
 | 
    `pmodel`.`ORG_ID` AS PMODEL_ORG_ID, 
 | 
    `pmodel`.`USER_ID` AS PMODEL_USER_ID, 
 | 
    `pmodel`.`PICKING_WAREHOUSE_ID` AS PMODEL_PICKING_WAREHOUSE_ID, 
 | 
    `pmodel`.`PRODUCE_WAREHOUSE_ID` AS PMODEL_PRODUCE_WAREHOUSE_ID, 
 | 
    `pmodel`.`LEVEL` AS PMODEL_LEVEL 
 | 
    FROM `check_attr` `a` 
 | 
    LEFT JOIN `procedures` `pmodel` ON a.PROCEDURE_ID=pmodel.ID 
 | 
    <where> 
 | 
      <if test="id != null"> 
 | 
        AND `a`.`ID` = #{id} 
 | 
      </if> 
 | 
      <if test="deleted != null"> 
 | 
        AND `a`.`DELETED` = #{deleted} 
 | 
      </if> 
 | 
      <if test="createUser != null"> 
 | 
        AND `a`.`CREATE_USER` = #{createUser} 
 | 
      </if> 
 | 
      <if test="createTime != null"> 
 | 
        AND `a`.`CREATE_TIME` = #{createTime} 
 | 
      </if> 
 | 
      <if test="updateUser != null"> 
 | 
        AND `a`.`UPDATE_USER` = #{updateUser} 
 | 
      </if> 
 | 
      <if test="updateTime != null"> 
 | 
        AND `a`.`UPDATE_TIME` = #{updateTime} 
 | 
      </if> 
 | 
      <if test="remark != null and remark != ''"> 
 | 
        AND `a`.`REMARK` = #{remark} 
 | 
      </if> 
 | 
      <if test="rootDepartId != null"> 
 | 
        AND `a`.`ROOT_DEPART_ID` = #{rootDepartId} 
 | 
      </if> 
 | 
      <if test="procedureId != null"> 
 | 
        AND `a`.`PROCEDURE_ID` = #{procedureId} 
 | 
      </if> 
 | 
      <if test="type != null"> 
 | 
        AND `a`.`TYPE` = #{type} 
 | 
      </if> 
 | 
      <if test="sortnum != null"> 
 | 
        AND `a`.`SORTNUM` = #{sortnum} 
 | 
      </if> 
 | 
      <if test="status != null"> 
 | 
        AND `a`.`STATUS` = #{status} 
 | 
      </if> 
 | 
      <if test="tips != null and tips != ''"> 
 | 
        AND `a`.`TIPS` = #{tips} 
 | 
      </if> 
 | 
      <if test="name != null and name != ''"> 
 | 
        AND `a`.`NAME` like concat('%',#{name},'%') 
 | 
      </if> 
 | 
  
 | 
      <if test="pmodelDepartId != null and pmodelDepartId != ''"> 
 | 
        AND `pmodel`.`DEPART_ID`  = #{pmodelDepartId} 
 | 
      </if> 
 | 
      <if test="departIds != null and departIds.size()>0"> 
 | 
        AND `pmodel`.`ORG_ID`  in <foreach collection="departIds" item="item" separator="," open="(" close=")">#{item}</foreach> 
 | 
      </if> 
 | 
    </where> 
 | 
    order by  `a`.`SORTNUM` asc 
 | 
  </select> 
 | 
</mapper> 
 |