|
@@ -12,7 +12,7 @@
|
|
|
<result column="product_id" property="productId" />
|
|
|
<result column="amount_of_money" property="amountOfMoney" />
|
|
|
<result column="expected_transaction_date" property="expectedTransactionDate" />
|
|
|
- <result column="stage" property="stage" />
|
|
|
+ <result column="stage_id" property="stageId" />
|
|
|
<result column="create_time" property="createTime" />
|
|
|
<result column="edit_time" property="editTime" />
|
|
|
<result column="creator_id" property="creatorId" />
|
|
@@ -41,6 +41,7 @@
|
|
|
(SELECT sum(total) from business_product WHERE business_id = id)
|
|
|
from business_opportunity
|
|
|
where company_id = #{companyId}
|
|
|
+ and is_delete = #{isDelete}
|
|
|
<if test="name != null and name != ''">
|
|
|
and `name` LIKE CONCAT('%', #{name}, '%')
|
|
|
</if>
|
|
@@ -62,6 +63,174 @@
|
|
|
<if test="productId != null ">
|
|
|
and id in (select business_id from business_product where product_id = #{productId})
|
|
|
</if>
|
|
|
+ ORDER BY id DESC
|
|
|
+ limit #{pageIndex},#{pageFrom}
|
|
|
</select>
|
|
|
+ <select id="getTotal" resultType="java.lang.Integer">
|
|
|
+ select
|
|
|
+ count(id)
|
|
|
+ from business_opportunity
|
|
|
+ where company_id = #{companyId}
|
|
|
+ and is_delete = #{isDelete}
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and `name` LIKE CONCAT('%', #{name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="inchargerId != null ">
|
|
|
+ and incharger_id = #{inchargerId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null ">
|
|
|
+ and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="contactsName != null and contactsName != ''">
|
|
|
+ and contacts_id in (select id from contacts where `name`LIKE CONCAT('%', #{contactsName}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="customerName != null and customerName != ''">
|
|
|
+ and customer_id in (select id from custom where `name`LIKE CONCAT('%', #{customerName}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="stageId != null ">
|
|
|
+ and stage_id = #{stageId}
|
|
|
+ </if>
|
|
|
+ <if test="productId != null ">
|
|
|
+ and id in (select business_id from business_product where product_id = #{productId})
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="selectAllList1" resultType="com.management.platform.entity.BusinessOpportunity">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"></include>,
|
|
|
+ (select `name` from stage where id = stage_id) stageValue,
|
|
|
+ (select custom_name from custom where id = customer_id) customerName,
|
|
|
+ (select `name` from contacts where id = contacts_id) contactsName,
|
|
|
+ (select `name` from `user` where id = contacts_id) inchargerName,
|
|
|
+ (select `name` from `user` where id = creator_id) creatorName,
|
|
|
+ (SELECT sum(total) from business_product WHERE business_id = id)
|
|
|
+ from business_opportunity
|
|
|
+ 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="name != null and name != ''">
|
|
|
+ and `name` LIKE CONCAT('%', #{name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="inchargerId != null ">
|
|
|
+ and incharger_id = #{inchargerId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null ">
|
|
|
+ and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="contactsName != null and contactsName != ''">
|
|
|
+ and contacts_id in (select id from contacts where `name`LIKE CONCAT('%', #{contactsName}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="customerName != null and customerName != ''">
|
|
|
+ and customer_id in (select id from custom where `name`LIKE CONCAT('%', #{customerName}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="stageId != null ">
|
|
|
+ and stage_id = #{stageId}
|
|
|
+ </if>
|
|
|
+ <if test="productId != null ">
|
|
|
+ and id in (select business_id from business_product where product_id = #{productId})
|
|
|
+ </if>
|
|
|
+ ORDER BY id DESC
|
|
|
+ limit #{pageIndex},#{pageFrom}
|
|
|
+ </select>
|
|
|
+ <select id="getTotal1" resultType="java.lang.Integer">
|
|
|
+ select
|
|
|
+ count(id)
|
|
|
+ from business_opportunity
|
|
|
+ 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="name != null and name != ''">
|
|
|
+ and `name` LIKE CONCAT('%', #{name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="inchargerId != null ">
|
|
|
+ and incharger_id = #{inchargerId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null ">
|
|
|
+ and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="contactsName != null and contactsName != ''">
|
|
|
+ and contacts_id in (select id from contacts where `name`LIKE CONCAT('%', #{contactsName}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="customerName != null and customerName != ''">
|
|
|
+ and customer_id in (select id from custom where `name`LIKE CONCAT('%', #{customerName}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="stageId != null ">
|
|
|
+ and stage_id = #{stageId}
|
|
|
+ </if>
|
|
|
+ <if test="productId != null ">
|
|
|
+ and id in (select business_id from business_product where product_id = #{productId})
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="selectAllList2" resultType="com.management.platform.entity.BusinessOpportunity">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"></include>,
|
|
|
+ (select `name` from stage where id = stage_id) stageValue,
|
|
|
+ (select custom_name from custom where id = customer_id) customerName,
|
|
|
+ (select `name` from contacts where id = contacts_id) contactsName,
|
|
|
+ (select `name` from `user` where id = contacts_id) inchargerName,
|
|
|
+ (select `name` from `user` where id = creator_id) creatorName,
|
|
|
+ (SELECT sum(total) from business_product WHERE business_id = id)
|
|
|
+ from business_opportunity
|
|
|
+ where company_id = #{companyId}
|
|
|
+ and is_delete = #{isDelete}
|
|
|
+ and (incharger_id = #{userId} or incharger_id is null)
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and `name` LIKE CONCAT('%', #{name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="inchargerId != null ">
|
|
|
+ and incharger_id = #{inchargerId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null ">
|
|
|
+ and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="contactsName != null and contactsName != ''">
|
|
|
+ and contacts_id in (select id from contacts where `name`LIKE CONCAT('%', #{contactsName}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="customerName != null and customerName != ''">
|
|
|
+ and customer_id in (select id from custom where `name`LIKE CONCAT('%', #{customerName}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="stageId != null ">
|
|
|
+ and stage_id = #{stageId}
|
|
|
+ </if>
|
|
|
+ <if test="productId != null ">
|
|
|
+ and id in (select business_id from business_product where product_id = #{productId})
|
|
|
+ </if>
|
|
|
+ ORDER BY id DESC
|
|
|
+ limit #{pageIndex},#{pageFrom}
|
|
|
+ </select>
|
|
|
+ <select id="getTotal2" resultType="java.lang.Integer">
|
|
|
+ select
|
|
|
+ count(id)
|
|
|
+ from business_opportunity
|
|
|
+ where company_id = #{companyId}
|
|
|
+ and is_delete = #{isDelete}
|
|
|
+ and (incharger_id = #{userId} or incharger_id is null)
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and `name` LIKE CONCAT('%', #{name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="inchargerId != null ">
|
|
|
+ and incharger_id = #{inchargerId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null ">
|
|
|
+ and create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="contactsName != null and contactsName != ''">
|
|
|
+ and contacts_id in (select id from contacts where `name`LIKE CONCAT('%', #{contactsName}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="customerName != null and customerName != ''">
|
|
|
+ and customer_id in (select id from custom where `name`LIKE CONCAT('%', #{customerName}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="stageId != null ">
|
|
|
+ and stage_id = #{stageId}
|
|
|
+ </if>
|
|
|
+ <if test="productId != null ">
|
|
|
+ and id in (select business_id from business_product where product_id = #{productId})
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
|
|
|
</mapper>
|