<?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.MaterialExtMapper"> 
 | 
  
 | 
  <!-- 管理页面查询 --> 
 | 
  <resultMap id="MaterialExtListVO" type="doumeemes.dao.ext.vo.MaterialExtListVO" autoMapping="true"> 
 | 
    <id column="ID" jdbcType="INTEGER" property="id"/> 
 | 
    <association property="umodel" javaType="doumeemes.dao.business.model.Unit"> 
 | 
      <id column="UMODEL_ID" jdbcType="INTEGER" property="id"/> 
 | 
      <result column="UMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
      <result column="UMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
      <result column="UMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
      <result column="UMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
      <result column="UMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
      <result column="UMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> 
 | 
      <result column="UMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/> 
 | 
      <result column="UMODEL_NAME" jdbcType="VARCHAR" property="name"/> 
 | 
      <result column="UMODEL_TYPE" jdbcType="TINYINT" property="type"/> 
 | 
      <result column="UMODEL_STATUS" jdbcType="TINYINT" property="status"/> 
 | 
    </association> 
 | 
    <association property="cumodel" javaType="doumeemes.dao.business.model.CategoryUnion"> 
 | 
      <id column="CUMODEL_ID" jdbcType="INTEGER" property="id"/> 
 | 
      <result column="CUMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
      <result column="CUMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
      <result column="CUMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
      <result column="CUMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
      <result column="CUMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
      <result column="CUMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> 
 | 
      <result column="CUMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/> 
 | 
    </association> 
 | 
  </resultMap> 
 | 
  <select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryMaterialExtDTO" resultMap="MaterialExtListVO"> 
 | 
    SELECT 
 | 
      `a`.`ID`, 
 | 
      `a`.`DELETED`, 
 | 
      `a`.`CREATE_USER`, 
 | 
      `a`.`CREATE_TIME`, 
 | 
      `a`.`UPDATE_USER`, 
 | 
      `a`.`UPDATE_TIME`, 
 | 
      `a`.`REMARK`, 
 | 
      `a`.`ROOT_DEPART_ID`, 
 | 
      `a`.`NAME`, 
 | 
      `a`.`CODE`, 
 | 
      `a`.`ATTR`, 
 | 
      `a`.`UNION_NAME`, 
 | 
      `a`.`UNIT_ID`, 
 | 
      `a`.`CATE_UNION_ID`, 
 | 
      `a`.`FORMATION`, 
 | 
      `a`.`QRCODE_ID`, 
 | 
      `a`.`STATUS`, 
 | 
      `a`.`VALID_TIME`, 
 | 
      `a`.`INVALID_TIME`, 
 | 
      `a`.`CHECK_WAY`, 
 | 
      `a`.`QUALITY_REQUIRE`, 
 | 
      `a`.`CHECK_NOTE`, 
 | 
      `umodel`.`ID` AS UMODEL_ID, 
 | 
      `umodel`.`DELETED` AS UMODEL_DELETED, 
 | 
      `umodel`.`CREATE_USER` AS UMODEL_CREATE_USER, 
 | 
      `umodel`.`CREATE_TIME` AS UMODEL_CREATE_TIME, 
 | 
      `umodel`.`UPDATE_USER` AS UMODEL_UPDATE_USER, 
 | 
      `umodel`.`UPDATE_TIME` AS UMODEL_UPDATE_TIME, 
 | 
      `umodel`.`REMARK` AS UMODEL_REMARK, 
 | 
      `umodel`.`ROOT_DEPART_ID` AS UMODEL_ROOT_DEPART_ID, 
 | 
      `umodel`.`NAME` AS UMODEL_NAME, 
 | 
      `umodel`.`TYPE` AS UMODEL_TYPE, 
 | 
      `umodel`.`STATUS` AS UMODEL_STATUS, 
 | 
      `cumodel`.`ID` AS CUMODEL_ID, 
 | 
      `cumodel`.`DELETED` AS CUMODEL_DELETED, 
 | 
      `cumodel`.`CREATE_USER` AS CUMODEL_CREATE_USER, 
 | 
      `cumodel`.`CREATE_TIME` AS CUMODEL_CREATE_TIME, 
 | 
      `cumodel`.`UPDATE_USER` AS CUMODEL_UPDATE_USER, 
 | 
      `cumodel`.`UPDATE_TIME` AS CUMODEL_UPDATE_TIME, 
 | 
      `cumodel`.`REMARK` AS CUMODEL_REMARK, 
 | 
      `cumodel`.`ROOT_DEPART_ID` AS CUMODEL_ROOT_DEPART_ID, 
 | 
      `cumodel`.`TYPE` AS CUMODEL_TYPE, 
 | 
      `cumodel`.`CODE` AS CUMODEL_CODE, 
 | 
      `cumodel`.`NAME` AS CUMODEL_NAME 
 | 
    FROM `material` `a` 
 | 
    LEFT JOIN `unit` `umodel` ON a.UNIT_ID=umodel.ID 
 | 
    LEFT JOIN `category_union` `cumodel` ON a.CATE_UNION_ID=cumodel.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="name != null and name != ''"> 
 | 
        AND `a`.`NAME` = #{name} 
 | 
      </if> 
 | 
      <if test="code != null and code != ''"> 
 | 
        AND `a`.`CODE` = #{code} 
 | 
      </if> 
 | 
      <if test="attr != null and attr != ''"> 
 | 
        AND `a`.`ATTR` = #{attr} 
 | 
      </if> 
 | 
      <if test="unionName != null and unionName != ''"> 
 | 
        AND `a`.`UNION_NAME` = #{unionName} 
 | 
      </if> 
 | 
      <if test="unitId != null"> 
 | 
        AND `a`.`UNIT_ID` = #{unitId} 
 | 
      </if> 
 | 
      <if test="cateUnionId != null"> 
 | 
        AND `a`.`CATE_UNION_ID` = #{cateUnionId} 
 | 
      </if> 
 | 
      <if test="formation != null"> 
 | 
        AND `a`.`FORMATION` = #{formation} 
 | 
      </if> 
 | 
      <if test="qrcodeId != null and qrcodeId != ''"> 
 | 
        AND `a`.`QRCODE_ID` = #{qrcodeId} 
 | 
      </if> 
 | 
      <if test="status != null"> 
 | 
        AND `a`.`STATUS` = #{status} 
 | 
      </if> 
 | 
      <if test="validTime != null"> 
 | 
        AND `a`.`VALID_TIME` = #{validTime} 
 | 
      </if> 
 | 
      <if test="invalidTime != null"> 
 | 
        AND `a`.`INVALID_TIME` = #{invalidTime} 
 | 
      </if> 
 | 
      <if test="checkWay != null"> 
 | 
        AND `a`.`CHECK_WAY` = #{checkWay} 
 | 
      </if> 
 | 
      <if test="qualityRequire != null and qualityRequire != ''"> 
 | 
        AND `a`.`QUALITY_REQUIRE` = #{qualityRequire} 
 | 
      </if> 
 | 
      <if test="checkNote != null and checkNote != ''"> 
 | 
        AND `a`.`CHECK_NOTE` = #{checkNote} 
 | 
      </if> 
 | 
      <if test="umodelId != null"> 
 | 
        AND `umodel`.`ID` = #{umodelId} 
 | 
      </if> 
 | 
      <if test="umodelDeleted != null"> 
 | 
        AND `umodel`.`DELETED` = #{umodelDeleted} 
 | 
      </if> 
 | 
      <if test="umodelCreateUser != null"> 
 | 
        AND `umodel`.`CREATE_USER` = #{umodelCreateUser} 
 | 
      </if> 
 | 
      <if test="umodelCreateTime != null"> 
 | 
        AND `umodel`.`CREATE_TIME` = #{umodelCreateTime} 
 | 
      </if> 
 | 
      <if test="umodelUpdateUser != null"> 
 | 
        AND `umodel`.`UPDATE_USER` = #{umodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="umodelUpdateTime != null"> 
 | 
        AND `umodel`.`UPDATE_TIME` = #{umodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="umodelRemark != null and umodelRemark != ''"> 
 | 
        AND `umodel`.`REMARK` = #{umodelRemark} 
 | 
      </if> 
 | 
      <if test="umodelRootDepartId != null"> 
 | 
        AND `umodel`.`ROOT_DEPART_ID` = #{umodelRootDepartId} 
 | 
      </if> 
 | 
      <if test="umodelName != null and umodelName != ''"> 
 | 
        AND `umodel`.`NAME` = #{umodelName} 
 | 
      </if> 
 | 
      <if test="umodelType != null"> 
 | 
        AND `umodel`.`TYPE` = #{umodelType} 
 | 
      </if> 
 | 
      <if test="umodelStatus != null"> 
 | 
        AND `umodel`.`STATUS` = #{umodelStatus} 
 | 
      </if> 
 | 
      <if test="cumodelId != null"> 
 | 
        AND `cumodel`.`ID` = #{cumodelId} 
 | 
      </if> 
 | 
      <if test="cumodelDeleted != null"> 
 | 
        AND `cumodel`.`DELETED` = #{cumodelDeleted} 
 | 
      </if> 
 | 
      <if test="cumodelCreateUser != null"> 
 | 
        AND `cumodel`.`CREATE_USER` = #{cumodelCreateUser} 
 | 
      </if> 
 | 
      <if test="cumodelCreateTime != null"> 
 | 
        AND `cumodel`.`CREATE_TIME` = #{cumodelCreateTime} 
 | 
      </if> 
 | 
      <if test="cumodelUpdateUser != null"> 
 | 
        AND `cumodel`.`UPDATE_USER` = #{cumodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="cumodelUpdateTime != null"> 
 | 
        AND `cumodel`.`UPDATE_TIME` = #{cumodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="cumodelRemark != null and cumodelRemark != ''"> 
 | 
        AND `cumodel`.`REMARK` = #{cumodelRemark} 
 | 
      </if> 
 | 
      <if test="cumodelRootDepartId != null"> 
 | 
        AND `cumodel`.`ROOT_DEPART_ID` = #{cumodelRootDepartId} 
 | 
      </if> 
 | 
      <if test="cumodelType != null"> 
 | 
        AND `cumodel`.`TYPE` = #{cumodelType} 
 | 
      </if> 
 | 
      <if test="cumodelCode != null"> 
 | 
        AND `cumodel`.`CODE` = #{cumodelCode} 
 | 
      </if> 
 | 
      <if test="cumodelName != null"> 
 | 
        AND `cumodel`.`NAME` = #{cumodelName} 
 | 
      </if> 
 | 
    </where> 
 | 
  </select> 
 | 
  
 | 
  
 | 
  <select id="getListByCondition" parameterType="doumeemes.dao.ext.dto.QueryMaterialExtDTO" resultType="doumeemes.dao.ext.vo.MaterialExtListVO"> 
 | 
    SELECT 
 | 
    `a`.`ID`, 
 | 
    `a`.`DELETED`, 
 | 
    `a`.`CREATE_USER`, 
 | 
    `a`.`CREATE_TIME`, 
 | 
    `a`.`UPDATE_USER`, 
 | 
    `a`.`UPDATE_TIME`, 
 | 
    `a`.`REMARK`, 
 | 
    `a`.`ROOT_DEPART_ID`, 
 | 
    `a`.`NAME`, 
 | 
    `a`.`CODE`, 
 | 
    `a`.`ATTR`, 
 | 
    `a`.`UNION_NAME`, 
 | 
    `a`.`UNIT_ID`, 
 | 
    `a`.`CATE_UNION_ID`, 
 | 
    `a`.`FORMATION`, 
 | 
    `a`.`QRCODE_ID`, 
 | 
    `a`.`STATUS`, 
 | 
    `a`.`VALID_TIME`, 
 | 
    `a`.`INVALID_TIME`, 
 | 
    `a`.`CHECK_WAY`, 
 | 
    `a`.`QUALITY_REQUIRE`, 
 | 
    `a`.`CHECK_NOTE`, 
 | 
    `umodel`.`NAME` AS UMODEL_NAME, 
 | 
    `umodel`.`ATTRIBUTE_DATA` AS UMODEL_ATTRIBUTE_DATA, 
 | 
    `cumodel`.`CATE_BIG_ID` AS CUMODEL_CATE_BIG_ID, 
 | 
    `cumodel`.`CATE_MIDDLE_ID` AS CUMODEL_CATE_MIDDLE_ID, 
 | 
    `cumodel`.`CATE_SMALL_ID` AS CUMODEL_CATE_SMALL_ID 
 | 
