Преглед изворни кода

2022-08-26 添加申请列表的数据权限。

zhuchangxue пре 3 година
родитељ
комит
acaae9abfb

+ 3 - 0
zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/ActHxpapplyServiceImpl.java

@@ -15,9 +15,11 @@ import com.zd.chemical.domain.*;
 import com.zd.chemical.domain.vo.*;
 import com.zd.chemical.mapper.*;
 import com.zd.chemical.service.IActAuditconfigService;
+import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.StringUtils;
+import com.zd.common.datascope.annotation.DataScope;
 import com.zd.common.security.utils.SaveUtil;
 
 import org.apache.poi.ss.formula.functions.T;
@@ -179,6 +181,7 @@ public class ActHxpapplyServiceImpl implements IActHxpapplyService
      * @return 化学品申购
      */
     @Override
+    @DataScope(deptAlias = "st", userAlias = "ah", permi = PerPrefix.ACT_HXP_APPLY)
     public List<ActHxpapplyListVo> selectActHxpapplyList(ActHxpapplySearch actHxpapplySearch)
     {
         actHxpapplySearch.setLoginUserId(SecurityUtils.getUserId());

+ 37 - 33
zd-modules/zd-chemical/src/main/resources/mapper/chemical/ActHxpapplyMapper.xml

@@ -124,40 +124,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             LEFT JOIN act_hxpapply_detail hd ON hd.hxpapply_id = ah.id
             LEFT JOIN act_applytask ak ON ak.`task_id` = ah.`id`
             <where>
-            ah.apply_status in(1,3)
-            <if test="ids != null">
-                and  ah.id in
-                <foreach item="id" collection="ids" open="(" separator="," close=")">
-                    #{id}
-                </foreach>
-            </if>
-            <if test="searchValue != null ">
-            and (
-            ah.apply_num like concat('%', #{searchValue}, '%') or
-            su.nick_name like concat('%', #{searchValue}, '%') or
-            hd.chemical_name like concat('%', #{searchValue}, '%') or
-            st.name like concat('%', #{searchValue}, '%')
-            )
-            </if>
-            <if test="approvalStatus != null ">
-            and ak.approval_status = #{approvalStatus}
-            </if>
-            <if test="beginCreateTime != null and beginCreateTime != ''"><!-- 申请开始时间 -->
-            AND date_format(ak.create_time,'%y%m%d') &gt;= date_format(#{beginCreateTime},'%y%m%d')
-            </if>
-            <if test="endCreateTime != null and endCreateTime != ''"><!-- 申请结束时间 -->
-            AND date_format(ak.create_time,'%y%m%d') &lt;= date_format(#{endCreateTime},'%y%m%d')
-            </if>
+                ah.apply_status in(1,3)
+                <if test="ids != null">
+                    and  ah.id in
+                    <foreach item="id" collection="ids" open="(" separator="," close=")">
+                        #{id}
+                    </foreach>
+                </if>
+                <if test="searchValue != null ">
+                and (
+                ah.apply_num like concat('%', #{searchValue}, '%') or
+                su.nick_name like concat('%', #{searchValue}, '%') or
+                hd.chemical_name like concat('%', #{searchValue}, '%') or
+                st.name like concat('%', #{searchValue}, '%')
+                )
+                </if>
+                <if test="approvalStatus != null ">
+                and ak.approval_status = #{approvalStatus}
+                </if>
+                <if test="beginCreateTime != null and beginCreateTime != ''"><!-- 申请开始时间 -->
+                AND date_format(ak.create_time,'%y%m%d') &gt;= date_format(#{beginCreateTime},'%y%m%d')
+                </if>
+                <if test="endCreateTime != null and endCreateTime != ''"><!-- 申请结束时间 -->
+                AND date_format(ak.create_time,'%y%m%d') &lt;= date_format(#{endCreateTime},'%y%m%d')
+                </if>
 
-            <if test="beginOverTime != null and beginOverTime != ''"><!-- 完成开始时间 -->
-            AND date_format(ak.over_time,'%y%m%d') &gt;= date_format(#{beginOverTime},'%y%m%d')
-            </if>
-            <if test="endOverTime != null and endOverTime != ''"><!-- 完成结束时间 -->
-            AND date_format(ak.over_time,'%y%m%d') &lt;= date_format(#{endOverTime},'%y%m%d')
-            </if>
-            <if test="userId != null and userId != ''"><!-- 创建人id -->
-                and ah.user_id = #{userId}
-            </if>
+                <if test="beginOverTime != null and beginOverTime != ''"><!-- 完成开始时间 -->
+                AND date_format(ak.over_time,'%y%m%d') &gt;= date_format(#{beginOverTime},'%y%m%d')
+                </if>
+                <if test="endOverTime != null and endOverTime != ''"><!-- 完成结束时间 -->
+                AND date_format(ak.over_time,'%y%m%d') &lt;= date_format(#{endOverTime},'%y%m%d')
+                </if>
+                <if test="userId != null and userId != ''"><!-- 创建人id -->
+                    and ah.user_id = #{userId}
+                </if>
+                <!-- 数据范围过滤 -->
+                ${params.dataScope}
             </where>
             GROUP BY ah.`id`
             )xx WHERE FIND_IN_SET(#{loginUserId},xx.currentApprover) ORDER BY xx.createTime DESC
@@ -233,6 +235,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 <if test="userId != null and userId != ''"><!-- 创建人id -->
                     and ah.user_id = #{userId}
                 </if>
+                <!-- 数据范围过滤 -->
+                ${params.dataScope}
             </where>
             GROUP BY ah.`id`