Bläddra i källkod

添加信息反馈模块以及app接口

liuhj 4 år sedan
förälder
incheckning
9783370610

+ 138 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TbFeedbackinfoController.java

@@ -0,0 +1,138 @@
+package com.ruoyi.web.controller.api;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Arrays;
+
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.framework.web.service.TokenService;
+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.app.domain.TbFeedbackinfo;
+import com.ruoyi.app.service.ITbFeedbackinfoService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 信息反馈
+ * 
+ * @author liuhj
+ * @date 2020-10-20
+ */
+@Api(value = "信息反馈", tags = "信息反馈")
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/system/feedbackinfo" )
+public class TbFeedbackinfoController extends BaseController {
+
+    private final ITbFeedbackinfoService iTbFeedbackinfoService;
+    @Autowired
+    private TokenService tokenService;
+
+    /**
+     * 查询信息反馈列表
+     */
+    @ApiOperation("查询信息反馈列表")
+    @PreAuthorize("@ss.hasPermi('system:feedbackinfo:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TbFeedbackinfo tbFeedbackinfo)
+    {
+        startPage();
+        LambdaQueryWrapper<TbFeedbackinfo> lqw = new LambdaQueryWrapper<TbFeedbackinfo>();
+        if (StringUtils.isNotBlank(tbFeedbackinfo.getTitle())){
+            lqw.like(TbFeedbackinfo::getTitle ,tbFeedbackinfo.getTitle());
+        }
+        if (tbFeedbackinfo.getCreateBy() != null){
+            lqw.eq(TbFeedbackinfo::getCreateBy ,tbFeedbackinfo.getCreateBy());
+        }
+        List<TbFeedbackinfo> list = iTbFeedbackinfoService.list(lqw);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出信息反馈列表
+     */
+    @ApiOperation("导出信息反馈列表")
+    @PreAuthorize("@ss.hasPermi('system:feedbackinfo:export')" )
+    @Log(title = "信息反馈" , businessType = BusinessType.EXPORT)
+    @GetMapping("/export" )
+    public AjaxResult export(TbFeedbackinfo tbFeedbackinfo) {
+        LambdaQueryWrapper<TbFeedbackinfo> lqw = new LambdaQueryWrapper<TbFeedbackinfo>(tbFeedbackinfo);
+        List<TbFeedbackinfo> list = iTbFeedbackinfoService.list(lqw);
+        ExcelUtil<TbFeedbackinfo> util = new ExcelUtil<TbFeedbackinfo>(TbFeedbackinfo. class);
+        return util.exportExcel(list, "feedbackinfo" );
+    }
+
+    /**
+     * 获取信息反馈详细信息
+     */
+    @ApiOperation("获取信息反馈详细信息")
+    @PreAuthorize("@ss.hasPermi('system:feedbackinfo:query')" )
+    @GetMapping(value = "/{id}" )
+    public AjaxResult getInfo(@PathVariable("id" ) Long id) {
+        return AjaxResult.success(iTbFeedbackinfoService.getById(id));
+    }
+
+    /**
+     * 新增信息反馈
+     */
+    @ApiOperation("新增信息反馈")
+    @PreAuthorize("@ss.hasPermi('system:feedbackinfo:add')" )
+    @Log(title = "信息反馈" , businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TbFeedbackinfo tbFeedbackinfo) {
+
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        Long userId = loginUser.getUser().getUserId();
+        tbFeedbackinfo.setCreateBy(userId);
+
+        Date date = new Date();
+        tbFeedbackinfo.setCreateTime(date);
+        return toAjax(iTbFeedbackinfoService.save(tbFeedbackinfo) ? 1 : 0);
+    }
+
+    /**
+     * 修改信息反馈
+     */
+    @ApiOperation("修改信息反馈")
+    @PreAuthorize("@ss.hasPermi('system:feedbackinfo:edit')" )
+    @Log(title = "信息反馈" , businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TbFeedbackinfo tbFeedbackinfo) {
+
+
+        Date date = new Date();
+        tbFeedbackinfo.setUpdateTime(date);
+        return toAjax(iTbFeedbackinfoService.updateById(tbFeedbackinfo) ? 1 : 0);
+    }
+
+    /**
+     * 删除信息反馈
+     */
+    @ApiOperation("删除信息反馈")
+    @PreAuthorize("@ss.hasPermi('system:feedbackinfo:remove')" )
+    @Log(title = "信息反馈" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}" )
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(iTbFeedbackinfoService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+}

+ 110 - 0
ruoyi-app/src/main/java/com/ruoyi/app/controller/FeedbackinfoController.java

@@ -0,0 +1,110 @@
+package com.ruoyi.app.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.app.domain.TbFeedbackinfo;
+import com.ruoyi.app.service.ITbFeedbackinfoService;
+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.domain.model.LoginUser;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.web.service.TokenService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 信息反馈
+ *
+ * @author liuhj
+ * @date 2020-10-20
+ */
+@Api(value = "信息反馈", tags = "信息反馈")
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/app/feedbackinfo" )
+public class FeedbackinfoController extends BaseController {
+
+    private final ITbFeedbackinfoService iTbFeedbackinfoService;
+    @Autowired
+    private TokenService tokenService;
+
+    /**
+     * 查询信息反馈列表
+     */
+    @ApiOperation(value = "信息反馈列表", notes = "信息反馈列表")
+    @GetMapping("/list")
+    public TableDataInfo list(TbFeedbackinfo tbFeedbackinfo)
+    {
+        startPage();
+        LambdaQueryWrapper<TbFeedbackinfo> lqw = new LambdaQueryWrapper<TbFeedbackinfo>();
+        if (StringUtils.isNotBlank(tbFeedbackinfo.getTitle())){
+            lqw.like(TbFeedbackinfo::getTitle ,tbFeedbackinfo.getTitle());
+        }
+        if (tbFeedbackinfo.getCreateBy() != null){
+            lqw.eq(TbFeedbackinfo::getCreateBy ,tbFeedbackinfo.getCreateBy());
+        }
+        List<TbFeedbackinfo> list = iTbFeedbackinfoService.list(lqw);
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取信息反馈详细信息
+     */
+    @ApiOperation(value = "信息反馈详细信息", notes = "信息反馈详细信息")
+    @GetMapping(value = "/{id}" )
+    public AjaxResult detail(@PathVariable("id" ) Long id) {
+        return AjaxResult.success(iTbFeedbackinfoService.getById(id));
+    }
+
+    /**
+     * 新增信息反馈
+     */
+    @ApiOperation("新增信息反馈")
+    @Log(title = "信息反馈" , businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    public AjaxResult add(@RequestBody TbFeedbackinfo tbFeedbackinfo) {
+
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        Long userId = loginUser.getUser().getUserId();
+        tbFeedbackinfo.setCreateBy(userId);
+
+        Date date = new Date();
+        tbFeedbackinfo.setCreateTime(date);
+        return toAjax(iTbFeedbackinfoService.save(tbFeedbackinfo) ? 1 : 0);
+    }
+
+    /**
+     * 修改信息反馈
+     */
+    @ApiOperation("修改信息反馈")
+    @Log(title = "信息反馈" , businessType = BusinessType.UPDATE)
+    @PutMapping("/update")
+    public AjaxResult edit(@RequestBody TbFeedbackinfo tbFeedbackinfo) {
+
+        Date date = new Date();
+        tbFeedbackinfo.setUpdateTime(date);
+        return toAjax(iTbFeedbackinfoService.updateById(tbFeedbackinfo) ? 1 : 0);
+    }
+
+    /**
+     * 删除信息反馈
+     */
+    @ApiOperation("删除信息反馈")
+    @Log(title = "信息反馈" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/del")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(iTbFeedbackinfoService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+}

+ 72 - 0
ruoyi-system/src/main/java/com/ruoyi/app/domain/TbFeedbackinfo.java

@@ -0,0 +1,72 @@
+package com.ruoyi.app.domain;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+import com.ruoyi.common.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.io.Serializable;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 信息反馈
+ * 
+ * @author liuhj
+ * @date 2020-10-20
+ */
+@Data
+@ApiModel(value = "信息反馈")
+@ToString
+@EqualsAndHashCode
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("tb_feedbackinfo")
+public class TbFeedbackinfo implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+
+    /** id */
+    @ApiModelProperty(value="id")
+    @TableId(value = "id")
+    private Long id;
+
+    /** 反馈标题 */
+    @ApiModelProperty(value="反馈标题")
+    @Excel(name = "反馈标题")
+    private String title;
+
+    /** 反馈内容 */
+    @ApiModelProperty(value="反馈内容")
+    @Excel(name = "反馈内容")
+    private String contents;
+
+    /** 提交人ID */
+    @ApiModelProperty(value="提交人ID")
+    @Excel(name = "提交人ID")
+    private Long createBy;
+
+    /** 创建时间 */
+    @ApiModelProperty(value="创建时间")
+    @Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /** 反馈意见 */
+    @ApiModelProperty(value="反馈意见")
+    @Excel(name = "反馈意见")
+    private String opinions;
+
+    /** 更新时间 */
+    @ApiModelProperty(value="更新时间")
+    private Date updateTime;
+}

+ 14 - 0
ruoyi-system/src/main/java/com/ruoyi/app/mapper/TbFeedbackinfoMapper.java

@@ -0,0 +1,14 @@
+package com.ruoyi.app.mapper;
+
+import com.ruoyi.app.domain.TbFeedbackinfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 信息反馈
+ *
+ * @author liuhj
+ * @date 2020-10-20
+ */
+public interface TbFeedbackinfoMapper extends BaseMapper<TbFeedbackinfo> {
+
+}

+ 14 - 0
ruoyi-system/src/main/java/com/ruoyi/app/service/ITbFeedbackinfoService.java

@@ -0,0 +1,14 @@
+package com.ruoyi.app.service;
+
+import com.ruoyi.app.domain.TbFeedbackinfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 信息反馈
+ *
+ * @author liuhj
+ * @date 2020-10-20
+ */
+public interface ITbFeedbackinfoService extends IService<TbFeedbackinfo> {
+
+}

+ 18 - 0
ruoyi-system/src/main/java/com/ruoyi/app/service/impl/TbFeedbackinfoServiceImpl.java

@@ -0,0 +1,18 @@
+package com.ruoyi.app.service.impl;
+
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.app.mapper.TbFeedbackinfoMapper;
+import com.ruoyi.app.domain.TbFeedbackinfo;
+import com.ruoyi.app.service.ITbFeedbackinfoService;
+
+/**
+ * 信息反馈
+ *
+ * @author liuhj
+ * @date 2020-10-20
+ */
+@Service
+public class TbFeedbackinfoServiceImpl extends ServiceImpl<TbFeedbackinfoMapper, TbFeedbackinfo> implements ITbFeedbackinfoService {
+
+}

+ 18 - 0
ruoyi-system/src/main/resources/mapper/app/TbFeedbackinfoMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.app.mapper.TbFeedbackinfoMapper">
+    
+    <resultMap type="TbFeedbackinfo" id="TbFeedbackinfoResult">
+        <result property="id"    column="id"    />
+        <result property="title"    column="title"    />
+        <result property="contents"    column="contents"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="opinions"    column="opinions"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+
+</mapper>