xiaoshushu %!s(int64=4) %!d(string=hai) anos
pai
achega
c7998dc53b

+ 21 - 11
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ApiTemplateController.java

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.pagehelper.PageHelper;
 import com.ruoyi.app.domain.TbMyProfile;
 import com.ruoyi.app.domain.TbProfileImg;
+import com.ruoyi.app.domain.vo.AppMemberVo;
+import com.ruoyi.app.service.ITbAppUserService;
 import com.ruoyi.app.service.ITbMyProfileService;
 import com.ruoyi.app.service.ITbProfileImgService;
 import com.ruoyi.common.annotation.Log;
@@ -52,6 +54,9 @@ public class ApiTemplateController extends BaseController {
     private ITbMyProfileService iTbMyProfileService;
     @Autowired
     private ITbProfileImgService profileImgService;
+    @Autowired
+    private ITbAppUserService appUserService;
+
     /**
      * 查询个人页 图片列表
      */
@@ -59,10 +64,11 @@ public class ApiTemplateController extends BaseController {
     @GetMapping("/allImg")
     public AjaxResult allImg(TPersonalImg tPersonalImg) {
         List<TPersonalImg> list = tPersonalImgService.list(new QueryWrapper<TPersonalImg>()
-            .eq(StringUtils.isNotBlank(tPersonalImg.getEnable()),"enable", tPersonalImg.getEnable())
+                .eq(StringUtils.isNotBlank(tPersonalImg.getEnable()), "enable", tPersonalImg.getEnable())
         );
         return AjaxResult.success(list);
     }
+
     /**
      * 获取个人页详细信息
      */
@@ -83,7 +89,7 @@ public class ApiTemplateController extends BaseController {
     @GetMapping("/allModel")
     public AjaxResult allModel() {
         LambdaQueryWrapper<TPersonalModel> lqw = new LambdaQueryWrapper<TPersonalModel>();
-        lqw.eq(TPersonalModel::getEnable ,"0");
+        lqw.eq(TPersonalModel::getEnable, "0");
         List<TPersonalModel> list = modelService.list(lqw);
         return AjaxResult.success(list);
     }
@@ -95,8 +101,8 @@ public class ApiTemplateController extends BaseController {
     @GetMapping("/getModel/{type}")
     public AjaxResult getModel(@PathVariable("type") String type) {
         LambdaQueryWrapper<TPersonalModel> lqw = new LambdaQueryWrapper<TPersonalModel>();
-        lqw.eq(TPersonalModel::getEnable ,"0");
-        lqw.eq(TPersonalModel::getType,type);
+        lqw.eq(TPersonalModel::getEnable, "0");
+        lqw.eq(TPersonalModel::getType, type);
         List<TPersonalModel> list = modelService.list(lqw);
         return AjaxResult.success(list);
     }
@@ -108,13 +114,13 @@ public class ApiTemplateController extends BaseController {
     @ApiOperation("新增个人页留言内容")
     @PostMapping("/addMessage")
     public AjaxResult add(@RequestBody TPersonalMessage tPersonalMessage) {
-        if (tPersonalMessage.getPersonalId() == null){
+        if (tPersonalMessage.getPersonalId() == null) {
             return AjaxResult.error("个人id不能为空");
         }
-        if (StringUtils.isBlank(tPersonalMessage.getName())){
+        if (StringUtils.isBlank(tPersonalMessage.getName())) {
             return AjaxResult.error("姓名不能为空");
         }
-        if (StringUtils.isBlank(tPersonalMessage.getContents())){
+        if (StringUtils.isBlank(tPersonalMessage.getContents())) {
             return AjaxResult.error("留言不能为空");
         }
         tPersonalMessage.setCreateTime(new Date());
@@ -126,7 +132,7 @@ public class ApiTemplateController extends BaseController {
      */
     @ApiOperation("查询个人页留言内容列表")
     @GetMapping("/messageList")
-    public TableDataInfo list(Integer pageNum,Integer pageSize,Long personalId) {
+    public TableDataInfo list(Integer pageNum, Integer pageSize, Long personalId) {
         if (personalId == null) {
             return new TableDataInfo();
         }
@@ -136,7 +142,7 @@ public class ApiTemplateController extends BaseController {
         PageHelper.startPage(pageNum, pageSize, "create_time desc");
 
         LambdaQueryWrapper<TPersonalMessage> lqw = new LambdaQueryWrapper<>();
-        lqw.eq(TPersonalMessage::getPersonalId , personalId);
+        lqw.eq(TPersonalMessage::getPersonalId, personalId);
         List<TPersonalMessage> list = messageService.list(lqw);
         return getDataTable(list);
     }
@@ -145,9 +151,10 @@ public class ApiTemplateController extends BaseController {
     @GetMapping("/profileList")
     public AjaxResult list(TbMyProfile tbMyProfile) {
         Long appUserId = tbMyProfile.getAppUserId();
-        if (appUserId == null){
+        if (appUserId == null) {
             return AjaxResult.error("参数为空");
         }
+        AppMemberVo user = appUserService.getAppMember(appUserId.toString(),null);
         List<TbMyProfile> profileList = iTbMyProfileService.list(new LambdaQueryWrapper<TbMyProfile>()
                 .eq(TbMyProfile::getAppUserId, appUserId)
         );
@@ -171,6 +178,9 @@ public class ApiTemplateController extends BaseController {
                 });
             }
         }
-        return AjaxResult.success(profileList);
+        AjaxResult result = AjaxResult.success();
+        result.put("user", user);
+        result.put("profileList", profileList);
+        return result;
     }
 }