فهرست منبع

添加个人留言/模板接口

Alex 4 سال پیش
والد
کامیت
05de855f04

+ 127 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TPersonalMessageController.java

@@ -0,0 +1,127 @@
+package com.ruoyi.web.controller.system;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+
+import java.util.List;
+import java.util.Arrays;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.ruoyi.common.utils.StringUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.TPersonalMessage;
+import com.ruoyi.system.service.ITPersonalMessageService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 个人页留言内容
+ * 
+ * @author Administrator
+ * @date 2020-10-21
+ */
+@Api(value = "个人页留言内容", tags = "个人页留言内容")
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/system/message" )
+public class TPersonalMessageController extends BaseController {
+
+    private final ITPersonalMessageService iTPersonalMessageService;
+
+    /**
+     * 查询个人页留言内容列表
+     */
+    @ApiOperation("查询个人页留言内容列表")
+    @PreAuthorize("@ss.hasPermi('system:message:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TPersonalMessage tPersonalMessage)
+    {
+        startPage();
+        LambdaQueryWrapper<TPersonalMessage> lqw = new LambdaQueryWrapper<TPersonalMessage>();
+        if (tPersonalMessage.getPersonalId() != null){
+            lqw.eq(TPersonalMessage::getPersonalId ,tPersonalMessage.getPersonalId());
+        }
+        if (StringUtils.isNotBlank(tPersonalMessage.getType())){
+            lqw.eq(TPersonalMessage::getType ,tPersonalMessage.getType());
+        }
+        if (StringUtils.isNotBlank(tPersonalMessage.getContents())){
+            lqw.eq(TPersonalMessage::getContents ,tPersonalMessage.getContents());
+        }
+        if (StringUtils.isNotBlank(tPersonalMessage.getModel())){
+            lqw.eq(TPersonalMessage::getModel ,tPersonalMessage.getModel());
+        }
+        List<TPersonalMessage> list = iTPersonalMessageService.list(lqw);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出个人页留言内容列表
+     */
+    @ApiOperation("导出个人页留言内容列表")
+    @PreAuthorize("@ss.hasPermi('system:message:export')" )
+    @Log(title = "个人页留言内容" , businessType = BusinessType.EXPORT)
+    @GetMapping("/export" )
+    public AjaxResult export(TPersonalMessage tPersonalMessage) {
+        LambdaQueryWrapper<TPersonalMessage> lqw = new LambdaQueryWrapper<TPersonalMessage>(tPersonalMessage);
+        List<TPersonalMessage> list = iTPersonalMessageService.list(lqw);
+        ExcelUtil<TPersonalMessage> util = new ExcelUtil<TPersonalMessage>(TPersonalMessage. class);
+        return util.exportExcel(list, "message" );
+    }
+
+    /**
+     * 获取个人页留言内容详细信息
+     */
+    @ApiOperation("获取个人页留言内容详细信息")
+    @PreAuthorize("@ss.hasPermi('system:message:query')" )
+    @GetMapping(value = "/{id}" )
+    public AjaxResult getInfo(@PathVariable("id" ) Long id) {
+        return AjaxResult.success(iTPersonalMessageService.getById(id));
+    }
+
+    /**
+     * 新增个人页留言内容
+     */
+    @ApiOperation("新增个人页留言内容")
+    @PreAuthorize("@ss.hasPermi('system:message:add')" )
+    @Log(title = "个人页留言内容" , businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TPersonalMessage tPersonalMessage) {
+        return toAjax(iTPersonalMessageService.save(tPersonalMessage) ? 1 : 0);
+    }
+
+    /**
+     * 修改个人页留言内容
+     */
+    @ApiOperation("修改个人页留言内容")
+    @PreAuthorize("@ss.hasPermi('system:message:edit')" )
+    @Log(title = "个人页留言内容" , businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TPersonalMessage tPersonalMessage) {
+        return toAjax(iTPersonalMessageService.updateById(tPersonalMessage) ? 1 : 0);
+    }
+
+    /**
+     * 删除个人页留言内容
+     */
+    @ApiOperation("删除个人页留言内容")
+    @PreAuthorize("@ss.hasPermi('system:message:remove')" )
+    @Log(title = "个人页留言内容" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}" )
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(iTPersonalMessageService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+}

+ 121 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TPersonalModelController.java

@@ -0,0 +1,121 @@
+package com.ruoyi.web.controller.system;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+
+import java.util.List;
+import java.util.Arrays;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.ruoyi.common.utils.StringUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.TPersonalModel;
+import com.ruoyi.system.service.ITPersonalModelService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 个人页留言模板
+ * 
+ * @author Administrator
+ * @date 2020-10-21
+ */
+@Api(value = "个人页留言模板", tags = "个人页留言模板")
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/system/model" )
+public class TPersonalModelController extends BaseController {
+
+    private final ITPersonalModelService iTPersonalModelService;
+
+    /**
+     * 查询个人页留言模板列表
+     */
+    @ApiOperation("查询个人页留言模板列表")
+    @PreAuthorize("@ss.hasPermi('system:model:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TPersonalModel tPersonalModel)
+    {
+        startPage();
+        LambdaQueryWrapper<TPersonalModel> lqw = new LambdaQueryWrapper<TPersonalModel>();
+        if (StringUtils.isNotBlank(tPersonalModel.getContents())){
+            lqw.eq(TPersonalModel::getContents ,tPersonalModel.getContents());
+        }
+        if (StringUtils.isNotBlank(tPersonalModel.getEnable())){
+            lqw.eq(TPersonalModel::getEnable ,tPersonalModel.getEnable());
+        }
+        List<TPersonalModel> list = iTPersonalModelService.list(lqw);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出个人页留言模板列表
+     */
+    @ApiOperation("导出个人页留言模板列表")
+    @PreAuthorize("@ss.hasPermi('system:model:export')" )
+    @Log(title = "个人页留言模板" , businessType = BusinessType.EXPORT)
+    @GetMapping("/export" )
+    public AjaxResult export(TPersonalModel tPersonalModel) {
+        LambdaQueryWrapper<TPersonalModel> lqw = new LambdaQueryWrapper<TPersonalModel>(tPersonalModel);
+        List<TPersonalModel> list = iTPersonalModelService.list(lqw);
+        ExcelUtil<TPersonalModel> util = new ExcelUtil<TPersonalModel>(TPersonalModel. class);
+        return util.exportExcel(list, "model" );
+    }
+
+    /**
+     * 获取个人页留言模板详细信息
+     */
+    @ApiOperation("获取个人页留言模板详细信息")
+    @PreAuthorize("@ss.hasPermi('system:model:query')" )
+    @GetMapping(value = "/{id}" )
+    public AjaxResult getInfo(@PathVariable("id" ) Long id) {
+        return AjaxResult.success(iTPersonalModelService.getById(id));
+    }
+
+    /**
+     * 新增个人页留言模板
+     */
+    @ApiOperation("新增个人页留言模板")
+    @PreAuthorize("@ss.hasPermi('system:model:add')" )
+    @Log(title = "个人页留言模板" , businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TPersonalModel tPersonalModel) {
+        return toAjax(iTPersonalModelService.save(tPersonalModel) ? 1 : 0);
+    }
+
+    /**
+     * 修改个人页留言模板
+     */
+    @ApiOperation("修改个人页留言模板")
+    @PreAuthorize("@ss.hasPermi('system:model:edit')" )
+    @Log(title = "个人页留言模板" , businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TPersonalModel tPersonalModel) {
+        return toAjax(iTPersonalModelService.updateById(tPersonalModel) ? 1 : 0);
+    }
+
+    /**
+     * 删除个人页留言模板
+     */
+    @ApiOperation("删除个人页留言模板")
+    @PreAuthorize("@ss.hasPermi('system:model:remove')" )
+    @Log(title = "个人页留言模板" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}" )
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(iTPersonalModelService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+}