<?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.CustomerDistributeExtMapper"> 
 | 
  
 | 
  <!-- 管理页面查询 --> 
 | 
  <resultMap id="CustomerDistributeExtListVO" type="doumeemes.dao.ext.vo.CustomerDistributeExtListVO" autoMapping="true"> 
 | 
    <id column="ID" jdbcType="INTEGER" property="id"/> 
 | 
    <association property="sumodel" javaType="doumeemes.dao.system.model.SystemUser"> 
 | 
      <id column="SUMODEL_ID" jdbcType="INTEGER" property="id"/> 
 | 
      <result column="SUMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
      <result column="SUMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
      <result column="SUMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
      <result column="SUMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
      <result column="SUMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
      <result column="SUMODEL_FIXED" jdbcType="TINYINT" property="fixed"/> 
 | 
      <result column="SUMODEL_PASSWORD" jdbcType="VARCHAR" property="password"/> 
 | 
      <result column="SUMODEL_SALT" jdbcType="VARCHAR" property="salt"/> 
 | 
      <result column="SUMODEL_AVATAR" jdbcType="VARCHAR" property="avatar"/> 
 | 
      <result column="SUMODEL_MOBILE" jdbcType="VARCHAR" property="mobile"/> 
 | 
      <result column="SUMODEL_EMAIL" jdbcType="VARCHAR" property="email"/> 
 | 
      <result column="SUMODEL_SEX" jdbcType="VARCHAR" property="sex"/> 
 | 
      <result column="SUMODEL_BIRTHDAY" jdbcType="DATE" property="birthday"/> 
 | 
      <result column="SUMODEL_EMP_NO" jdbcType="VARCHAR" property="empNo"/> 
 | 
      <result column="SUMODEL_REALNAME" jdbcType="VARCHAR" property="realname"/> 
 | 
      <result column="SUMODEL_USERNAME" jdbcType="VARCHAR" property="username"/> 
 | 
      <result column="SUMODEL_SYSTEMID" jdbcType="VARCHAR" property="systemid"/> 
 | 
      <result column="SUMODEL_INVALID_TIME" jdbcType="TIMESTAMP" property="invalidTime"/> 
 | 
      <result column="SUMODEL_TYPE" jdbcType="INTEGER" property="type"/> 
 | 
    </association> 
 | 
    <association property="dmodel" javaType="doumeemes.dao.business.model.Department"> 
 | 
      <id column="DMODEL_ID" jdbcType="INTEGER" property="id"/> 
 | 
      <result column="DMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> 
 | 
      <result column="DMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> 
 | 
      <result column="DMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> 
 | 
      <result column="DMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> 
 | 
      <result column="DMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> 
 | 
      <result column="DMODEL_NAME" jdbcType="VARCHAR" property="name"/> 
 | 
      <result column="DMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> 
 | 
      <result column="DMODEL_ROOT_ID" jdbcType="INTEGER" property="rootId"/> 
 | 
      <result column="DMODEL_PARENT_ID" jdbcType="INTEGER" property="parentId"/> 
 | 
      <result column="DMODEL_COMPANY_ID" jdbcType="INTEGER" property="companyId"/> 
 | 
      <result column="DMODEL_TYPE" jdbcType="TINYINT" property="type"/> 
 | 
      <result column="DMODEL_ERP_ID" jdbcType="VARCHAR" property="erpId"/> 
 | 
      <result column="DMODEL_STATUS" jdbcType="INTEGER" property="status"/> 
 | 
      <result column="DMODEL_VALID_TIME" jdbcType="TIMESTAMP" property="validTime"/> 
 | 
      <result column="DMODEL_INVALID_TIME" jdbcType="TIMESTAMP" property="invalidTime"/> 
 | 
    </association> 
 | 
    <association property="cmodel" javaType="doumeemes.dao.business.model.Customer"> 
 | 
      <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_CREDIT_CODE" jdbcType="VARCHAR" property="creditCode"/> 
 | 
      <result column="CMODEL_NAME" jdbcType="VARCHAR" property="name"/> 
 | 
      <result column="CMODEL_TYPE" jdbcType="VARCHAR" property="type"/> 
 | 
      <result column="CMODEL_CODE" jdbcType="VARCHAR" property="code"/> 
 | 
      <result column="CMODEL_FOUND_DATE" jdbcType="TIMESTAMP" property="foundDate"/> 
 | 
      <result column="CMODEL_LEGAL_PERSON" jdbcType="VARCHAR" property="legalPerson"/> 
 | 
      <result column="CMODEL_CATEGORYY" jdbcType="VARCHAR" property="categoryy"/> 
 | 
    </association> 
 | 
  </resultMap> 
 | 
  <select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryCustomerDistributeExtDTO" resultMap="CustomerDistributeExtListVO"> 
 | 
    SELECT 
 | 
      `a`.`ID`, 
 | 
      `a`.`DELETED`, 
 | 
      `a`.`CREATE_USER`, 
 | 
      `a`.`CREATE_TIME`, 
 | 
      `a`.`UPDATE_USER`, 
 | 
      `a`.`UPDATE_TIME`, 
 | 
      `a`.`REMARK`, 
 | 
      `a`.`STATUS`, 
 | 
      `a`.`ROOT_DEPART_ID`, 
 | 
      `a`.`AREA`, 
 | 
      `a`.`SALE_USER_ID`, 
 | 
      `a`.`DEPART_ID`, 
 | 
      `a`.`CUSTOMER_ID`, 
 | 
      `a`.`CATEGORY`, 
 | 
      `sumodel`.`ID` AS SUMODEL_ID, 
 | 
      `sumodel`.`DELETED` AS SUMODEL_DELETED, 
 | 
      `sumodel`.`CREATE_USER` AS SUMODEL_CREATE_USER, 
 | 
      `sumodel`.`CREATE_TIME` AS SUMODEL_CREATE_TIME, 
 | 
      `sumodel`.`UPDATE_USER` AS SUMODEL_UPDATE_USER, 
 | 
      `sumodel`.`UPDATE_TIME` AS SUMODEL_UPDATE_TIME, 
 | 
      `sumodel`.`FIXED` AS SUMODEL_FIXED, 
 | 
      `sumodel`.`PASSWORD` AS SUMODEL_PASSWORD, 
 | 
      `sumodel`.`SALT` AS SUMODEL_SALT, 
 | 
      `sumodel`.`AVATAR` AS SUMODEL_AVATAR, 
 | 
      `sumodel`.`MOBILE` AS SUMODEL_MOBILE, 
 | 
      `sumodel`.`EMAIL` AS SUMODEL_EMAIL, 
 | 
      `sumodel`.`SEX` AS SUMODEL_SEX, 
 | 
      `sumodel`.`BIRTHDAY` AS SUMODEL_BIRTHDAY, 
 | 
      `sumodel`.`EMP_NO` AS SUMODEL_EMP_NO, 
 | 
      `sumodel`.`REALNAME` AS SUMODEL_REALNAME, 
 | 
      `sumodel`.`USERNAME` AS SUMODEL_USERNAME, 
 | 
      `sumodel`.`SYSTEMID` AS SUMODEL_SYSTEMID, 
 | 
      `sumodel`.`INVALID_TIME` AS SUMODEL_INVALID_TIME, 
 | 
      `sumodel`.`TYPE` AS SUMODEL_TYPE, 
 | 
      `dmodel`.`ID` AS DMODEL_ID, 
 | 
      `dmodel`.`DELETED` AS DMODEL_DELETED, 
 | 
      `dmodel`.`CREATE_USER` AS DMODEL_CREATE_USER, 
 | 
      `dmodel`.`CREATE_TIME` AS DMODEL_CREATE_TIME, 
 | 
      `dmodel`.`UPDATE_USER` AS DMODEL_UPDATE_USER, 
 | 
      `dmodel`.`UPDATE_TIME` AS DMODEL_UPDATE_TIME, 
 | 
      `dmodel`.`NAME` AS DMODEL_NAME, 
 | 
      `dmodel`.`REMARK` AS DMODEL_REMARK, 
 | 
      `dmodel`.`ROOT_ID` AS DMODEL_ROOT_ID, 
 | 
      `dmodel`.`PARENT_ID` AS DMODEL_PARENT_ID, 
 | 
      `dmodel`.`COMPANY_ID` AS DMODEL_COMPANY_ID, 
 | 
      `dmodel`.`TYPE` AS DMODEL_TYPE, 
 | 
      `dmodel`.`ERP_ID` AS DMODEL_ERP_ID, 
 | 
      `dmodel`.`STATUS` AS DMODEL_STATUS, 
 | 
      `dmodel`.`VALID_TIME` AS DMODEL_VALID_TIME, 
 | 
      `dmodel`.`INVALID_TIME` AS DMODEL_INVALID_TIME, 
 | 
      `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`.`CREDIT_CODE` AS CMODEL_CREDIT_CODE, 
 | 
      `cmodel`.`NAME` AS CMODEL_NAME, 
 | 
      `cmodel`.`TYPE` AS CMODEL_TYPE, 
 | 
      `cmodel`.`CODE` AS CMODEL_CODE, 
 | 
      `cmodel`.`FOUND_DATE` AS CMODEL_FOUND_DATE, 
 | 
      `cmodel`.`LEGAL_PERSON` AS CMODEL_LEGAL_PERSON, 
 | 
      `cmodel`.`CATEGORYY` AS CMODEL_CATEGORYY 
 | 
    FROM `customer_distribute` `a` 
 | 
    LEFT JOIN `system_user` `sumodel` ON a.SALE_USER_ID=sumodel.ID 
 | 
    LEFT JOIN `department` `dmodel` ON a.DEPART_ID=dmodel.ID 
 | 
    LEFT JOIN `customer` `cmodel` ON a.CUSTOMER_ID=cmodel.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="status != null"> 
 | 
        AND `a`.`STATUS` = #{status} 
 | 
      </if> 
 | 
      <if test="rootDepartId != null"> 
 | 
        AND `a`.`ROOT_DEPART_ID` = #{rootDepartId} 
 | 
      </if> 
 | 
      <if test="area != null and area != ''"> 
 | 
        AND `a`.`AREA` = #{area} 
 | 
      </if> 
 | 
      <if test="saleUserId != null"> 
 | 
        AND `a`.`SALE_USER_ID` = #{saleUserId} 
 | 
      </if> 
 | 
      <if test="departId != null"> 
 | 
        AND `a`.`DEPART_ID` = #{departId} 
 | 
      </if> 
 | 
      <if test="customerId != null"> 
 | 
        AND `a`.`CUSTOMER_ID` = #{customerId} 
 | 
      </if> 
 | 
      <if test="category != null and category != ''"> 
 | 
        AND `a`.`CATEGORY` = #{category} 
 | 
      </if> 
 | 
      <if test="sumodelId != null"> 
 | 
        AND `sumodel`.`ID` = #{sumodelId} 
 | 
      </if> 
 | 
      <if test="sumodelDeleted != null"> 
 | 
        AND `sumodel`.`DELETED` = #{sumodelDeleted} 
 | 
      </if> 
 | 
      <if test="sumodelCreateUser != null"> 
 | 
        AND `sumodel`.`CREATE_USER` = #{sumodelCreateUser} 
 | 
      </if> 
 | 
      <if test="sumodelCreateTime != null"> 
 | 
        AND `sumodel`.`CREATE_TIME` = #{sumodelCreateTime} 
 | 
      </if> 
 | 
      <if test="sumodelUpdateUser != null"> 
 | 
        AND `sumodel`.`UPDATE_USER` = #{sumodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="sumodelUpdateTime != null"> 
 | 
        AND `sumodel`.`UPDATE_TIME` = #{sumodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="sumodelFixed != null"> 
 | 
        AND `sumodel`.`FIXED` = #{sumodelFixed} 
 | 
      </if> 
 | 
      <if test="sumodelPassword != null and sumodelPassword != ''"> 
 | 
        AND `sumodel`.`PASSWORD` = #{sumodelPassword} 
 | 
      </if> 
 | 
      <if test="sumodelSalt != null and sumodelSalt != ''"> 
 | 
        AND `sumodel`.`SALT` = #{sumodelSalt} 
 | 
      </if> 
 | 
      <if test="sumodelAvatar != null and sumodelAvatar != ''"> 
 | 
        AND `sumodel`.`AVATAR` = #{sumodelAvatar} 
 | 
      </if> 
 | 
      <if test="sumodelMobile != null and sumodelMobile != ''"> 
 | 
        AND `sumodel`.`MOBILE` = #{sumodelMobile} 
 | 
      </if> 
 | 
      <if test="sumodelEmail != null and sumodelEmail != ''"> 
 | 
        AND `sumodel`.`EMAIL` = #{sumodelEmail} 
 | 
      </if> 
 | 
      <if test="sumodelSex != null and sumodelSex != ''"> 
 | 
        AND `sumodel`.`SEX` = #{sumodelSex} 
 | 
      </if> 
 | 
      <if test="sumodelBirthday != null"> 
 | 
        AND `sumodel`.`BIRTHDAY` = #{sumodelBirthday} 
 | 
      </if> 
 | 
      <if test="sumodelEmpNo != null and sumodelEmpNo != ''"> 
 | 
        AND `sumodel`.`EMP_NO` = #{sumodelEmpNo} 
 | 
      </if> 
 | 
      <if test="sumodelRealname != null and sumodelRealname != ''"> 
 | 
        AND `sumodel`.`REALNAME` = #{sumodelRealname} 
 | 
      </if> 
 | 
      <if test="sumodelUsername != null and sumodelUsername != ''"> 
 | 
        AND `sumodel`.`USERNAME` = #{sumodelUsername} 
 | 
      </if> 
 | 
      <if test="sumodelSystemid != null and sumodelSystemid != ''"> 
 | 
        AND `sumodel`.`SYSTEMID` = #{sumodelSystemid} 
 | 
      </if> 
 | 
      <if test="sumodelInvalidTime != null"> 
 | 
        AND `sumodel`.`INVALID_TIME` = #{sumodelInvalidTime} 
 | 
      </if> 
 | 
      <if test="sumodelType != null"> 
 | 
        AND `sumodel`.`TYPE` = #{sumodelType} 
 | 
      </if> 
 | 
      <if test="dmodelId != null"> 
 | 
        AND `dmodel`.`ID` = #{dmodelId} 
 | 
      </if> 
 | 
      <if test="dmodelDeleted != null"> 
 | 
        AND `dmodel`.`DELETED` = #{dmodelDeleted} 
 | 
      </if> 
 | 
      <if test="dmodelCreateUser != null"> 
 | 
        AND `dmodel`.`CREATE_USER` = #{dmodelCreateUser} 
 | 
      </if> 
 | 
      <if test="dmodelCreateTime != null"> 
 | 
        AND `dmodel`.`CREATE_TIME` = #{dmodelCreateTime} 
 | 
      </if> 
 | 
      <if test="dmodelUpdateUser != null"> 
 | 
        AND `dmodel`.`UPDATE_USER` = #{dmodelUpdateUser} 
 | 
      </if> 
 | 
      <if test="dmodelUpdateTime != null"> 
 | 
        AND `dmodel`.`UPDATE_TIME` = #{dmodelUpdateTime} 
 | 
      </if> 
 | 
      <if test="dmodelName != null and dmodelName != ''"> 
 | 
        AND `dmodel`.`NAME` = #{dmodelName} 
 | 
      </if> 
 | 
      <if test="dmodelRemark != null and dmodelRemark != ''"> 
 | 
        AND `dmodel`.`REMARK` = #{dmodelRemark} 
 | 
      </if> 
 | 
      <if test="dmodelRootId != null"> 
 | 
        AND `dmodel`.`ROOT_ID` = #{dmodelRootId} 
 | 
      </if> 
 | 
      <if test="dmodelParentId != null"> 
 | 
        AND `dmodel`.`PARENT_ID` = #{dmodelParentId} 
 | 
      </if> 
 | 
      <if test="dmodelCompanyId != null"> 
 | 
        AND `dmodel`.`COMPANY_ID` = #{dmodelCompanyId} 
 | 
      </if> 
 | 
      <if test="dmodelType != null"> 
 | 
        AND `dmodel`.`TYPE` = #{dmodelType} 
 | 
      </if> 
 | 
      <if test="dmodelErpId != null and dmodelErpId != ''"> 
 | 
        AND `dmodel`.`ERP_ID` = #{dmodelErpId} 
 | 
      </if> 
 | 
      <if test="dmodelStatus != null"> 
 | 
        AND `dmodel`.`STATUS` = #{dmodelStatus} 
 | 
      </if> 
 | 
      <if test="dmodelValidTime != null"> 
 | 
        AND `dmodel`.`VALID_TIME` = #{dmodelValidTime} 
 | 
      </if> 
 | 
      <if test="dmodelInvalidTime != null"> 
 | 
        AND `dmodel`.`INVALID_TIME` = #{dmodelInvalidTime} 
 | 
      </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="cmodelCreditCode != null and cmodelCreditCode != ''"> 
 | 
        AND `cmodel`.`CREDIT_CODE` = #{cmodelCreditCode} 
 | 
      </if> 
 | 
      <if test="cmodelName != null and cmodelName != ''"> 
 | 
        AND `cmodel`.`NAME` = #{cmodelName} 
 | 
      </if> 
 | 
      <if test="cmodelType != null and cmodelType != ''"> 
 | 
        AND `cmodel`.`TYPE` = #{cmodelType} 
 | 
      </if> 
 | 
      <if test="cmodelCode != null and cmodelCode != ''"> 
 | 
        AND `cmodel`.`CODE` = #{cmodelCode} 
 | 
      </if> 
 | 
      <if test="cmodelFoundDate != null"> 
 | 
        AND `cmodel`.`FOUND_DATE` = #{cmodelFoundDate} 
 | 
      </if> 
 | 
      <if test="cmodelLegalPerson != null and cmodelLegalPerson != ''"> 
 | 
        AND `cmodel`.`LEGAL_PERSON` = #{cmodelLegalPerson} 
 | 
      </if> 
 | 
      <if test="cmodelCategoryy != null and cmodelCategoryy != ''"> 
 | 
        AND `cmodel`.`CATEGORYY` = #{cmodelCategoryy} 
 | 
      </if> 
 | 
    </where> 
 | 
  </select> 
 | 
</mapper> 
 |