<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~
  ~      Copyright (c) 2018-2025, lengleng All rights reserved.
  ~
  ~  Redistribution and use in source and binary forms, with or without
  ~  modification, are permitted provided that the following conditions are met:
  ~
  ~ Redistributions of source code must retain the above copyright notice,
  ~  this list of conditions and the following disclaimer.
  ~  Redistributions in binary form must reproduce the above copyright
  ~  notice, this list of conditions and the following disclaimer in the
  ~  documentation and/or other materials provided with the distribution.
  ~  Neither the name of the yifu4cloud.com developer nor the names of its
  ~  contributors may be used to endorse or promote products derived from
  ~  this software without specific prior written permission.
  ~  Author: lengleng (wangiegie@gmail.com)
  ~
  -->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.yifu.cloud.plus.v1.yifu.archives.mapper.TCustomerInfoMapper">

  <resultMap id="tCustomerInfoMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo">
    <id property="id" column="ID"/>
    <result property="customerName" column="CUSTOMER_NAME"/>
    <result property="customerCode" column="CUSTOMER_CODE"/>
    <result property="province" column="PROVINCE"/>
    <result property="city" column="city"/>
    <result property="town" column="town"/>
    <result property="address" column="ADDRESS"/>
    <result property="nature" column="NATURE"/>
    <result property="industryBelong" column="INDUSTRY_BELONG"/>
    <result property="industrySub" column="INDUSTRY_SUB"/>
    <result property="prAuditFlag" column="PR_AUDIT_FLAG"/>
    <result property="stopFlag" column="STOP_FLAG"/>
    <result property="deleteFlag" column="DELETE_FLAG"/>
    <result property="salesman" column="SALESMAN"/>
    <result property="oldId" column="OLD_ID"/>
    <result property="label" column="LABEL"/>
    <result property="customerStatus" column="CUSTOMER_STATUS"/>
    <result property="createUserName" column="CREATE_USER_NAME"/>
    <result property="lastUpdateUserName" column="LAST_UPDATE_USER_NAME"/>
    <result property="salesmanName" column="SALESMAN_NAME"/>
    <result property="prAuditOpinion" column="PR_AUDIT_OPINION"/>
    <result property="parentId" column="PARENT_ID"/>
    <result property="prAuditMan" column="PR_AUDIT_MAN"/>
    <result property="prAuditManName" column="PR_AUDIT_MAN_NAME"/>
    <result property="lastAuditDate" column="LAST_AUDIT_DATE"/>
    <result property="belongProvince" column="BELONG_PROVINCE"/>
    <result property="belongCity" column="BELONG_CITY"/>
    <result property="belongTown" column="BELONG_TOWN"/>
    <result property="customerType" column="customer_type"/>
    <result property="stopDate" column="STOP_DATE"/>
    <result property="stopReason" column="STOP_REASON"/>
    <result property="stopUser" column="STOP_USER"/>
    <result property="stopUserName" column="STOP_USER_NAME"/>
    <result property="dataSource" column="data_source"/>
    <result property="balance" column="BALANCE"/>
  </resultMap>

	<select id="getAllUnit" resultMap="tCustomerInfoMap">
		select  a.CUSTOMER_ID AS "ID",a.CUSTOMER_NAME AS "CUSTOMER_NAME",a.CUSTOMER_NO AS "CUSTOMER_CODE" from t_settle_domain a
		<where>
			1=1
			<if test="customerName != null and customerName != null">
				and a.CUSTOMER_NAME  like concat(#{customerName},'%')
			</if>
		</where>
		GROUP BY A.CUSTOMER_NO
	</select>
</mapper>
