From 8686002d4ac3575ed8c42945c5d0ed7ba9a8e0d9 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期四, 22 一月 2026 15:33:26 +0800
Subject: [PATCH] 大屏项目接口
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java | 25 +++++++++---
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ScreenAccountMapper.java | 6 +++
ruoyi-system/src/main/resources/mapper/system/ScreenAccountMapper.xml | 6 +++
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java | 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/EntrustProjectController.java | 2 -
ruoyi-system/src/main/java/com/ruoyi/system/vo/LoginNameVo.java | 12 ++++++
ruoyi-system/src/main/java/com/ruoyi/system/service/ScreenAccountService.java | 8 ++++
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java | 11 +++++
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ScreenAccountServiceImpl.java | 15 +++++++
9 files changed, 78 insertions(+), 8 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/EntrustProjectController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/EntrustProjectController.java
index e49ed9c..826445a 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/EntrustProjectController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/EntrustProjectController.java
@@ -12,8 +12,6 @@
import com.ruoyi.system.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import io.swagger.models.auth.In;
-import lombok.var;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java
index cf45265..676008d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java
@@ -59,16 +59,29 @@
@Autowired
private PositionService positionService;
-
@Autowired
private PlanService planService;
+ @Autowired
+ private ScreenAccountService screenAccountService;
- @ApiOperation(value = "获取项目列表",response = Project.class)
- @GetMapping("/getProjectList")
- public R<List<Project>> getProjectList(@RequestParam Integer clientId) {
- List<Project> list = projectService.list(new LambdaQueryWrapper<Project>().eq(Project::getDeleted, false).eq(Project::getClientId, clientId).orderByDesc(Project::getCreateTime));
- return R.ok(list);
+
+ @ApiOperation(value = "获取项目/委托方列表",response = LoginNameVo.class)
+ @GetMapping("/getLoginNameVoList")
+ public R<List<LoginNameVo>> getProjectList(@RequestParam Integer userId) {
+ ScreenAccount screenAccount = screenAccountService.getById(userId);
+ String clientProjectIds = screenAccount.getClientProjectIds();
+ if(screenAccount.getType()==1){
+ // 委托方
+ List<LoginNameVo> list = screenAccountService.getLoginClient(clientProjectIds);
+ return R.ok(list);
+ }else {
+ // 项目
+ List<LoginNameVo> list = screenAccountService.getLoginProject(clientProjectIds);
+ return R.ok(list);
+
+ }
+
}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java
index 670e6b3..0ae0b88 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java
@@ -71,6 +71,9 @@
*/
private SysUser user;
+
+
+ private Integer type;
public LoginUser()
{
}
@@ -89,6 +92,14 @@
this.permissions = permissions;
}
+ public Integer getType() {
+ return type;
+ }
+
+ public void setType(Integer type) {
+ this.type = type;
+ }
+
public Long getUserId()
{
return userId;
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
index ccdb974..4c6e46a 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
@@ -99,6 +99,7 @@
sysUser.setUserName(user.getName());
sysUser.setPassword(user.getPassword());
loginUser.setUser(sysUser);
+ loginUser.setType(user.getType());
// 生成token
return loginUser;
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ScreenAccountMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ScreenAccountMapper.java
index be8740d..d666db5 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ScreenAccountMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ScreenAccountMapper.java
@@ -3,10 +3,16 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.model.Contract;
import com.ruoyi.system.model.ScreenAccount;
+import com.ruoyi.system.vo.LoginNameVo;
import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
public interface ScreenAccountMapper extends BaseMapper<ScreenAccount> {
Long getToken(@Param("key") String key);
+ List<LoginNameVo> getLoginClient(@Param("ids") List<String> ids);
+
+ List<LoginNameVo> getLoginProject(@Param("ids") List<String> ids);
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ScreenAccountService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ScreenAccountService.java
index 8f4aac7..025932f 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ScreenAccountService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ScreenAccountService.java
@@ -3,6 +3,9 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.system.model.OnDuty;
import com.ruoyi.system.model.ScreenAccount;
+import com.ruoyi.system.vo.LoginNameVo;
+
+import java.util.List;
/**
* <p>
@@ -18,4 +21,9 @@
Long getToken(String key);
+ List<LoginNameVo> getLoginClient(String clientProjectIds);
+
+
+ List<LoginNameVo> getLoginProject(String clientProjectIds);
+
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ScreenAccountServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ScreenAccountServiceImpl.java
index 83569cf..f51d5c0 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ScreenAccountServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ScreenAccountServiceImpl.java
@@ -8,7 +8,11 @@
import com.ruoyi.system.model.ScreenAccount;
import com.ruoyi.system.service.OnDutyService;
import com.ruoyi.system.service.ScreenAccountService;
+import com.ruoyi.system.vo.LoginNameVo;
import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.List;
/**
* <p>
@@ -30,4 +34,15 @@
public Long getToken(String key) {
return this.baseMapper.getToken(key);
}
+
+ @Override
+ public List<LoginNameVo> getLoginClient(String clientProjectIds) {
+ return this.baseMapper.getLoginClient(Arrays.asList(clientProjectIds.split( ",")));
+ }
+
+ @Override
+ public List<LoginNameVo> getLoginProject(String clientProjectIds) {
+
+ return this.baseMapper.getLoginProject(Arrays.asList(clientProjectIds.split( ",")));
+ }
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/LoginNameVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/LoginNameVo.java
new file mode 100644
index 0000000..45996d7
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/LoginNameVo.java
@@ -0,0 +1,12 @@
+package com.ruoyi.system.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel("登录查看选择账户")
+public class LoginNameVo {
+ private Integer id;
+
+ private String name;
+}
diff --git a/ruoyi-system/src/main/resources/mapper/system/ScreenAccountMapper.xml b/ruoyi-system/src/main/resources/mapper/system/ScreenAccountMapper.xml
index 37158aa..67095ee 100644
--- a/ruoyi-system/src/main/resources/mapper/system/ScreenAccountMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/ScreenAccountMapper.xml
@@ -5,4 +5,10 @@
<select id="getToken" resultType="java.lang.Long">
select id from user_session where token = #{key} and `state`="ENABLED" limit 1
</select>
+ <select id="getLoginClient" resultType="com.ruoyi.system.vo.LoginNameVo">
+ select id,name from client where id in <foreach collection="ids" separator="," item="id" close=")" open="(" >#{id}</foreach>
+ </select>
+ <select id="getLoginProject" resultType="com.ruoyi.system.vo.LoginNameVo">
+ select id,name from project where id in <foreach collection="ids" separator="," item="id" close=")" open="(" >#{id}</foreach>
+ </select>
</mapper>
--
Gitblit v1.7.1