<?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.CategoryUnionExtMapper"> 
 | 
  
 | 
  <!-- 管理页面查询 --> 
 | 
  <resultMap id="CategoryUnionExtListVO" type="doumeemes.dao.ext.vo.CategoryUnionExtListVO" autoMapping="true"> 
 | 
    <id column="ID" jdbcType="INTEGER" property="id"/> 
 | 
    <association property="bmodel" javaType="doumeemes.dao.business.model.Category"> 
 | 
      <id column="BMODEL_ID" jdbcType="INTEGER" property="id"/> 
 | 
      <result column="BMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
      <result column="BMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
      <result column="BMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
      <result column="BMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
      <result column="BMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
      <result column="BMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> 
 | 
      <result column="BMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/> 
 | 
      <result column="BMODEL_TYPE" jdbcType="VARCHAR" property="type"/> 
 | 
      <result column="BMODEL_CODE" jdbcType="TINYINT" property="code"/> 
 | 
      <result column="BMODEL_NAME" jdbcType="TINYINT" property="name"/> 
 | 
      <result column="BMODEL_PARENT_ID" jdbcType="INTEGER" property="parentId"/> 
 | 
      <result column="BMODEL_CATE_TYPE" jdbcType="CHAR" property="cateType"/> 
 | 
    </association> 
 | 
    <association property="mmodel" javaType="doumeemes.dao.business.model.Category"> 
 | 
      <id column="MMODEL_ID" jdbcType="INTEGER" property="id"/> 
 | 
      <result column="MMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
      <result column="MMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
      <result column="MMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
      <result column="MMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
      <result column="MMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
      <result column="MMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> 
 | 
      <result column="MMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/> 
 | 
      <result column="MMODEL_TYPE" jdbcType="VARCHAR" property="type"/> 
 | 
      <result column="MMODEL_CODE" jdbcType="TINYINT" property="code"/> 
 | 
      <result column="MMODEL_NAME" jdbcType="TINYINT" property="name"/> 
 | 
      <result column="MMODEL_PARENT_ID" jdbcType="INTEGER" property="parentId"/> 
 | 
      <result column="MMODEL_CATE_TYPE" jdbcType="CHAR" property="cateType"/> 
 | 
    </association> 
 | 
    <association property="cmodel" javaType="doumeemes.dao.business.model.Category"> 
 | 
      <id column="CMODEL_ID" jdbcType="INTEGER" property="id"/> 
 | 
      <result column="CMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
      <result column="CMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
      <result column="CMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
      <result column="CMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
      <result column="CMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
      <result column="CMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> 
 | 
      <result column="CMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/> 
 | 
      <result column="CMODEL_TYPE" jdbcType="VARCHAR" property="type"/> 
 | 
      <result column="CMODEL_CODE" jdbcType="TINYINT" property="code"/> 
 | 
      <result column="CMODEL_NAME" jdbcType="TINYINT" property="name"/> 
 | 
      <result column="CMODEL_PARENT_ID" jdbcType="INTEGER" property="parentId"/> 
 | 
      <result column="CMODEL_CATE_TYPE" jdbcType="CHAR" property="cateType"/> 
 | 
    </association> 
 | 
  </resultMap> 
 | 
  <select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryCategoryUnionExtDTO" resultMap="CategoryUnionExtListVO"> 
 | 
    SELECT 
 | 
      `a`.`ID`, 
 | 
      `a`.`DELETED`, 
 | 
      `a`.`CREATE_USER`, 
 | 
      `a`.`CREATE_TIME`, 
 | 
      `a`.`UPDATE_USER`, 
 | 
      `a`.`UPDATE_TIME`, 
 | 
      `a`.`REMARK`, 
 | 
      `a`.`ROOT_DEPART_ID`, 
 | 
      `a`.`CATE_BIG_ID`, 
 | 
      `a`.`CATE_MIDDLE_ID`, 
 | 
      `a`.`CATE_SMALL_ID`, 
 | 
      `bmodel`.`ID` AS BMODEL_ID, 
 | 
      `bmodel`.`DELETED` AS BMODEL_DELETED, 
 | 
      `bmodel`.`CREATE_USER` AS BMODEL_CREATE_USER, 
 | 
      `bmodel`.`CREATE_TIME` AS BMODEL_CREATE_TIME, 
 | 
      `bmodel`.`UPDATE_USER` AS BMODEL_UPDATE_USER, 
 | 
      `bmodel`.`UPDATE_TIME` AS BMODEL_UPDATE_TIME, 
 | 
      `bmodel`.`REMARK` AS BMODEL_REMARK, 
 | 
      `bmodel`.`ROOT_DEPART_ID` AS BMODEL_ROOT_DEPART_ID, 
 | 
      `bmodel`.`TYPE` AS BMODEL_TYPE, 
 | 
      `bmodel`.`CODE` AS BMODEL_CODE, 
 | 
      `bmodel`.`NAME` AS BMODEL_NAME, 
 | 
      `bmodel`.`PARENT_ID` AS BMODEL_PARENT_ID, 
 | 
      `bmodel`.`CATE_TYPE` AS BMODEL_CATE_TYPE, 
 | 
      `mmodel`.`ID` AS MMODEL_ID, 
 | 
      `mmodel`.`DELETED` AS MMODEL_DELETED, 
 | 
      `mmodel`.`CREATE_USER` AS MMODEL_CREATE_USER, 
 | 
      `mmodel`.`CREATE_TIME` AS MMODEL_CREATE_TIME, 
 | 
      `mmodel`.`UPDATE_USER` AS MMODEL_UPDATE_USER, 
 | 
      `mmodel`.`UPDATE_TIME` AS MMODEL_UPDATE_TIME, 
 | 
      `mmodel`.`REMARK` AS MMODEL_REMARK, 
 | 
      `mmodel`.`ROOT_DEPART_ID` AS MMODEL_ROOT_DEPART_ID, 
 | 
      `mmodel`.`TYPE` AS MMODEL_TYPE, 
 | 
      `mmodel`.`CODE` AS MMODEL_CODE, 
 | 
      `mmodel`.`NAME` AS MMODEL_NAME, 
 | 
      `mmodel`.`PARENT_ID` AS MMODEL_PARENT_ID, 
 | 
      `mmodel`.`CATE_TYPE` AS MMODEL_CATE_TYPE, 
 | 
      `cmodel`.`ID` AS CMODEL_ID, 
 | 
      `cmodel`.`DELETED` AS CMODEL_DELETED, 
 | 
      `cmodel`.`CREATE_USER` AS CMODEL_CREATE_USER, 
 | 
      `cmodel`.`CREATE_TIME` AS CMODEL_CREATE_TIME, 
 | 
      `cmodel`.`UPDATE_USER` AS CMODEL_UPDATE_USER, 
 | 
      `cmodel`.`UPDATE_TIME` AS CMODEL_UPDATE_TIME, 
 | 
      `cmodel`.`REMARK` AS CMODEL_REMARK, 
 | 
      `cmodel`.`ROOT_DEPART_ID` AS CMODEL_ROOT_DEPART_ID, 
 | 
      `cmodel`.`TYPE` AS CMODEL_TYPE, 
 | 
      `cmodel`.`CODE` AS CMODEL_CODE, 
 | 
      `cmodel`.`NAME` AS CMODEL_NAME, 
 | 
      `cmodel`.`PARENT_ID` AS CMODEL_PARENT_ID, 
 | 
      `cmodel`.`CATE_TYPE` AS CMODEL_CATE_TYPE 
 | 
    FROM `category_union` `a` 
 | 
    LEFT JOIN `category` `bmodel` ON a.CATE_BIG_ID=bmodel.ID and bmodel.DELETED=0 
 | 
    LEFT JOIN `category` `mmodel` ON a.CATE_MIDDLE_ID=mmodel.ID and mmodel.DELETED=0 
 | 
    LEFT JOIN `category` `cmodel` ON a.CATE_SMALL_ID=cmodel.ID and cmodel.DELETED=0 
 | 
    <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="cateBigId != null"> 
 | 
        AND `a`.`CATE_BIG_ID` = #{cateBigId} 
 | 
      </if> 
 | 
      <if test="cateMiddleId != null"> 
 | 
        AND `a`.`CATE_MIDDLE_ID` = #{cateMiddleId} 
 | 
      </if> 
 | 
      <if test="cateSmallId != null"> 
 | 
        AND `a`.`CATE_SMALL_ID` = #{cateSmallId} 
 | 
      </if> 
 | 
      <if test="combinationName != null"> 
 | 
        AND (`bmodel`.`name` like CONCAT('%', #{combinationName}, '%')   or `mmodel`.`name` like CONCAT('%', #{combinationName}, '%')  or `cmodel`.`name` like CONCAT('%', #{combinationName}, '%')) 
 | 
      </if> 
 | 
  
 | 
      <if test="bmodelId != null"> 
 | 
        AND `bmodel`.`ID` = #{bmodelId} 
 | 
      </if> 
 | 
      <if test="bmodelDeleted != null"> 
 | 
        AND `bmodel`.`DELETED` = #{bmodelDeleted} 
 | 
      </if> 
 | 
      <if test="bmodelCreateUser != null"> 
 | 
        AND `bmodel`.`CREATE_USER` = #{bmodelCreateUser} 
 | 
      </if> 
 | 
      <if test="bmodelCreateTime != null"> 
 | 
        AND `bmodel`.`CREATE_TIME` = #{bmodelCreateTime} 
 | 
      </if> 
 | 
      <if test="bmodelUpdateUser != null"> 
 | 
        AND `bmodel`.`UPDATE_USER` = #{bmodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="bmodelUpdateTime != null"> 
 | 
        AND `bmodel`.`UPDATE_TIME` = #{bmodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="bmodelRemark != null and bmodelRemark != ''"> 
 | 
        AND `bmodel`.`REMARK` = #{bmodelRemark} 
 | 
      </if> 
 | 
      <if test="bmodelRootDepartId != null"> 
 | 
        AND `bmodel`.`ROOT_DEPART_ID` = #{bmodelRootDepartId} 
 | 
      </if> 
 | 
      <if test="bmodelType != null and bmodelType != ''"> 
 | 
        AND `bmodel`.`TYPE` = #{bmodelType} 
 | 
      </if> 
 | 
      <if test="bmodelCode != null"> 
 | 
        AND `bmodel`.`CODE` = #{bmodelCode} 
 | 
      </if> 
 | 
      <if test="bmodelName != null"> 
 | 
        AND `bmodel`.`NAME` = #{bmodelName} 
 | 
      </if> 
 | 
      <if test="bmodelParentId != null"> 
 | 
        AND `bmodel`.`PARENT_ID` = #{bmodelParentId} 
 | 
      </if> 
 | 
      <if test="bmodelCateType != null and bmodelCateType != ''"> 
 | 
        AND `bmodel`.`CATE_TYPE` = #{bmodelCateType} 
 | 
      </if> 
 | 
      <if test="mmodelId != null"> 
 | 
        AND `mmodel`.`ID` = #{mmodelId} 
 | 
      </if> 
 | 
      <if test="mmodelDeleted != null"> 
 | 
        AND `mmodel`.`DELETED` = #{mmodelDeleted} 
 | 
      </if> 
 | 
      <if test="mmodelCreateUser != null"> 
 | 
        AND `mmodel`.`CREATE_USER` = #{mmodelCreateUser} 
 | 
      </if> 
 | 
      <if test="mmodelCreateTime != null"> 
 | 
        AND `mmodel`.`CREATE_TIME` = #{mmodelCreateTime} 
 | 
      </if> 
 | 
      <if test="mmodelUpdateUser != null"> 
 | 
        AND `mmodel`.`UPDATE_USER` = #{mmodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="mmodelUpdateTime != null"> 
 | 
        AND `mmodel`.`UPDATE_TIME` = #{mmodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="mmodelRemark != null and mmodelRemark != ''"> 
 | 
        AND `mmodel`.`REMARK` = #{mmodelRemark} 
 | 
      </if> 
 | 
      <if test="mmodelRootDepartId != null"> 
 | 
        AND `mmodel`.`ROOT_DEPART_ID` = #{mmodelRootDepartId} 
 | 
      </if> 
 | 
      <if test="mmodelType != null and mmodelType != ''"> 
 | 
        AND `mmodel`.`TYPE` = #{mmodelType} 
 | 
      </if> 
 | 
      <if test="mmodelCode != null"> 
 | 
        AND `mmodel`.`CODE` = #{mmodelCode} 
 | 
      </if> 
 | 
      <if test="mmodelName != null"> 
 | 
        AND `mmodel`.`NAME` = #{mmodelName} 
 | 
      </if> 
 | 
      <if test="mmodelParentId != null"> 
 | 
        AND `mmodel`.`PARENT_ID` = #{mmodelParentId} 
 | 
      </if> 
 | 
      <if test="mmodelCateType != null and mmodelCateType != ''"> 
 | 
        AND `mmodel`.`CATE_TYPE` = #{mmodelCateType} 
 | 
      </if> 
 | 
      <if test="cmodelId != null"> 
 | 
        AND `cmodel`.`ID` = #{cmodelId} 
 | 
      </if> 
 | 
      <if test="cmodelDeleted != null"> 
 | 
        AND `cmodel`.`DELETED` = #{cmodelDeleted} 
 | 
      </if> 
 | 
      <if test="cmodelCreateUser != null"> 
 | 
        AND `cmodel`.`CREATE_USER` = #{cmodelCreateUser} 
 | 
      </if> 
 | 
      <if test="cmodelCreateTime != null"> 
 | 
        AND `cmodel`.`CREATE_TIME` = #{cmodelCreateTime} 
 | 
      </if> 
 | 
      <if test="cmodelUpdateUser != null"> 
 | 
        AND `cmodel`.`UPDATE_USER` = #{cmodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="cmodelUpdateTime != null"> 
 | 
        AND `cmodel`.`UPDATE_TIME` = #{cmodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="cmodelRemark != null and cmodelRemark != ''"> 
 | 
        AND `cmodel`.`REMARK` = #{cmodelRemark} 
 | 
      </if> 
 | 
      <if test="cmodelRootDepartId != null"> 
 | 
        AND `cmodel`.`ROOT_DEPART_ID` = #{cmodelRootDepartId} 
 | 
      </if> 
 | 
      <if test="cmodelType != null and cmodelType != ''"> 
 | 
        AND `cmodel`.`TYPE` = #{cmodelType} 
 | 
      </if> 
 | 
      <if test="cmodelCode != null"> 
 | 
        AND `cmodel`.`CODE` = #{cmodelCode} 
 | 
      </if> 
 | 
      <if test="cmodelName != null"> 
 | 
        AND `cmodel`.`NAME` = #{cmodelName} 
 | 
      </if> 
 | 
      <if test="cmodelParentId != null"> 
 | 
        AND `cmodel`.`PARENT_ID` = #{cmodelParentId} 
 | 
      </if> 
 | 
      <if test="cmodelCateType != null and cmodelCateType != ''"> 
 | 
        AND `cmodel`.`CATE_TYPE` = #{cmodelCateType} 
 | 
      </if> 
 | 
    </where> 
 | 
    order by `a`.`ID` desc 
 | 
  </select> 
 | 
</mapper> 
 |