|
@@ -38,5 +38,225 @@
|
|
|
<sql id="Base_Column_List">
|
|
|
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
|
|
|
</sql>
|
|
|
+ <select id="getList" resultType="com.management.platform.entity.Custom">
|
|
|
+ select id,
|
|
|
+ custom_name,
|
|
|
+ email,
|
|
|
+ company_phone,
|
|
|
+ create_time,
|
|
|
+ (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 custom_source_id = id and code = 'CustomSources') customSourceValue,
|
|
|
+ (select `name` from `user` where id = incharger_id) inchargerName,
|
|
|
+ (select `name` from `user` where id = creator_id) creatorName
|
|
|
+ from custom
|
|
|
+ where company_id = #{companyId}
|
|
|
+ and is_delete =#{isDelete}
|
|
|
+ <if test="inchargerId != null and inchargerId != '' ">
|
|
|
+ and incharger_id =#{inchargerId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null ">
|
|
|
+ and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="customName != null and customName != '' ">
|
|
|
+ and custom_name = #{customName}
|
|
|
+ </if>
|
|
|
+ <if test="email != null and email != '' ">
|
|
|
+ and email = #{email}
|
|
|
+ </if>
|
|
|
+ <if test="companyPhone != null ">
|
|
|
+ and company_phone = #{companyPhone}
|
|
|
+ </if>
|
|
|
+ <if test="customerLevelId != null ">
|
|
|
+ and customer_level_id = #{customerLevelId}
|
|
|
+ </if>
|
|
|
+ <if test="customSourceId != null ">
|
|
|
+ and custom_source_id = #{customSourceId}
|
|
|
+ </if>
|
|
|
+ <if test="customerIndustryId != null ">
|
|
|
+ and customer_industry_id = #{customerIndustryId}
|
|
|
+ </if>
|
|
|
+ Limit #{pageIndex},#{pageFrom}
|
|
|
+ </select>
|
|
|
+ <select id="getTotal" resultType="java.lang.Integer">
|
|
|
+ select count(id)
|
|
|
+ from custom
|
|
|
+ where company_id = #{companyId}
|
|
|
+ and is_delete =#{isDelete}
|
|
|
+ <if test="inchargerId != null and inchargerId != '' ">
|
|
|
+ and incharger_id =#{inchargerId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null ">
|
|
|
+ and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="customName != null and customName != '' ">
|
|
|
+ and custom_name = #{customName}
|
|
|
+ </if>
|
|
|
+ <if test="email != null and email != '' ">
|
|
|
+ and email = #{email}
|
|
|
+ </if>
|
|
|
+ <if test="companyPhone != null ">
|
|
|
+ and company_phone = #{companyPhone}
|
|
|
+ </if>
|
|
|
+ <if test="customerLevelId != null ">
|
|
|
+ and customer_level_id = #{customerLevelId}
|
|
|
+ </if>
|
|
|
+ <if test="customSourceId != null ">
|
|
|
+ and custom_source_id = #{customSourceId}
|
|
|
+ </if>
|
|
|
+ <if test="customerIndustryId != null ">
|
|
|
+ and customer_industry_id = #{customerIndustryId}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="getList1" resultType="com.management.platform.entity.Custom">
|
|
|
+ select id,
|
|
|
+ custom_name,
|
|
|
+ email,
|
|
|
+ company_phone,
|
|
|
+ create_time,
|
|
|
+ (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 custom_source_id = id and code = 'CustomSources') customSourceValue,
|
|
|
+ (select `name` from `user` where id = incharger_id) inchargerName,
|
|
|
+ (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
|
|
|
+ <if test="inchargerId != null and inchargerId != '' ">
|
|
|
+ and incharger_id =#{inchargerId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null ">
|
|
|
+ and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="customName != null and customName != '' ">
|
|
|
+ and custom_name = #{customName}
|
|
|
+ </if>
|
|
|
+ <if test="email != null and email != '' ">
|
|
|
+ and email = #{email}
|
|
|
+ </if>
|
|
|
+ <if test="companyPhone != null ">
|
|
|
+ and company_phone = #{companyPhone}
|
|
|
+ </if>
|
|
|
+ <if test="customerLevelId != null ">
|
|
|
+ and customer_level_id = #{customerLevelId}
|
|
|
+ </if>
|
|
|
+ <if test="customSourceId != null ">
|
|
|
+ and custom_source_id = #{customSourceId}
|
|
|
+ </if>
|
|
|
+ <if test="customerIndustryId != null ">
|
|
|
+ and customer_industry_id = #{customerIndustryId}
|
|
|
+ </if>
|
|
|
+ Limit #{pageIndex},#{pageFrom}
|
|
|
+ </select>
|
|
|
+ <select id="getTotal1" resultType="java.lang.Integer">
|
|
|
+ select count(id)
|
|
|
+ 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
|
|
|
+ <if test="inchargerId != null and inchargerId != '' ">
|
|
|
+ and incharger_id =#{inchargerId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null ">
|
|
|
+ and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="customName != null and customName != '' ">
|
|
|
+ and custom_name = #{customName}
|
|
|
+ </if>
|
|
|
+ <if test="email != null and email != '' ">
|
|
|
+ and email = #{email}
|
|
|
+ </if>
|
|
|
+ <if test="companyPhone != null ">
|
|
|
+ and company_phone = #{companyPhone}
|
|
|
+ </if>
|
|
|
+ <if test="customerLevelId != null ">
|
|
|
+ and customer_level_id = #{customerLevelId}
|
|
|
+ </if>
|
|
|
+ <if test="customSourceId != null ">
|
|
|
+ and custom_source_id = #{customSourceId}
|
|
|
+ </if>
|
|
|
+ <if test="customerIndustryId != null ">
|
|
|
+ and customer_industry_id = #{customerIndustryId}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="getList2" resultType="com.management.platform.entity.Custom">
|
|
|
+ select id,
|
|
|
+ custom_name,
|
|
|
+ email,
|
|
|
+ company_phone,
|
|
|
+ create_time,
|
|
|
+ (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 custom_source_id = id and code = 'CustomSources') customSourceValue,
|
|
|
+ (select `name` from `user` where id = incharger_id) inchargerName,
|
|
|
+ (select `name` from `user` where id = creator_id) creatorName
|
|
|
+ from custom
|
|
|
+ where company_id = #{companyId}
|
|
|
+ and is_delete =#{isDelete}
|
|
|
+ and incharger_id = #{inchargerId}
|
|
|
+ or incharger_id is null
|
|
|
+ <if test="inchargerId != null and inchargerId != '' ">
|
|
|
+ and incharger_id =#{inchargerId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null ">
|
|
|
+ and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="customName != null and customName != '' ">
|
|
|
+ and custom_name = #{customName}
|
|
|
+ </if>
|
|
|
+ <if test="email != null and email != '' ">
|
|
|
+ and email = #{email}
|
|
|
+ </if>
|
|
|
+ <if test="companyPhone != null ">
|
|
|
+ and company_phone = #{companyPhone}
|
|
|
+ </if>
|
|
|
+ <if test="customerLevelId != null ">
|
|
|
+ and customer_level_id = #{customerLevelId}
|
|
|
+ </if>
|
|
|
+ <if test="customSourceId != null ">
|
|
|
+ and custom_source_id = #{customSourceId}
|
|
|
+ </if>
|
|
|
+ <if test="customerIndustryId != null ">
|
|
|
+ and customer_industry_id = #{customerIndustryId}
|
|
|
+ </if>
|
|
|
+ Limit #{pageIndex},#{pageFrom}
|
|
|
+ </select>
|
|
|
+ <select id="getTotal2" resultType="java.lang.Integer">
|
|
|
+ select count(id)
|
|
|
+ from custom
|
|
|
+ where company_id = #{companyId}
|
|
|
+ and is_delete = #{isDelete}
|
|
|
+ and incharger_id = #{inchargerId}
|
|
|
+ or incharger_id is null
|
|
|
+ <if test="inchargerId != null and inchargerId != '' ">
|
|
|
+ and incharger_id =#{inchargerId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null ">
|
|
|
+ and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="customName != null and customName != '' ">
|
|
|
+ and custom_name = #{customName}
|
|
|
+ </if>
|
|
|
+ <if test="email != null and email != '' ">
|
|
|
+ and email = #{email}
|
|
|
+ </if>
|
|
|
+ <if test="companyPhone != null ">
|
|
|
+ and company_phone = #{companyPhone}
|
|
|
+ </if>
|
|
|
+ <if test="customerLevelId != null ">
|
|
|
+ and customer_level_id = #{customerLevelId}
|
|
|
+ </if>
|
|
|
+ <if test="customSourceId != null ">
|
|
|
+ and custom_source_id = #{customSourceId}
|
|
|
+ </if>
|
|
|
+ <if test="customerIndustryId != null ">
|
|
|
+ and customer_industry_id = #{customerIndustryId}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|