|
|
@@ -108,22 +108,9 @@
|
|
|
<if test="query.saleEntId !=null">
|
|
|
and e.ent_id = #{query.saleEntId}
|
|
|
</if>
|
|
|
- -- 状态匹配
|
|
|
<if test="query.status != null">
|
|
|
and a.status = #{query.status}
|
|
|
- <if test="query.status == 0">
|
|
|
- -- 草稿状态只能创建订单的人能看
|
|
|
- and a.create_by = #{query.userId}
|
|
|
- </if>
|
|
|
</if>
|
|
|
- <if test="query.status == null">
|
|
|
- -- 非草稿状态or草稿状态且是当前人
|
|
|
- and (
|
|
|
- a.status != 0
|
|
|
- or (a.status = 0 and a.create_by = #{query.userId})
|
|
|
- )
|
|
|
- </if>
|
|
|
- -- 关键词匹配
|
|
|
<if test="query.keywords != null and query.keywords != ''">
|
|
|
and (
|
|
|
a.t_order_no like concat('%', #{query.keywords}, '%')
|
|
|
@@ -453,71 +440,35 @@
|
|
|
LEFT JOIN kwo_trade_order_goods g ON a.id = g.t_order_id AND g.del_flag = 0
|
|
|
<where>
|
|
|
a.del_flag = 0
|
|
|
--- 数据权限匹配
|
|
|
- <if test="query.isMain == 0">
|
|
|
- and (
|
|
|
- <if test="query.orderType == 1">
|
|
|
- <if test="query.entId != null">
|
|
|
- d.top_ent_id = #{query.entId}
|
|
|
- </if>
|
|
|
- <if test="authUserIds != null and authUserIds.size() > 0">
|
|
|
- and d.contacts_id in
|
|
|
- <foreach collection="authUserIds" item="authUserId" open="(" close=")" separator=",">
|
|
|
- #{authUserId}
|
|
|
- </foreach>
|
|
|
- or d.create_by in
|
|
|
- <foreach collection="authUserIds" item="authUserId" open="(" close=")" separator=",">
|
|
|
- #{authUserId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="query.orderType == 2">
|
|
|
- <if test="query.entId != null">
|
|
|
- e.top_ent_id = #{query.entId}
|
|
|
+ <choose>
|
|
|
+ <when test="query.manager != null and !query.manager">
|
|
|
+ <if test="query.isMain == 0">
|
|
|
+ <if test="query.entList != null and query.entList.size() > 0">
|
|
|
+ and (
|
|
|
+ d.top_ent_id in
|
|
|
+ <foreach collection="query.entList" item="authUserId" open="(" close=")" separator=",">
|
|
|
+ #{authUserId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
</if>
|
|
|
- <if test="authUserIds != null and authUserIds.size() > 0">
|
|
|
- and e.contacts_id in
|
|
|
- <foreach collection="authUserIds" item="authUserId" open="(" close=")" separator=",">
|
|
|
- #{authUserId}
|
|
|
- </foreach>
|
|
|
- or e.create_by in
|
|
|
- <foreach collection="authUserIds" item="authUserId" open="(" close=")" separator=",">
|
|
|
- #{authUserId}
|
|
|
- </foreach>
|
|
|
+ <if test="query.isMain == 1">
|
|
|
+ <if test="query.entId != null">
|
|
|
+ and (d.top_ent_id = #{query.entId}
|
|
|
+ )
|
|
|
+ </if>
|
|
|
</if>
|
|
|
- </if>
|
|
|
- )
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ <if test="query.buyEntId !=null">
|
|
|
+ and d.ent_id = #{query.buyEntId}
|
|
|
</if>
|
|
|
- <if test="query.isMain == 1">
|
|
|
- and (
|
|
|
- <if test="query.orderType == 1">
|
|
|
- <if test="query.entId != null">
|
|
|
- d.top_ent_id = #{query.entId}
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="query.orderType == 2">
|
|
|
- <if test="query.entId != null">
|
|
|
- e.top_ent_id = #{query.entId}
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- )
|
|
|
+ <if test="query.saleEntId !=null">
|
|
|
+ and e.ent_id = #{query.saleEntId}
|
|
|
</if>
|
|
|
- -- 状态匹配
|
|
|
<if test="query.status != null">
|
|
|
and a.status = #{query.status}
|
|
|
- <if test="query.status == 0">
|
|
|
- -- 草稿状态只能创建订单的人能看
|
|
|
- and a.create_by = #{query.userId}
|
|
|
- </if>
|
|
|
</if>
|
|
|
- <if test="query.status == null">
|
|
|
- -- 非草稿状态or草稿状态且是当前人
|
|
|
- and (
|
|
|
- a.status != 0
|
|
|
- or (a.status = 0 and a.create_by = #{query.userId})
|
|
|
- )
|
|
|
- </if>
|
|
|
- -- 关键词匹配
|
|
|
<if test="query.keywords != null and query.keywords != ''">
|
|
|
and (
|
|
|
a.t_order_no like concat('%', #{query.keywords}, '%')
|
|
|
@@ -628,7 +579,6 @@
|
|
|
and e.top_ent_id = #{query.entId}
|
|
|
</if>
|
|
|
</if>
|
|
|
- -- 状态匹配
|
|
|
<if test="statuses != null and statuses.size() > 0">
|
|
|
and a.status in
|
|
|
<foreach collection="statuses" item="item" open="(" close=")" separator=",">
|