Commit 76c71484 by wubh

包活干V2.0.0-修改:快递单不根据数据权限查找

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@28457 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent cef7e288
......@@ -122,8 +122,8 @@
from sys_delivery d
left join sys_user us on us.id = d.sender_id
left join sys_user ur on ur.id = d.receiver_id
<!-- 查询权限下所有组织 -->
left join sys_user_org uorg on uorg.user_id = #{userId,jdbcType=INTEGER}
<!--&lt;!&ndash; 查询权限下所有组织 &ndash;&gt;-->
<!--left join sys_user_org uorg on uorg.user_id = #{userId,jdbcType=INTEGER}-->
<where>
<if test="keyword != null and keyword != ''">
<!-- 按照关键词查询 -->
......@@ -144,13 +144,25 @@
and d.canceled = 1
</if>
and (
<!-- 通过用户权限下收寄件人组织+收寄件人类型和当前用户判断,才能判断快递单是否属于当前用户 -->
<!-- 用户权限下有收件人组织,并且寄件人类型和当前用户匹配,则查询全部 -->
(us.org_id = uorg.org_id and us.user_type = #{userType,jdbcType=TINYINT})
<!-- 用户权限下有寄件人组织,并且收件人类型和当前用户匹配,则查询状态不为待寄件的记录 -->
or (ur.org_id = uorg.org_id
and ur.user_type = #{userType,jdbcType=TINYINT}
and d.status != 1)
<!--&lt;!&ndash; 通过用户权限下收寄件人组织+收寄件人类型和当前用户判断,才能判断快递单是否属于当前用户 &ndash;&gt;-->
<!--&lt;!&ndash; 用户权限下有收件人组织,并且寄件人类型和当前用户匹配,则查询全部 &ndash;&gt;-->
<!--(us.org_id = uorg.org_id and us.user_type = #{userType,jdbcType=TINYINT})-->
<!--&lt;!&ndash; 用户权限下有寄件人组织,并且收件人类型和当前用户匹配,则查询状态不为待寄件的记录 &ndash;&gt;-->
<!--or (ur.org_id = uorg.org_id-->
<!-- and ur.user_type = #{userType,jdbcType=TINYINT}-->
<!-- and d.status != 1)-->
<!-- 不需要通过数据权限来查找了 -->
<if test="userType == 0">
<!-- 运营,查找收寄件用户类型匹配的 -->
us.user_type = #{userType,jdbcType=TINYINT}
or (ur.user_type = #{userType,jdbcType=TINYINT} and d.status != 1)
</if>
<if test="userType != 0">
<!-- 商户/服务商,查找收寄件ID匹配的 -->
us.id = #{userId,jdbcType=INTEGER}
or (ur.id = #{userId,jdbcType=INTEGER} and d.status != 1)
</if>
)
</where>
order by d.create_time desc
......@@ -166,17 +178,29 @@
from sys_delivery d
left join sys_user us on us.id = d.sender_id
left join sys_user ur on ur.id = d.receiver_id
<!-- 查询权限下所有组织 -->
left join sys_user_org uorg on uorg.user_id = #{userId,jdbcType=INTEGER}
<!--&lt;!&ndash; 查询权限下所有组织 &ndash;&gt;-->
<!--left join sys_user_org uorg on uorg.user_id = #{userId,jdbcType=INTEGER}-->
where d.id = #{id,jdbcType=INTEGER}
and (
<!-- 通过用户权限下收寄件人组织+收寄件人类型和当前用户判断,才能判断快递单是否属于当前用户 -->
<!-- 用户权限下有收件人组织,并且寄件人类型和当前用户匹配,则查询全部 -->
(us.org_id = uorg.org_id and us.user_type = #{userType,jdbcType=TINYINT})
<!-- 用户权限下有寄件人组织,并且收件人类型和当前用户匹配,则查询状态不为待寄件的记录 -->
or (ur.org_id = uorg.org_id
and ur.user_type = #{userType,jdbcType=TINYINT}
and d.status != 1)
<!--&lt;!&ndash; 通过用户权限下收寄件人组织+收寄件人类型和当前用户判断,才能判断快递单是否属于当前用户 &ndash;&gt;-->
<!--&lt;!&ndash; 用户权限下有收件人组织,并且寄件人类型和当前用户匹配,则查询全部 &ndash;&gt;-->
<!--(us.org_id = uorg.org_id and us.user_type = #{userType,jdbcType=TINYINT})-->
<!--&lt;!&ndash; 用户权限下有寄件人组织,并且收件人类型和当前用户匹配,则查询状态不为待寄件的记录 &ndash;&gt;-->
<!--or (ur.org_id = uorg.org_id-->
<!-- and ur.user_type = #{userType,jdbcType=TINYINT}-->
<!-- and d.status != 1)-->
<!-- 不需要通过数据权限来查找了 -->
<if test="userType == 0">
<!-- 运营,查找收寄件用户类型匹配的 -->
us.user_type = #{userType,jdbcType=TINYINT}
or (ur.user_type = #{userType,jdbcType=TINYINT} and d.status != 1)
</if>
<if test="userType != 0">
<!-- 商户/服务商,查找收寄件ID匹配的 -->
us.id = #{userId,jdbcType=INTEGER}
or (ur.id = #{userId,jdbcType=INTEGER} and d.status != 1)
</if>
)
</select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!