|
@@ -1,21 +1,29 @@
|
|
|
package com.ruoyi.web.controller.api;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.ruoyi.common.annotation.Log;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
+import com.ruoyi.common.enums.BusinessType;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.system.domain.TPersonalImg;
|
|
|
+import com.ruoyi.system.domain.TPersonalMessage;
|
|
|
+import com.ruoyi.system.domain.TPersonalModel;
|
|
|
import com.ruoyi.system.domain.TPersonalPage;
|
|
|
import com.ruoyi.system.service.ITPersonalImgService;
|
|
|
+import com.ruoyi.system.service.ITPersonalMessageService;
|
|
|
+import com.ruoyi.system.service.ITPersonalModelService;
|
|
|
import com.ruoyi.system.service.ITPersonalPageService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -30,13 +38,16 @@ public class ApiTemplateController extends BaseController {
|
|
|
private ITPersonalImgService tPersonalImgService;
|
|
|
@Autowired
|
|
|
private ITPersonalPageService tPersonalPageService;
|
|
|
+ @Autowired
|
|
|
+ private ITPersonalModelService modelService;
|
|
|
+ @Autowired
|
|
|
+ private ITPersonalMessageService messageService;
|
|
|
/**
|
|
|
* 查询个人页 图片列表
|
|
|
*/
|
|
|
@ApiOperation("个人图片列表")
|
|
|
@GetMapping("/allImg")
|
|
|
- public AjaxResult allImg(TPersonalImg tPersonalImg)
|
|
|
- {
|
|
|
+ public AjaxResult allImg(TPersonalImg tPersonalImg) {
|
|
|
List<TPersonalImg> list = tPersonalImgService.list(new QueryWrapper<TPersonalImg>()
|
|
|
.eq(StringUtils.isNotBlank(tPersonalImg.getEnable()),"enable", tPersonalImg.getEnable())
|
|
|
);
|
|
@@ -47,8 +58,7 @@ public class ApiTemplateController extends BaseController {
|
|
|
*/
|
|
|
@ApiOperation("获取个人页详细信息")
|
|
|
@GetMapping(value = "/getPersonal/{id}")
|
|
|
- public AjaxResult getPersonal(@PathVariable("id") Long id)
|
|
|
- {
|
|
|
+ public AjaxResult getPersonal(@PathVariable("id") Long id) {
|
|
|
TPersonalPage personalPage = tPersonalPageService.getById(id);
|
|
|
if (personalPage != null && "1".equals(personalPage.getEnable())) {
|
|
|
return AjaxResult.success();
|
|
@@ -56,4 +66,55 @@ public class ApiTemplateController extends BaseController {
|
|
|
return AjaxResult.success(personalPage);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询个人页留言模板列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询个人页留言模板列表")
|
|
|
+ @GetMapping("/allModel")
|
|
|
+ public AjaxResult all() {
|
|
|
+ LambdaQueryWrapper<TPersonalModel> lqw = new LambdaQueryWrapper<TPersonalModel>();
|
|
|
+ lqw.eq(TPersonalModel::getEnable ,"0");
|
|
|
+ List<TPersonalModel> list = modelService.list(lqw);
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增个人页留言内容
|
|
|
+ */
|
|
|
+ @ApiOperation("新增个人页留言内容")
|
|
|
+ @PostMapping("/addMessage")
|
|
|
+ public AjaxResult add(@RequestBody TPersonalMessage tPersonalMessage) {
|
|
|
+ if (tPersonalMessage.getPersonalId() == null){
|
|
|
+ return AjaxResult.error("个人id不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(tPersonalMessage.getName())){
|
|
|
+ return AjaxResult.error("姓名不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(tPersonalMessage.getContents())){
|
|
|
+ return AjaxResult.error("留言不能为空");
|
|
|
+ }
|
|
|
+ tPersonalMessage.setCreateTime(new Date());
|
|
|
+ return toAjax(messageService.save(tPersonalMessage) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询个人页留言内容列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询个人页留言内容列表")
|
|
|
+ @GetMapping("/messageList")
|
|
|
+ public TableDataInfo list(Integer pageNum,Integer pageSize,Long personalId) {
|
|
|
+ if (personalId == null) {
|
|
|
+ return new TableDataInfo();
|
|
|
+ }
|
|
|
+
|
|
|
+ pageNum = pageNum == null ? 1 : pageNum;
|
|
|
+ pageSize = pageSize == null ? 10 : pageSize;
|
|
|
+ PageHelper.startPage(pageNum, pageSize, "create_time desc");
|
|
|
+
|
|
|
+ LambdaQueryWrapper<TPersonalMessage> lqw = new LambdaQueryWrapper<>();
|
|
|
+ lqw.eq(TPersonalMessage::getPersonalId , personalId);
|
|
|
+ List<TPersonalMessage> list = messageService.list(lqw);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
}
|