|
@@ -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);
|
|
|
+ }
|
|
|
+}
|