问题反馈

This commit is contained in:
wuchunlei
2024-07-04 17:21:32 +08:00
parent e5839ca3e7
commit b266811b8a
5 changed files with 174 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
package com.peanut.modules.common.controller;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.SysFeedback;
import com.peanut.modules.common.service.SysFeedbackService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* 问题反馈
*/
@Slf4j
@RestController("commonSysFeedback")
@RequestMapping("common/sysFeedback")
public class SysFeedbackController {
@Autowired
private SysFeedbackService sysFeedbackService;
@RequestMapping("/addSysFeedback")
public R addSysFeedback(@RequestBody SysFeedback sysFeedback){
if (sysFeedbackService.addSysFeedback(sysFeedback)>0){
return R.ok();
}else {
return R.error("添加失败");
}
}
@RequestMapping("/getList")
public R getList(@RequestBody Map<String,Object> params){
List<SysFeedback> res = sysFeedbackService.getList(params);
return R.ok().put("res",res);
}
@RequestMapping("/getById")
public R getById(@RequestBody Map<String,Object> params){
return R.ok().put("sysFeedback",sysFeedbackService.getById(params));
}
@RequestMapping("/delById")
public R delById(@RequestBody Map<String,Object> params){
if (sysFeedbackService.delById(params)>0){
return R.ok();
}else {
return R.error("删除失败");
}
}
}

View File

@@ -0,0 +1,9 @@
package com.peanut.modules.common.dao;
import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.common.entity.SysFeedback;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SysFeedbackDao extends MPJBaseMapper<SysFeedback> {
}

View File

@@ -0,0 +1,32 @@
package com.peanut.modules.common.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("sys_feedback")
public class SysFeedback {
@TableId
private Integer id;
private String account;
private String type;
private String content;
private String image;
private String contactInformation;
private String relation;
private String status;
@TableLogic
private Integer delFlag;
}

View File

@@ -0,0 +1,18 @@
package com.peanut.modules.common.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.SysFeedback;
import java.util.List;
import java.util.Map;
public interface SysFeedbackService extends IService<SysFeedback> {
int addSysFeedback(SysFeedback sysFeedback);
List<SysFeedback> getList(Map<String,Object> params);
SysFeedback getById(Map<String,Object> params);
int delById(Map<String,Object> params);
}

View File

@@ -0,0 +1,47 @@
package com.peanut.modules.common.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.SysFeedbackDao;
import com.peanut.modules.common.entity.SysFeedback;
import com.peanut.modules.common.service.SysFeedbackService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Slf4j
@Service("commonSysFeedbackService")
public class SysFeedbackServiceImpl extends ServiceImpl<SysFeedbackDao, SysFeedback> implements SysFeedbackService {
@Override
public int addSysFeedback(SysFeedback sysFeedback) {
return this.baseMapper.insert(sysFeedback);
}
@Override
public List<SysFeedback> getList(Map<String, Object> params) {
LambdaQueryWrapper<SysFeedback> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(params.get("account").toString())){
queryWrapper.like(SysFeedback::getAccount,params.get("account"));
}
if (StringUtils.isNotBlank(params.get("type").toString())){
queryWrapper.eq(SysFeedback::getType,params.get("type"));
}
if (StringUtils.isNotBlank(params.get("status").toString())){
queryWrapper.eq(SysFeedback::getStatus,params.get("status"));
}
return this.baseMapper.selectList(queryWrapper);
}
@Override
public SysFeedback getById(Map<String, Object> params) {
return this.baseMapper.selectById(params.get("sysFeedbackId").toString());
}
@Override
public int delById(Map<String, Object> params) {
return this.baseMapper.deleteById(params.get("sysFeedbackId").toString());
}
}