|
@@ -13,7 +13,9 @@
|
|
|
<result column="expected_transaction_date" property="expectedTransactionDate" />
|
|
|
<result column="stage" property="stage" />
|
|
|
<result column="create_time" property="createTime" />
|
|
|
+ <result column="edit_time" property="editTime" />
|
|
|
<result column="creator_id" property="creatorId" />
|
|
|
+ <result column="incharger_id" property="inchargerId" />
|
|
|
<result column="remark" property="remark" />
|
|
|
<result column="is_delete" property="isDelete" />
|
|
|
<result column="plate1" property="plate1" />
|
|
@@ -25,166 +27,7 @@
|
|
|
|
|
|
<!-- 通用查询结果列 -->
|
|
|
<sql id="Base_Column_List">
|
|
|
- id, company_id, name, contacts_id, customer_id, amount_of_money, expected_transaction_date, stage, create_time, creator_id, incharger_id, remark, is_delete, plate1, plate2, plate3, plate4, plate5
|
|
|
+ id, company_id, name, contacts_id, customer_id, amount_of_money, expected_transaction_date, stage, create_time, edit_time, creator_id, incharger_id, remark, is_delete, plate1, plate2, plate3, plate4, plate5
|
|
|
</sql>
|
|
|
- <select id="selectAllList" resultType="com.management.platform.entity.BusinessOpportunity">
|
|
|
- select
|
|
|
- b.id,
|
|
|
- b.`name`,
|
|
|
- Sum(ip.total_price),
|
|
|
- b.stage,
|
|
|
- (SELECT GROUP_CONCAT(product_name) from business_item_product i LEFT JOIN product t on i.product_id = t.id WHERE i.business_id = b.id) productName
|
|
|
- FROM business_opportunity b
|
|
|
- left join business_item_product ip ON ip.business_id = b.id
|
|
|
- left join product p on p.id = ip.product_id
|
|
|
- WHERE b.company_id = #{companyId}
|
|
|
- and is_delete = #{isDelete}
|
|
|
- <if test="name != null and name != ''" >
|
|
|
- and b.name = #{name}
|
|
|
- </if>
|
|
|
- <if test="stage != null " >
|
|
|
- and b.stage = #{stage}
|
|
|
- </if>
|
|
|
- <if test="startTime != null and bo.endTime != null " >
|
|
|
- and b.expected_transaction_date BETWEEN #{startTime} and #{endTime}
|
|
|
- </if>
|
|
|
- <if test="productId != null ">
|
|
|
- and p.id = #{productId}
|
|
|
- </if>
|
|
|
- GROUP BY b.id
|
|
|
- LIMIT #{pageIndex},#{pageSize}
|
|
|
- </select>
|
|
|
- <select id="selectAllList1" resultType="com.management.platform.entity.BusinessOpportunity">
|
|
|
- select
|
|
|
- b.id,
|
|
|
- b.`name`,
|
|
|
- Sum(ip.total_price),
|
|
|
- b.stage,
|
|
|
- (SELECT GROUP_CONCAT(product_name) from business_item_product i LEFT JOIN product t on i.product_id = t.id WHERE
|
|
|
- i.business_id = b.id) productName
|
|
|
- FROM business_opportunity b
|
|
|
- left join business_item_product ip ON ip.business_id = b.id
|
|
|
- left join product p on p.id = ip.product_id
|
|
|
- WHERE b.company_id = #{bo.companyId}
|
|
|
- and b.is_delete = #{bo.isDelete}
|
|
|
- and b.incharger_id in
|
|
|
- (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
|
|
|
- and b.incharger_id is null
|
|
|
- <if test="bo.name != null and bo.name != ''">
|
|
|
- and b.name = #{bo.name}
|
|
|
- </if>
|
|
|
- <if test="bo.stage != null ">
|
|
|
- and b.stage = #{bo.stage}
|
|
|
- </if>
|
|
|
- <if test="bo.startTime != null and bo.endTime != null ">
|
|
|
- and b.expected_transaction_date BETWEEN #{bo.startTime} and #{bo.endTime}
|
|
|
- </if>
|
|
|
- <if test="bo.productId != null ">
|
|
|
- and p.id = #{bo.productId}
|
|
|
- </if>
|
|
|
- GROUP BY b.id
|
|
|
- LIMIT #{bo.pageIndex},#{bo.pageSize}
|
|
|
- </select>
|
|
|
- <select id="selectAllList2" resultType="com.management.platform.entity.BusinessOpportunity">
|
|
|
- select
|
|
|
- b.id,
|
|
|
- b.`name`,
|
|
|
- Sum(ip.total_price),
|
|
|
- b.stage,
|
|
|
- (SELECT GROUP_CONCAT(product_name) from business_item_product i LEFT JOIN product t on i.product_id = t.id WHERE
|
|
|
- i.business_id = b.id) productName
|
|
|
- FROM business_opportunity b
|
|
|
- left join business_item_product ip ON ip.business_id = b.id
|
|
|
- left join product p on p.id = ip.product_id
|
|
|
- WHERE b.company_id = #{bo.companyId}
|
|
|
- and b.incharger_id = #{userId}
|
|
|
- and b.is_delete = #{bo.isDelete}
|
|
|
- and b.incharger_id is null
|
|
|
- <if test="bo.name != null and bo.name != ''">
|
|
|
- and b.name = #{bo.name}
|
|
|
- </if>
|
|
|
- <if test="bo.stage != null ">
|
|
|
- and b.stage = #{bo.stage}
|
|
|
- </if>
|
|
|
- <if test="bo.startTime != null and bo.endTime != null ">
|
|
|
- and b.expected_transaction_date BETWEEN #{bo.startTime} and #{bo.endTime}
|
|
|
- </if>
|
|
|
- <if test="bo.productId != null ">
|
|
|
- and p.id = #{bo.productId}
|
|
|
- </if>
|
|
|
- GROUP BY b.id
|
|
|
- LIMIT #{bo.pageIndex},#{bo.pageSize}
|
|
|
- </select>
|
|
|
- <select id="getTotal" resultType="java.lang.Integer">
|
|
|
- select
|
|
|
- conut(b.id)
|
|
|
- FROM business_opportunity b
|
|
|
- left join business_item_product ip ON ip.business_id = b.id
|
|
|
- left join product p on p.id = ip.product_id
|
|
|
- WHERE b.company_id = #{companyId}
|
|
|
- and b.is_delete = #{isDelete}
|
|
|
- <if test="name != null and name != ''" >
|
|
|
- and b.name = #{name}
|
|
|
- </if>
|
|
|
- <if test="stage != null " >
|
|
|
- and b.stage = #{stage}
|
|
|
- </if>
|
|
|
- <if test="startTime != null and endTime != null " >
|
|
|
- and b.expected_transaction_date BETWEEN #{startTime} and #{endTime}
|
|
|
- </if>
|
|
|
- <if test="productId != null ">
|
|
|
- and p.id = #{productId}
|
|
|
- </if>
|
|
|
- GROUP BY b.id
|
|
|
- </select>
|
|
|
- <select id="getTotal1" resultType="java.lang.Integer">
|
|
|
- select
|
|
|
- count(b.id)
|
|
|
- FROM business_opportunity b
|
|
|
- left join business_item_product ip ON ip.business_id = b.id
|
|
|
- left join product p on p.id = ip.product_id
|
|
|
- WHERE b.company_id = #{bo.companyId}
|
|
|
- and b.is_delete = #{bo.isDelete}
|
|
|
- and b.incharger_id in
|
|
|
- (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
|
|
|
- and b.incharger_id is null
|
|
|
- <if test="bo.name != null and bo.name != ''">
|
|
|
- and b.name = #{bo.name}
|
|
|
- </if>
|
|
|
- <if test="bo.stage != null ">
|
|
|
- and b.stage = #{bo.stage}
|
|
|
- </if>
|
|
|
- <if test="bo.startTime != null and bo.endTime != null ">
|
|
|
- and b.expected_transaction_date BETWEEN #{bo.startTime} and #{bo.endTime}
|
|
|
- </if>
|
|
|
- <if test="bo.productId != null ">
|
|
|
- and p.id = #{bo.productId}
|
|
|
- </if>
|
|
|
- GROUP BY b.id
|
|
|
- </select>
|
|
|
- <select id="getTotal2" resultType="java.lang.Integer">
|
|
|
- select
|
|
|
- COUNT(b.id)
|
|
|
- FROM business_opportunity b
|
|
|
- left join business_item_product ip ON ip.business_id = b.id
|
|
|
- left join product p on p.id = ip.product_id
|
|
|
- WHERE b.company_id = #{bo.companyId}
|
|
|
- and b.is_delete = #{bo.isDelete}
|
|
|
- and b.incharger_id = #{userId}
|
|
|
- and b.incharger_id is null
|
|
|
- <if test="bo.name != null and bo.name != ''">
|
|
|
- and b.name = #{bo.name}
|
|
|
- </if>
|
|
|
- <if test="bo.stage != null ">
|
|
|
- and b.stage = #{bo.stage}
|
|
|
- </if>
|
|
|
- <if test="bo.startTime != null and bo.endTime != null ">
|
|
|
- and b.expected_transaction_date BETWEEN #{bo.startTime} and #{bo.endTime}
|
|
|
- </if>
|
|
|
- <if test="bo.productId != null ">
|
|
|
- and p.id = #{bo.productId}
|
|
|
- </if>
|
|
|
- GROUP BY b.id
|
|
|
- </select>
|
|
|
|
|
|
</mapper>
|