<!--    cmodel.name as cmodelName, 
 | 
    cmodel2.name as cmodel1Name, 
 | 
    cmodel3.name as cmodel2Name--> 
 | 
    FROM `material` `a` 
 | 
    LEFT JOIN `unit` `umodel` ON a.UNIT_ID=umodel.ID 
 | 
    LEFT JOIN `category_union` `cumodel` ON a.CATE_UNION_ID=cumodel.ID 
 | 
 <!--   left join `category` `cmodel` on cmodel.id=cumodel.CATE_BIG_ID 
 | 
    left join `category` `cmodel2` on cmodel2.id=cumodel.CATE_MIDDLE_ID 
 | 
    left join `category` `cmodel3` on cmodel3.id=cumodel.CATE_SMALL_ID--> 
 | 
    <where> 
 | 
      <if test="ids != null and ids!=''"> 
 | 
        AND not FIND_IN_SET(`a`.`ID`,#{ids}) 
 | 
      </if> 
 | 
      <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="name != null and name != ''"> 
 | 
        AND `a`.`NAME` like concat('%',#{name},'%') 
 | 
      </if> 
 | 
      <if test="code != null and code != ''"> 
 | 
        AND `a`.`CODE` = #{code} 
 | 
      </if> 
 | 
      <if test="attr != null and attr != ''"> 
 | 
        AND `a`.`ATTR` = #{attr} 
 | 
      </if> 
 | 
      <if test="unionName != null and unionName != ''"> 
 | 
        AND `a`.`UNION_NAME` = #{unionName} 
 | 
      </if> 
 | 
      <if test="unitId != null"> 
 | 
        AND `a`.`UNIT_ID` = #{unitId} 
 | 
      </if> 
 | 
      <if test="cateUnionId != null"> 
 | 
        AND `a`.`CATE_UNION_ID` = #{cateUnionId} 
 | 
      </if> 
 | 
      <if test="formation != null"> 
 | 
        AND `a`.`FORMATION` = #{formation} 
 | 
      </if> 
 | 
      <if test="qrcodeId != null and qrcodeId != ''"> 
 | 
        AND `a`.`QRCODE_ID` = #{qrcodeId} 
 | 
      </if> 
 | 
      <if test="status != null"> 
 | 
        AND `a`.`STATUS` = #{status} 
 | 
      </if> 
 | 
      <if test="validTime != null"> 
 | 
        AND `a`.`VALID_TIME` = #{validTime} 
 | 
      </if> 
 | 
      <if test="invalidTime != null"> 
 | 
        AND `a`.`INVALID_TIME` = #{invalidTime} 
 | 
      </if> 
 | 
      <if test="checkWay != null"> 
 | 
        AND `a`.`CHECK_WAY` = #{checkWay} 
 | 
      </if> 
 | 
      <if test="qualityRequire != null and qualityRequire != ''"> 
 | 
        AND `a`.`QUALITY_REQUIRE` = #{qualityRequire} 
 | 
      </if> 
 | 
      <if test="checkNote != null and checkNote != ''"> 
 | 
        AND `a`.`CHECK_NOTE` = #{checkNote} 
 | 
      </if> 
 | 
      <if test="umodelId != null"> 
 | 
        AND `umodel`.`ID` = #{umodelId} 
 | 
      </if> 
 | 
      <if test="umodelDeleted != null"> 
 | 
        AND `umodel`.`DELETED` = #{umodelDeleted} 
 | 
      </if> 
 | 
      <if test="umodelCreateUser != null"> 
 | 
        AND `umodel`.`CREATE_USER` = #{umodelCreateUser} 
 | 
      </if> 
 | 
      <if test="umodelCreateTime != null"> 
 | 
        AND `umodel`.`CREATE_TIME` = #{umodelCreateTime} 
 | 
      </if> 
 | 
      <if test="umodelUpdateUser != null"> 
 | 
        AND `umodel`.`UPDATE_USER` = #{umodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="umodelUpdateTime != null"> 
 | 
        AND `umodel`.`UPDATE_TIME` = #{umodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="umodelRemark != null and umodelRemark != ''"> 
 | 
        AND `umodel`.`REMARK` = #{umodelRemark} 
 | 
      </if> 
 | 
      <if test="umodelRootDepartId != null"> 
 | 
        AND `umodel`.`ROOT_DEPART_ID` = #{umodelRootDepartId} 
 | 
      </if> 
 | 
      <if test="umodelName != null and umodelName != ''"> 
 | 
        AND `umodel`.`NAME` = #{umodelName} 
 | 
      </if> 
 | 
      <if test="umodelType != null"> 
 | 
        AND `umodel`.`TYPE` = #{umodelType} 
 | 
      </if> 
 | 
      <if test="umodelStatus != null"> 
 | 
        AND `umodel`.`STATUS` = #{umodelStatus} 
 | 
      </if> 
 | 
      <if test="cumodelId != null"> 
 | 
        AND `cumodel`.`ID` = #{cumodelId} 
 | 
      </if> 
 | 
      <if test="cumodelDeleted != null"> 
 | 
        AND `cumodel`.`DELETED` = #{cumodelDeleted} 
 | 
      </if> 
 | 
      <if test="cumodelCreateUser != null"> 
 | 
        AND `cumodel`.`CREATE_USER` = #{cumodelCreateUser} 
 | 
      </if> 
 | 
      <if test="cumodelCreateTime != null"> 
 | 
        AND `cumodel`.`CREATE_TIME` = #{cumodelCreateTime} 
 | 
      </if> 
 | 
      <if test="cumodelUpdateUser != null"> 
 | 
        AND `cumodel`.`UPDATE_USER` = #{cumodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="cumodelUpdateTime != null"> 
 | 
        AND `cumodel`.`UPDATE_TIME` = #{cumodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="cumodelRemark != null and cumodelRemark != ''"> 
 | 
        AND `cumodel`.`REMARK` = #{cumodelRemark} 
 | 
      </if> 
 | 
      <if test="cumodelRootDepartId != null"> 
 | 
        AND `cumodel`.`ROOT_DEPART_ID` = #{cumodelRootDepartId} 
 | 
      </if> 
 | 
      <if test="cumodelType != null"> 
 | 
        AND `cumodel`.`TYPE` = #{cumodelType} 
 | 
      </if> 
 | 
      <if test="cumodelCode != null"> 
 | 
        AND `cumodel`.`CODE` = #{cumodelCode} 
 | 
      </if> 
 | 
      <if test="cumodelName != null"> 
 | 
        AND `cumodel`.`NAME` = #{cumodelName} 
 | 
      </if> 
 | 
      <if test="cmodelId != null "> 
 | 
        AND cmodel.id=#{cmodelId} 
 | 
      </if> 
 | 
      <if test="cmodel2Id != null"> 
 | 
        AND cmodel2.id=#{cmodel2Id} 
 | 
      </if> 
 | 
      <if test="cmodel3Id != null"> 
 | 
        AND cmodel3.id=#{cmodel3Id} 
 | 
      </if> 
 | 
  
 | 
    </where> 
 | 
    order by `a`.`ID` desc 
 | 
  </select> 
 | 
</mapper> 
 |