|
|
@@ -690,15 +690,36 @@
|
|
|
io.*
|
|
|
from
|
|
|
ins_orders io
|
|
|
- left JOIN
|
|
|
- ins_area_company iac on iac.orderno = io.orderno
|
|
|
+ <!--如果存在 公司查询则进行连表 -->
|
|
|
+ <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
|
+ left JOIN
|
|
|
+ ins_area_company iac on iac.orderno = io.orderno
|
|
|
+ </if>
|
|
|
<where>
|
|
|
<if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
|
|
|
and io.orderno = #{orderQueryVo.orderNo}
|
|
|
</if>
|
|
|
+ <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' and isTeamLeader">
|
|
|
+ and io.deptid like "${orderQueryVo.deptId}%"
|
|
|
+ </if>
|
|
|
<if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
|
|
|
and io.orderstatus = #{orderQueryVo.orderStatus}
|
|
|
</if>
|
|
|
+ <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
|
|
|
+ and io.frameno = #{orderQueryVo.frameNo}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
|
|
|
+ and io.licenseno = #{orderQueryVo.licenseNo}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
|
|
|
+ and io.insuredname = #{orderQueryVo.insuredName}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
|
|
|
+ and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
|
+ and iac.company_id = #{orderQueryVo.companyId}
|
|
|
+ </if>
|
|
|
<if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
|
|
|
and io.userid = #{orderQueryVo.userId}
|
|
|
</if>
|
|
|
@@ -715,15 +736,36 @@
|
|
|
io.orderno
|
|
|
from
|
|
|
ins_orders io
|
|
|
+ <!--如果存在 公司查询则进行连表 -->
|
|
|
+ <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
|
left JOIN
|
|
|
ins_area_company iac on iac.orderno = io.orderno
|
|
|
+ </if>
|
|
|
<where>
|
|
|
<if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
|
|
|
and io.orderno = #{orderQueryVo.orderNo}
|
|
|
</if>
|
|
|
+ <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' and isTeamLeader">
|
|
|
+ and io.deptid like "${orderQueryVo.deptId}%"
|
|
|
+ </if>
|
|
|
<if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
|
|
|
and io.orderstatus = #{orderQueryVo.orderStatus}
|
|
|
</if>
|
|
|
+ <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
|
|
|
+ and io.frameno = #{orderQueryVo.frameNo}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
|
|
|
+ and io.licenseno = #{orderQueryVo.licenseNo}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
|
|
|
+ and io.insuredname = #{orderQueryVo.insuredName}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
|
|
|
+ and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
|
+ and iac.company_id = #{orderQueryVo.companyId}
|
|
|
+ </if>
|
|
|
<if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
|
|
|
and io.userid = #{orderQueryVo.userId}
|
|
|
</if>
|
|
|
@@ -731,4 +773,109 @@
|
|
|
group by io.orderno
|
|
|
) as s
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="queryPageOrderByLinkType" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ io.*
|
|
|
+ from
|
|
|
+ ins_orders io
|
|
|
+ <!--如果存在 公司查询则进行连表 -->
|
|
|
+ <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
|
+ left JOIN
|
|
|
+ ins_area_company iac on iac.orderno = io.orderno
|
|
|
+ </if>
|
|
|
+ <where>
|
|
|
+ <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
|
|
|
+ and io.orderno = #{orderQueryVo.orderNo}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' and isTeamLeader">
|
|
|
+ and io.deptid like "${orderQueryVo.deptId}%"
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
|
|
|
+ and io.orderstatus = #{orderQueryVo.orderStatus}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
|
|
|
+ and io.frameno = #{orderQueryVo.frameNo}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
|
|
|
+ and io.licenseno = #{orderQueryVo.licenseNo}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
|
|
|
+ and io.insuredname = #{orderQueryVo.insuredName}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
|
|
|
+ and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
|
+ and iac.company_id = #{orderQueryVo.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="agentUserIds != null and agentUserIds.size>0" >
|
|
|
+ and io.userid in
|
|
|
+ <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="agreeIds != null and agreeIds.size>0" >
|
|
|
+ and iac.agreement_id in
|
|
|
+ <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by orderno
|
|
|
+ order by io.createtime desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryPageOrderByLinkTypeCount" resultType="Long">
|
|
|
+ select
|
|
|
+ count(1)
|
|
|
+ from (
|
|
|
+ select
|
|
|
+ io.orderno
|
|
|
+ from
|
|
|
+ ins_orders io
|
|
|
+ left JOIN
|
|
|
+ ins_area_company iac on iac.orderno = io.orderno
|
|
|
+ <where>
|
|
|
+ <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
|
|
|
+ and io.orderno = #{orderQueryVo.orderNo}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' and isTeamLeader">
|
|
|
+ and io.deptid like "${orderQueryVo.deptId}%"
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
|
|
|
+ and io.orderstatus = #{orderQueryVo.orderStatus}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
|
|
|
+ and io.frameno = #{orderQueryVo.frameNo}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
|
|
|
+ and io.licenseno = #{orderQueryVo.licenseNo}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
|
|
|
+ and io.insuredname = #{orderQueryVo.insuredName}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
|
|
|
+ and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
|
|
|
+ </if>
|
|
|
+ <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
|
|
|
+ and iac.company_id = #{orderQueryVo.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="agentUserIds != null and agentUserIds.size>0" >
|
|
|
+ and io.userid in
|
|
|
+ <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="agreeIds != null and agreeIds.size>0" >
|
|
|
+ and iac.agreement_id in
|
|
|
+ <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by io.orderno
|
|
|
+ ) as s
|
|
|
+ </select>
|
|
|
</mapper>
|