|
@@ -43,48 +43,66 @@
|
|
id, company_id, custom_name, custom_source_id, customer_industry_id, customer_level_id, email, owner_id, custom_code, tel_phone, fax, country_billing, province_billing, city_billing, street_billing, country_delivery, province_delivery, city_delivery, street_delivery, create_time, plate1, plate2, plate3, plate4, plate5, creator_id, custom_desc, is_delete, company_phone, incharger_id, address, close_deal
|
|
id, company_id, custom_name, custom_source_id, customer_industry_id, customer_level_id, email, owner_id, custom_code, tel_phone, fax, country_billing, province_billing, city_billing, street_billing, country_delivery, province_delivery, city_delivery, street_delivery, create_time, plate1, plate2, plate3, plate4, plate5, creator_id, custom_desc, is_delete, company_phone, incharger_id, address, close_deal
|
|
</sql>
|
|
</sql>
|
|
<select id="getList" resultType="com.management.platform.entity.Custom">
|
|
<select id="getList" resultType="com.management.platform.entity.Custom">
|
|
- select id,
|
|
|
|
- custom_name,
|
|
|
|
- email,
|
|
|
|
- company_phone,
|
|
|
|
- create_time,
|
|
|
|
- customer_level_id,
|
|
|
|
|
|
+ select
|
|
|
|
+ c.id,
|
|
|
|
+ c.contacts_name,
|
|
|
|
+ c.custom_name,
|
|
|
|
+ c.email,
|
|
|
|
+ c.company_phone,
|
|
|
|
+ c.create_time,
|
|
|
|
+ c.customer_level_id,
|
|
(select name from sys_dict where customer_level_id = id and code = 'CustomLevel') customerLevelValue,
|
|
(select name from sys_dict where customer_level_id = id and code = 'CustomLevel') customerLevelValue,
|
|
- customer_industry_id,
|
|
|
|
|
|
+ c.customer_industry_id,
|
|
(select name from sys_dict where customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
|
|
(select name from sys_dict where customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
|
|
- custom_source_id,
|
|
|
|
- (select name from sys_dict where custom_source_id = id and code = 'CustomSources') customSourceValue,
|
|
|
|
- incharger_id,
|
|
|
|
|
|
+ c.custom_source_id,
|
|
|
|
+ (select name from sys_dict where custom_source_id = id) customSourceValue,
|
|
|
|
+ c.incharger_id,
|
|
(select `name` from `user` where id = incharger_id) inchargerName,
|
|
(select `name` from `user` where id = incharger_id) inchargerName,
|
|
- creator_id,
|
|
|
|
|
|
+ c.creator_id,
|
|
(select `name` from `user` where id = creator_id) creatorName
|
|
(select `name` from `user` where id = creator_id) creatorName
|
|
- from custom
|
|
|
|
- where company_id = #{companyId}
|
|
|
|
- and is_delete =#{isDelete}
|
|
|
|
|
|
+ from custom c
|
|
|
|
+ left join sys_dict sd on c.customer_level_id = sd.id
|
|
|
|
+ where c.company_id = #{companyId}
|
|
|
|
+ and c.is_delete =#{isDelete}
|
|
<if test="inchargerId != null and inchargerId != '' ">
|
|
<if test="inchargerId != null and inchargerId != '' ">
|
|
- and incharger_id =#{inchargerId}
|
|
|
|
|
|
+ and c.incharger_id =#{inchargerId}
|
|
</if>
|
|
</if>
|
|
<if test="startTime != null and endTime != null ">
|
|
<if test="startTime != null and endTime != null ">
|
|
- and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
|
|
|
+ and c.create_time BETWEEN #{startTime} and #{endTime}
|
|
</if>
|
|
</if>
|
|
<if test="customName != null and customName != '' ">
|
|
<if test="customName != null and customName != '' ">
|
|
- and custom_name = #{customName}
|
|
|
|
|
|
+ and c.custom_name = #{customName}
|
|
</if>
|
|
</if>
|
|
<if test="email != null and email != '' ">
|
|
<if test="email != null and email != '' ">
|
|
- and email = #{email}
|
|
|
|
|
|
+ and c.email = #{email}
|
|
</if>
|
|
</if>
|
|
<if test="companyPhone != null ">
|
|
<if test="companyPhone != null ">
|
|
- and company_phone = #{companyPhone}
|
|
|
|
|
|
+ and c.company_phone = #{companyPhone}
|
|
</if>
|
|
</if>
|
|
<if test="customerLevelId != null ">
|
|
<if test="customerLevelId != null ">
|
|
- and customer_level_id = #{customerLevelId}
|
|
|
|
|
|
+ and c.customer_level_id = #{customerLevelId}
|
|
</if>
|
|
</if>
|
|
<if test="customSourceId != null ">
|
|
<if test="customSourceId != null ">
|
|
- and custom_source_id = #{customSourceId}
|
|
|
|
|
|
+ and c.custom_source_id = #{customSourceId}
|
|
</if>
|
|
</if>
|
|
<if test="customerIndustryId != null ">
|
|
<if test="customerIndustryId != null ">
|
|
- and customer_industry_id = #{customerIndustryId}
|
|
|
|
- </if>
|
|
|
|
|
|
+ and c.customer_industry_id = #{customerIndustryId}
|
|
|
|
+ </if>
|
|
|
|
+ ORDER BY
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="isDesc == null ">
|
|
|
|
+ c.id DESC
|
|
|
|
+ </when>
|
|
|
|
+ <when test="isDesc == 0">
|
|
|
|
+ sd.seq ASC, c.id DESC
|
|
|
|
+ </when>
|
|
|
|
+ <when test="isDesc == 1">
|
|
|
|
+ sd.seq DESC, c.id DESC
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ c.id DESC
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
Limit #{pageIndex},#{pageFrom}
|
|
Limit #{pageIndex},#{pageFrom}
|
|
</select>
|
|
</select>
|
|
<select id="getTotal" resultType="java.lang.Integer">
|
|
<select id="getTotal" resultType="java.lang.Integer">
|
|
@@ -118,51 +136,67 @@
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</select>
|
|
<select id="getList1" resultType="com.management.platform.entity.Custom">
|
|
<select id="getList1" resultType="com.management.platform.entity.Custom">
|
|
- select id,
|
|
|
|
- custom_name,
|
|
|
|
- email,
|
|
|
|
- company_phone,
|
|
|
|
- create_time,
|
|
|
|
- customer_level_id,
|
|
|
|
|
|
+ select c.id,
|
|
|
|
+ c.custom_name,
|
|
|
|
+ c.email,
|
|
|
|
+ c.company_phone,
|
|
|
|
+ c.create_time,
|
|
|
|
+ c.customer_level_id,
|
|
(select name from sys_dict where customer_level_id = id and code = 'CustomLevel') customerLevelValue,
|
|
(select name from sys_dict where customer_level_id = id and code = 'CustomLevel') customerLevelValue,
|
|
- customer_industry_id,
|
|
|
|
|
|
+ c.customer_industry_id,
|
|
(select name from sys_dict where customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
|
|
(select name from sys_dict where customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
|
|
- custom_source_id,
|
|
|
|
- (select name from sys_dict where custom_source_id = id and code = 'CustomSources') customSourceValue,
|
|
|
|
- incharger_id,
|
|
|
|
|
|
+ c.custom_source_id,
|
|
|
|
+ (select name from sys_dict where custom_source_id = id ) customSourceValue,
|
|
|
|
+ c.incharger_id,
|
|
(select `name` from `user` where id = incharger_id) inchargerName,
|
|
(select `name` from `user` where id = incharger_id) inchargerName,
|
|
- creator_id,
|
|
|
|
|
|
+ c.creator_id,
|
|
(select `name` from `user` where id = creator_id) creatorName
|
|
(select `name` from `user` where id = creator_id) creatorName
|
|
- from custom
|
|
|
|
- where company_id = #{companyId}
|
|
|
|
- and is_delete =#{isDelete}
|
|
|
|
- and incharger_id in
|
|
|
|
- (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
|
|
|
|
- or incharger_id is null
|
|
|
|
|
|
+ from custom c
|
|
|
|
+ left join sys_dict sd on c.customer_level_id = sd.id
|
|
|
|
+ where c.company_id = #{companyId}
|
|
|
|
+ and c.is_delete =#{isDelete}
|
|
|
|
+ and c.incharger_id in
|
|
|
|
+ (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERE id = #{userId}))
|
|
|
|
+ or c.incharger_id is null
|
|
<if test="inchargerId != null and inchargerId != '' ">
|
|
<if test="inchargerId != null and inchargerId != '' ">
|
|
- and incharger_id =#{inchargerId}
|
|
|
|
|
|
+ and c.incharger_id =#{inchargerId}
|
|
</if>
|
|
</if>
|
|
<if test="startTime != null and endTime != null ">
|
|
<if test="startTime != null and endTime != null ">
|
|
- and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
|
|
|
+ and c.create_time BETWEEN #{startTime} and #{endTime}
|
|
</if>
|
|
</if>
|
|
<if test="customName != null and customName != '' ">
|
|
<if test="customName != null and customName != '' ">
|
|
- and custom_name = #{customName}
|
|
|
|
|
|
+ and c.custom_name = #{customName}
|
|
</if>
|
|
</if>
|
|
<if test="email != null and email != '' ">
|
|
<if test="email != null and email != '' ">
|
|
- and email = #{email}
|
|
|
|
|
|
+ and c.email = #{email}
|
|
</if>
|
|
</if>
|
|
<if test="companyPhone != null ">
|
|
<if test="companyPhone != null ">
|
|
- and company_phone = #{companyPhone}
|
|
|
|
|
|
+ and c.company_phone = #{companyPhone}
|
|
</if>
|
|
</if>
|
|
<if test="customerLevelId != null ">
|
|
<if test="customerLevelId != null ">
|
|
- and customer_level_id = #{customerLevelId}
|
|
|
|
|
|
+ and c.customer_level_id = #{customerLevelId}
|
|
</if>
|
|
</if>
|
|
<if test="customSourceId != null ">
|
|
<if test="customSourceId != null ">
|
|
- and custom_source_id = #{customSourceId}
|
|
|
|
|
|
+ and c.custom_source_id = #{customSourceId}
|
|
</if>
|
|
</if>
|
|
<if test="customerIndustryId != null ">
|
|
<if test="customerIndustryId != null ">
|
|
- and customer_industry_id = #{customerIndustryId}
|
|
|
|
- </if>
|
|
|
|
|
|
+ and c.customer_industry_id = #{customerIndustryId}
|
|
|
|
+ </if>
|
|
|
|
+ ORDER BY
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="isDesc == null ">
|
|
|
|
+ c.id DESC
|
|
|
|
+ </when>
|
|
|
|
+ <when test="isDesc == 0">
|
|
|
|
+ sd.seq ASC, c.id DESC
|
|
|
|
+ </when>
|
|
|
|
+ <when test="isDesc == 1">
|
|
|
|
+ sd.seq DESC, c.id DESC
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ c.id DESC
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
Limit #{pageIndex},#{pageFrom}
|
|
Limit #{pageIndex},#{pageFrom}
|
|
</select>
|
|
</select>
|
|
<select id="getTotal1" resultType="java.lang.Integer">
|
|
<select id="getTotal1" resultType="java.lang.Integer">
|
|
@@ -209,7 +243,7 @@
|
|
customer_industry_id,
|
|
customer_industry_id,
|
|
(select name from sys_dict where customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
|
|
(select name from sys_dict where customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
|
|
custom_source_id,
|
|
custom_source_id,
|
|
- (select name from sys_dict where custom_source_id = id and code = 'CustomSources') customSourceValue,
|
|
|
|
|
|
+ (select name from sys_dict where custom_source_id = id ) customSourceValue,
|
|
incharger_id,
|
|
incharger_id,
|
|
(select `name` from `user` where id = incharger_id) inchargerName,
|
|
(select `name` from `user` where id = incharger_id) inchargerName,
|
|
creator_id,
|
|
creator_id,
|
|
@@ -243,6 +277,7 @@
|
|
<if test="customerIndustryId != null ">
|
|
<if test="customerIndustryId != null ">
|
|
and customer_industry_id = #{customerIndustryId}
|
|
and customer_industry_id = #{customerIndustryId}
|
|
</if>
|
|
</if>
|
|
|
|
+ ORDER BY id desc
|
|
Limit #{pageIndex},#{pageFrom}
|
|
Limit #{pageIndex},#{pageFrom}
|
|
</select>
|
|
</select>
|
|
<select id="getTotal2" resultType="java.lang.Integer">
|
|
<select id="getTotal2" resultType="java.lang.Integer">
|
|
@@ -280,10 +315,12 @@
|
|
<select id="getInfo" resultType="com.management.platform.entity.Custom">
|
|
<select id="getInfo" resultType="com.management.platform.entity.Custom">
|
|
select id,
|
|
select id,
|
|
custom_name,
|
|
custom_name,
|
|
|
|
+ contacts_name,
|
|
custom_source_id,
|
|
custom_source_id,
|
|
customer_industry_id,
|
|
customer_industry_id,
|
|
customer_level_id,
|
|
customer_level_id,
|
|
email,
|
|
email,
|
|
|
|
+ tel_phone,
|
|
address,
|
|
address,
|
|
custom_code,
|
|
custom_code,
|
|
tel_phone,
|
|
tel_phone,
|
|
@@ -299,7 +336,7 @@
|
|
is_delete,
|
|
is_delete,
|
|
(select `name` from sys_dict where customer_level_id = id and code = 'CustomLevel') customerLevelValue,
|
|
(select `name` from sys_dict where customer_level_id = id and code = 'CustomLevel') customerLevelValue,
|
|
(select `name` from sys_dict where customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
|
|
(select `name` from sys_dict where customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
|
|
- (select `name` from sys_dict where custom_source_id = id and code = 'CustomSources') customSourceValue,
|
|
|
|
|
|
+ (select `name` from sys_dict where custom_source_id = id ) customSourceValue,
|
|
(select `name` from `user` where id = incharger_id) inchargerName,
|
|
(select `name` from `user` where id = incharger_id) inchargerName,
|
|
(select `name` from `user` where id = creator_id) creatorName
|
|
(select `name` from `user` where id = creator_id) creatorName
|
|
from custom
|
|
from custom
|