|
@@ -5,8 +5,12 @@ import com.ruoyi.app.annotation.LoginAppUser;
|
|
import com.ruoyi.app.controller.base.AppBaseController;
|
|
import com.ruoyi.app.controller.base.AppBaseController;
|
|
import com.ruoyi.app.domain.TbAppUser;
|
|
import com.ruoyi.app.domain.TbAppUser;
|
|
import com.ruoyi.app.domain.TbMyProfile;
|
|
import com.ruoyi.app.domain.TbMyProfile;
|
|
|
|
+import com.ruoyi.app.domain.TbProfileImg;
|
|
|
|
+import com.ruoyi.app.domain.TbPublishImg;
|
|
import com.ruoyi.app.domain.vo.AppMemberVo;
|
|
import com.ruoyi.app.domain.vo.AppMemberVo;
|
|
import com.ruoyi.app.service.ITbMyProfileService;
|
|
import com.ruoyi.app.service.ITbMyProfileService;
|
|
|
|
+import com.ruoyi.app.service.ITbProfileImgService;
|
|
|
|
+import com.ruoyi.app.service.ITbPublishImgService;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
@@ -32,6 +36,7 @@ import java.util.List;
|
|
public class MyProfileController extends AppBaseController {
|
|
public class MyProfileController extends AppBaseController {
|
|
|
|
|
|
private final ITbMyProfileService profileService;
|
|
private final ITbMyProfileService profileService;
|
|
|
|
+ private final ITbProfileImgService profileImgService;
|
|
|
|
|
|
@ApiOperation("个人详情列表")
|
|
@ApiOperation("个人详情列表")
|
|
@ApiImplicitParam(name = "appUserId", value = "会员ID",paramType="Long")
|
|
@ApiImplicitParam(name = "appUserId", value = "会员ID",paramType="Long")
|
|
@@ -61,13 +66,24 @@ public class MyProfileController extends AppBaseController {
|
|
if (profile.getId() == null) {
|
|
if (profile.getId() == null) {
|
|
profile.setCreateBy(user.getUserId());
|
|
profile.setCreateBy(user.getUserId());
|
|
profile.setCreateTime(date);
|
|
profile.setCreateTime(date);
|
|
- return toAjax(profileService.save(profile) ? 1 : 0);
|
|
|
|
} else {
|
|
} else {
|
|
// 修改
|
|
// 修改
|
|
profile.setUpdateBy(user.getUserId());
|
|
profile.setUpdateBy(user.getUserId());
|
|
profile.setUpdateTime(date);
|
|
profile.setUpdateTime(date);
|
|
- return toAjax(profileService.updateById(profile) ? 1 : 0);
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (profile.getImgList().size() > 0) {
|
|
|
|
+ //先删除,在重新添加图片
|
|
|
|
+ profileImgService.remove(new LambdaQueryWrapper<TbProfileImg>()
|
|
|
|
+ .eq(TbProfileImg::getProfileId, profile.getId())
|
|
|
|
+ );
|
|
|
|
+ List<TbProfileImg> imgList = profile.getImgList();
|
|
|
|
+ imgList.forEach(item -> {
|
|
|
|
+ item.setProfileId(profile.getId());
|
|
|
|
+ });
|
|
|
|
+ profileImgService.saveBatch(imgList);
|
|
|
|
+ }
|
|
|
|
+ return toAjax(profileService.saveOrUpdate(profile) ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation("获取个人详情")
|
|
@ApiOperation("获取个人详情")
|
|
@@ -77,7 +93,18 @@ public class MyProfileController extends AppBaseController {
|
|
if (id == null){
|
|
if (id == null){
|
|
return AjaxResult.error("id不能为空");
|
|
return AjaxResult.error("id不能为空");
|
|
}
|
|
}
|
|
- return AjaxResult.success(profileService.getById(id));
|
|
|
|
|
|
+ TbMyProfile profile = profileService.getById(id);
|
|
|
|
+ if (profile == null) {
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
|
|
+ // 图片列表
|
|
|
|
+ List<TbProfileImg> imgList = profileImgService.list(new LambdaQueryWrapper<TbProfileImg>()
|
|
|
|
+ .eq(TbProfileImg::getProfileId, profile.getId())
|
|
|
|
+ );
|
|
|
|
+ if (imgList.size() > 0) {
|
|
|
|
+ profile.setImgList(imgList);
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success(profile);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation("删除个人详情")
|
|
@ApiOperation("删除个人详情")
|
|
@@ -89,4 +116,28 @@ public class MyProfileController extends AppBaseController {
|
|
}
|
|
}
|
|
return toAjax(profileService.removeById(id) ? 1 : 0);
|
|
return toAjax(profileService.removeById(id) ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ApiOperation("删除个人详情 图片")
|
|
|
|
+ @ApiImplicitParam(name = "id", value = "图片id",paramType="Long")
|
|
|
|
+ @GetMapping("/delImg")
|
|
|
|
+ public AjaxResult delImg(Long id) {
|
|
|
|
+ if (id == null){
|
|
|
|
+ return AjaxResult.error("id不能为空");
|
|
|
|
+ }
|
|
|
|
+ return toAjax(profileImgService.removeById(id) ? 1 : 0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("获取个人详情 图片列表")
|
|
|
|
+ @ApiImplicitParam(name = "profileId", value = "详情id",paramType="Long")
|
|
|
|
+ @GetMapping("/profileId")
|
|
|
|
+ public AjaxResult listImg(Long profileId) {
|
|
|
|
+ if (profileId == null){
|
|
|
|
+ return AjaxResult.error("详情Id不能为空");
|
|
|
|
+ }
|
|
|
|
+ List<TbProfileImg> list = profileImgService.list(new LambdaQueryWrapper<TbProfileImg>()
|
|
|
|
+ .eq(TbProfileImg::getProfileId, profileId)
|
|
|
|
+ );
|
|
|
|
+ return AjaxResult.success(list);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|