| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- <?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="com.goafanti.common.dao.UserMapper">
- <select id="selectCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
- <choose>
- <when test="type == 0">
- select
- a.id as uid,a.type,a.status, date_format(a.create_time,'%Y-%m-%d %H:%i:%s') as createTime,a.service_certification as serviceCertification,
- a.user_certification as userCertification,a.current_member_status as currentMemberStatus,a.identify_name as name,a.lvl,
- b.contacts,b.contact_mobile as contactMobile,b.international,b.expert,b.celebrity,
- dg1.name as province,dg2.name as city, dg3.name as area,c.name as industry
- from
- (select
- id,type,status,create_time,service_certification,user_certification,current_member_status,identify_name,lvl
- from user
- where type = 0
- <if test="aid != null and aid !=''">
- and aid = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="shareType != null">
- and share_type = #{shareType,jdbcType=VARCHAR}
- </if>
- <if test="status != null">
- and status = #{status,jdbcType=INTEGER}
- </if>
- <if test="serviceCertification != null">
- and service_certification = #{serviceCertification,jdbcType=INTEGER}
- </if>
- <if test="userCertification != null">
- and user_certification = #{userCertification,jdbcType=INTEGER}
- </if>
- <if test="currentMemberStatus != null">
- and current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
- </if>
- <if test="startDate != null and startDate != ''">
- and create_time > STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''">
- and create_time < STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- )as a inner join user_identity b on a.id = b.uid
- left join district_glossory dg1 on b.province = dg1.id
- left join district_glossory dg2 on b.city = dg2.id
- left join district_glossory dg3 on b.area = dg3.id
- left join industry_category c on b.industry = c.id
- where 1=1
- <if test="name != null and name !=''">
- and b.username = #{name,jdbcType=VARCHAR}
- </if>
- <if test="province != null">
- and b.province = #{province,jdbcType=INTEGER}
- </if>
- <if test="city != null">
- and b.city = #{province,city=INTEGER}
- </if>
- <if test="province != null">
- and b.area = #{area,jdbcType=INTEGER}
- </if>
- <if test="industry != null">
- and b.industry = #{industry,jdbcType=INTEGER}
- </if>
- </when>
- <when test="type == 1">
- select
- a.id as uid,a.type,a.status, date_format(a.create_time,'%Y-%m-%d %H:%i:%s') as createTime,a.service_certification as serviceCertification,
- a.user_certification as userCertification,a.current_member_status as currentMemberStatus,a.identify_name as name,a.lvl,
- b.contacts,b.contact_mobile as contactMobile,b.international,0 as expert,0 as celebrity,
- dg1.name as province,dg2.name as city, dg3.name as area,c.name as industry
- from
- (select
- id,type,status,create_time,service_certification,user_certification,current_member_status,identify_name,lvl
- from user
- where type = 1
- <if test="aid != null and aid !=''">
- and aid = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="shareType != null">
- and share_type = #{shareType,jdbcType=VARCHAR}
- </if>
- <if test="status != null">
- and status = #{status,jdbcType=INTEGER}
- </if>
- <if test="serviceCertification != null">
- and service_certification = #{serviceCertification,jdbcType=INTEGER}
- </if>
- <if test="userCertification != null">
- and user_certification = #{userCertification,jdbcType=INTEGER}
- </if>
- <if test="currentMemberStatus != null">
- and current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
- </if>
- <if test="startDate != null and startDate != ''">
- and create_time > STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''">
- and create_time < STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- )as a inner join organization_identity b on a.id = b.uid
- left join district_glossory dg1 on b.licence_province = dg1.id
- left join district_glossory dg2 on b.licence_city = dg2.id
- left join district_glossory dg3 on b.licence_area = dg3.id
- left join industry_category c on b.industry = c.id
- where 1=1
- <if test="name != null and name != ''">
- and b.unit_name = #{name,jdbcType=VARCHAR}
- </if>
- <if test="province != null">
- and b.licence_province = #{province,jdbcType=INTEGER}
- </if>
- <if test="city != null">
- and b.licence_city = #{province,city=INTEGER}
- </if>
- <if test="province != null">
- and b.licence_area = #{area,jdbcType=INTEGER}
- </if>
- <if test="industry != null">
- and b.industry = #{industry,jdbcType=INTEGER}
- </if>
- </when>
- <otherwise>
- select * from (
- select
- a.id as uid,a.type,a.status, date_format(a.create_time,'%Y-%m-%d %H:%i:%s') as createTime,a.service_certification as serviceCertification,
- a.user_certification as userCertification,a.current_member_status as currentMemberStatus,a.identify_name as name,a.lvl,
- b.contacts,b.contact_mobile as contactMobile,b.international,b.expert,b.celebrity,
- dg1.name as province,dg2.name as city, dg3.name as area,c.name as industry
- from
- (select
- id,type,status,create_time,service_certification,user_certification,current_member_status,identify_name,lvl
- from user
- where type = 0
- <if test="aid != null and aid !=''">
- and aid = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="shareType != null">
- and share_type = #{shareType,jdbcType=VARCHAR}
- </if>
- <if test="status != null">
- and status = #{status,jdbcType=INTEGER}
- </if>
- <if test="serviceCertification != null">
- and service_certification = #{serviceCertification,jdbcType=INTEGER}
- </if>
- <if test="userCertification != null">
- and user_certification = #{userCertification,jdbcType=INTEGER}
- </if>
- <if test="currentMemberStatus != null">
- and current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
- </if>
- <if test="startDate != null and startDate != ''">
- and create_time > STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''">
- and create_time < STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- )as a inner join user_identity b on a.id = b.uid
- left join district_glossory dg1 on b.province = dg1.id
- left join district_glossory dg2 on b.city = dg2.id
- left join district_glossory dg3 on b.area = dg3.id
- left join industry_category c on b.industry = c.id
- where 1=1
- <if test="name != null and name != ''">
- and b.username = #{name,jdbcType=VARCHAR}
- </if>
- <if test="province != null">
- and b.province = #{province,jdbcType=INTEGER}
- </if>
- <if test="city != null">
- and b.city = #{province,city=INTEGER}
- </if>
- <if test="province != null">
- and b.area = #{area,jdbcType=INTEGER}
- </if>
- <if test="industry != null">
- and b.industry = #{industry,jdbcType=INTEGER}
- </if>
- union
- select
- a.id as uid,a.type,a.status, date_format(a.create_time,'%Y-%m-%d %H:%i:%s') as createTime,a.service_certification as serviceCertification,
- a.user_certification as userCertification,a.current_member_status as currentMemberStatus,a.identify_name as name,a.lvl,
- b.contacts,b.contact_mobile as contactMobile,b.international,0 as expert,0 as celebrity,
- dg1.name as province,dg2.name as city, dg3.name as area,c.name as industry
- from
- (select
- id,type,status,create_time,service_certification,user_certification,current_member_status,identify_name,lvl
- from user
- where type = 1
- <if test="aid != null and aid !=''">
- and aid = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="shareType != null">
- and share_type = #{shareType,jdbcType=VARCHAR}
- </if>
- <if test="status != null">
- and status = #{status,jdbcType=INTEGER}
- </if>
- <if test="serviceCertification != null">
- and service_certification = #{serviceCertification,jdbcType=INTEGER}
- </if>
- <if test="userCertification != null">
- and user_certification = #{userCertification,jdbcType=INTEGER}
- </if>
- <if test="currentMemberStatus != null">
- and current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
- </if>
- <if test="startDate != null and startDate != ''">
- and create_time > STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''">
- and create_time < STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- )as a inner join organization_identity b on a.id = b.uid
- left join district_glossory dg1 on b.licence_province = dg1.id
- left join district_glossory dg2 on b.licence_city = dg2.id
- left join district_glossory dg3 on b.licence_area = dg3.id
- left join industry_category c on b.industry = c.id
- where 1=1
- <if test="name != null and name != ''">
- and b.unit_name = #{name,jdbcType=VARCHAR}
- </if>
- <if test="province != null">
- and b.licence_province = #{province,jdbcType=INTEGER}
- </if>
- <if test="city != null">
- and b.licence_city = #{province,city=INTEGER}
- </if>
- <if test="province != null">
- and b.licence_area = #{area,jdbcType=INTEGER}
- </if>
- <if test="industry != null">
- and b.industry = #{industry,jdbcType=INTEGER}
- </if>
- )y
- </otherwise>
- </choose>
- order by createTime desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectCustomerCount" resultType="java.lang.Integer">
- <choose>
- <when test="type == 0">
- select
- count(0)
- from
- (select
- id
- from user
- where type = 0
- <if test="aid != null and aid !=''">
- and aid = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="shareType != null">
- and share_type = #{shareType,jdbcType=VARCHAR}
- </if>
- <if test="status != null">
- and status = #{status,jdbcType=INTEGER}
- </if>
- <if test="serviceCertification != null">
- and service_certification = #{serviceCertification,jdbcType=INTEGER}
- </if>
- <if test="userCertification != null">
- and user_certification = #{userCertification,jdbcType=INTEGER}
- </if>
- <if test="currentMemberStatus != null">
- and current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
- </if>
- <if test="startDate != null and startDate != ''">
- and create_time > STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''">
- and create_time < STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- )as a inner join user_identity b on a.id = b.uid
- where 1=1
- <if test="name != null and name !=''">
- and b.username = #{name,jdbcType=VARCHAR}
- </if>
- <if test="province != null">
- and b.province = #{province,jdbcType=INTEGER}
- </if>
- <if test="city != null">
- and b.city = #{province,city=INTEGER}
- </if>
- <if test="province != null">
- and b.area = #{area,jdbcType=INTEGER}
- </if>
- <if test="industry != null">
- and b.industry = #{industry,jdbcType=INTEGER}
- </if>
- </when>
- <when test="type == 1">
- select
- count(0)
- from
- (select
- id
- from user
- where type = 1
- <if test="aid != null and aid !=''">
- and aid = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="shareType != null">
- and share_type = #{shareType,jdbcType=VARCHAR}
- </if>
- <if test="status != null">
- and status = #{status,jdbcType=INTEGER}
- </if>
- <if test="serviceCertification != null">
- and service_certification = #{serviceCertification,jdbcType=INTEGER}
- </if>
- <if test="userCertification != null">
- and user_certification = #{userCertification,jdbcType=INTEGER}
- </if>
- <if test="currentMemberStatus != null">
- and current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
- </if>
- <if test="startDate != null and startDate != ''">
- and create_time > STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''">
- and create_time < STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- )as a inner join organization_identity b on a.id = b.uid
- where 1=1
- <if test="name != null and name !=''">
- and b.unit_name = #{name,jdbcType=VARCHAR}
- </if>
- <if test="province != null">
- and b.licence_province = #{province,jdbcType=INTEGER}
- </if>
- <if test="city != null">
- and b.licence_city = #{province,city=INTEGER}
- </if>
- <if test="province != null">
- and b.licence_area = #{area,jdbcType=INTEGER}
- </if>
- <if test="industry != null">
- and b.industry = #{industry,jdbcType=INTEGER}
- </if>
- </when>
- <otherwise>
- select count(0)
- from(
- select
- a.id
- from
- (select
- id
- from user
- where type = 0
- <if test="aid != null and aid !=''">
- and aid = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="shareType != null">
- and share_type = #{shareType,jdbcType=VARCHAR}
- </if>
- <if test="status != null">
- and status = #{status,jdbcType=INTEGER}
- </if>
- <if test="serviceCertification != null">
- and service_certification = #{serviceCertification,jdbcType=INTEGER}
- </if>
- <if test="userCertification != null">
- and user_certification = #{userCertification,jdbcType=INTEGER}
- </if>
- <if test="currentMemberStatus != null">
- and current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
- </if>
- <if test="startDate != null and startDate != ''">
- and create_time > STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''">
- and create_time < STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- )as a inner join user_identity b on a.id = b.uid
- where 1=1
- <if test="name != null and name !=''">
- and b.username = #{name,jdbcType=VARCHAR}
- </if>
- <if test="province != null">
- and b.province = #{province,jdbcType=INTEGER}
- </if>
- <if test="city != null">
- and b.city = #{province,city=INTEGER}
- </if>
- <if test="province != null">
- and b.area = #{area,jdbcType=INTEGER}
- </if>
- <if test="industry != null">
- and b.industry = #{industry,jdbcType=INTEGER}
- </if>
- union
- select
- a.id
- from
- (select
- id
- from user
- where type = 1
- <if test="aid != null and aid !=''">
- and aid = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="shareType != null">
- and share_type = #{shareType,jdbcType=VARCHAR}
- </if>
- <if test="status != null">
- and status = #{status,jdbcType=INTEGER}
- </if>
- <if test="serviceCertification != null">
- and service_certification = #{serviceCertification,jdbcType=INTEGER}
- </if>
- <if test="userCertification != null">
- and user_certification = #{userCertification,jdbcType=INTEGER}
- </if>
- <if test="currentMemberStatus != null">
- and current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
- </if>
- <if test="startDate != null and startDate != ''">
- and create_time > STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endDate != null and endDate != ''">
- and create_time < STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
- </if>
- )as a inner join organization_identity b on a.id = b.uid
- where 1=1
- <if test="name != null and name !=''">
- and b.unit_name = #{name,jdbcType=VARCHAR}
- </if>
- <if test="province != null">
- and b.licence_province = #{province,jdbcType=INTEGER}
- </if>
- <if test="city != null">
- and b.licence_city = #{province,city=INTEGER}
- </if>
- <if test="province != null">
- and b.licence_area = #{area,jdbcType=INTEGER}
- </if>
- <if test="industry != null">
- and b.industry = #{industry,jdbcType=INTEGER}
- </if>
- ) x
- </otherwise>
- </choose>
- </select>
- </mapper>
|