Explorar o código

限制老师查询代理商

mingfu hai 1 mes
pai
achega
360519aae8

+ 3 - 1
ie-admin/src/main/java/com/ruoyi/web/controller/dz/DzAgentController.java

@@ -59,6 +59,8 @@ public class DzAgentController extends BaseController
         if(UserTypeEnum.isAgent(sysUser.getUserType())) {
             dzAgent.setParentId(sysUser.getUserTypeId());
             allList.add(dzAgentService.selectDzAgentByAgentId(sysUser.getUserTypeId()));
+        } else if(UserTypeEnum.isTeacher(sysUser.getUserType())) {
+            dzAgent.setTeacherId(sysUser.getUserTypeId());
         } else if(!UserTypeEnum.isSys(sysUser.getUserType())) {
             dzAgent.setDeptId(sysUser.getDeptId());
         }
@@ -69,7 +71,7 @@ public class DzAgentController extends BaseController
     /**
      * 查询机构代理列表
      */
-    @PreAuthorize("@ss.hasPermi('dz:agent:list')")
+    @PreAuthorize("@ss.hasAnyPermi('dz:agent:list,dz:teacher:list')")
     @GetMapping("/list")
     public AjaxResult list(DzAgent dzAgent)
     {

+ 11 - 0
ie-system/src/main/java/com/ruoyi/dz/domain/DzAgent.java

@@ -62,6 +62,9 @@ public class DzAgent extends TreeEntity
     @Excel(name = "机构名称")
     private String deptName;
     private SysDept dept;
+
+    private Long teacherId;
+
     public String getStatus() {
         return status;
     }
@@ -194,6 +197,14 @@ public class DzAgent extends TreeEntity
         this.parentId = parentId;
     }
 
+    public Long getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Long teacherId) {
+        this.teacherId = teacherId;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 3 - 0
ie-system/src/main/resources/mapper/dz/DzAgentMapper.xml

@@ -42,6 +42,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptId != null ">
                 AND (t1.dept_id = #{deptId} OR t1.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
             </if>
+            <if test="teacherId != null ">
+                AND t1.agent_id in (select distinct t.agent_id  from `dz_teacher` t where t.`teacher_id` = 1 and t.agent_id is not null)
+            </if>
             <if test="name != null  and name != ''"> and t1.name like concat('%', #{name}, '%')</if>
             <if test="phonenumber != null  and phonenumber != ''"> and t1.phonenumber  like concat('%', #{phonenumber}, '%')</if>
             <if test="parentId != null "> and t1.parent_id = #{parentId}</if>