linhw 2024-05-29 11:08:43 +08:00
parent 4f6fdff2fb
commit c2100061df
10 changed files with 528 additions and 1 deletions

View File

@ -0,0 +1,114 @@
package com.ruoyi.app.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.R;
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.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.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.app.domain.AppFeedback;
import com.ruoyi.app.service.IAppFeedbackService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author wyh
* @date 2024-05-29
*/
@RestController
@RequestMapping("/feedback")
@Api(tags = "意见反馈" , description = "意见反馈")
public class AppFeedbackController extends BaseController
{
@Autowired
private IAppFeedbackService appFeedbackService;
/**
*
*/
@RequiresPermissions("app:feedback:list")
@GetMapping("/list")
@ApiOperation(value = "查询意见反馈", notes = "查询意见反馈", httpMethod = "GET")
public TableDataInfo list(AppFeedback appFeedback)
{
startPage();
List<AppFeedback> list = appFeedbackService.selectAppFeedbackList(appFeedback);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("app:feedback:export")
@Log(title = "意见反馈", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AppFeedback appFeedback)
{
List<AppFeedback> list = appFeedbackService.selectAppFeedbackList(appFeedback);
ExcelUtil<AppFeedback> util = new ExcelUtil<AppFeedback>(AppFeedback.class);
util.exportExcel(response, list, "意见反馈数据");
}
/**
*
*/
@RequiresPermissions("app:feedback:query")
@GetMapping(value = "/{id}")
@ApiOperation(value = "获取意见反馈详细信息", notes = "获取意见反馈详细信息", httpMethod = "GET")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(appFeedbackService.selectAppFeedbackById(id));
}
/**
*
*/
@RequiresPermissions("app:feedback:add")
@ApiOperation(value = "新增意见反馈", notes = "新增意见反馈", httpMethod = "POST")
@Log(title = "意见反馈", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody AppFeedback appFeedback)
{
return toAjax(appFeedbackService.insertAppFeedback(appFeedback));
}
/**
*
*/
@RequiresPermissions("app:feedback:edit")
@ApiOperation(value = "修改意见反馈", notes = "修改意见反馈", httpMethod = "PUT")
@Log(title = "意见反馈", businessType = BusinessType.UPDATE)
@PutMapping("/edit")
public AjaxResult edit(@RequestBody AppFeedback appFeedback)
{
return toAjax(appFeedbackService.updateAppFeedback(appFeedback));
}
/**
*
*/
@RequiresPermissions("app:feedback:remove")
@Log(title = "意见反馈", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(appFeedbackService.deleteAppFeedbackByIds(ids));
}
}

View File

@ -0,0 +1,88 @@
package com.ruoyi.app.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* app_feedback
*
* @author wyh
* @date 2024-05-29
*/
public class AppFeedback extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 反馈人 */
@Excel(name = "反馈人")
private Long userId;
/** 反馈内容 */
@Excel(name = "反馈内容")
private String content;
/** 反馈图片 */
@Excel(name = "反馈图片")
private String imgUrl;
@Excel(name = "用户名")
private String username;
@Excel(name = "头像")
private String avatarUrl;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setImgUrl(String imgUrl)
{
this.imgUrl = imgUrl;
}
public String getImgUrl()
{
return imgUrl;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("content", getContent())
.append("imgUrl", getImgUrl())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -44,6 +44,10 @@ public class AppInform extends BaseEntity
@Excel(name = "用户名")
private String byUsername;
/** 图片 */
@Excel(name = "图片")
private String imgUrl;
public void setId(Long id)
{
this.id = id;

View File

@ -0,0 +1,62 @@
package com.ruoyi.app.mapper;
import java.util.List;
import com.ruoyi.app.domain.AppFeedback;
/**
* Mapper
*
* @author wyh
* @date 2024-05-29
*/
public interface AppFeedbackMapper
{
/**
*
*
* @param id
* @return
*/
public AppFeedback selectAppFeedbackById(Long id);
/**
*
*
* @param appFeedback
* @return
*/
public List<AppFeedback> selectAppFeedbackList(AppFeedback appFeedback);
public List<AppFeedback> selectList(AppFeedback appFeedback);
/**
*
*
* @param appFeedback
* @return
*/
public int insertAppFeedback(AppFeedback appFeedback);
/**
*
*
* @param appFeedback
* @return
*/
public int updateAppFeedback(AppFeedback appFeedback);
/**
*
*
* @param id
* @return
*/
public int deleteAppFeedbackById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteAppFeedbackByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.app.service;
import java.util.List;
import com.ruoyi.app.domain.AppFeedback;
/**
* Service
*
* @author wyh
* @date 2024-05-29
*/
public interface IAppFeedbackService
{
/**
*
*
* @param id
* @return
*/
public AppFeedback selectAppFeedbackById(Long id);
/**
*
*
* @param appFeedback
* @return
*/
public List<AppFeedback> selectAppFeedbackList(AppFeedback appFeedback);
/**
*
*
* @param appFeedback
* @return
*/
public int insertAppFeedback(AppFeedback appFeedback);
/**
*
*
* @param appFeedback
* @return
*/
public int updateAppFeedback(AppFeedback appFeedback);
/**
*
*
* @param ids
* @return
*/
public int deleteAppFeedbackByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteAppFeedbackById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.ruoyi.app.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.app.mapper.AppFeedbackMapper;
import com.ruoyi.app.domain.AppFeedback;
import com.ruoyi.app.service.IAppFeedbackService;
/**
* Service
*
* @author wyh
* @date 2024-05-29
*/
@Service
public class AppFeedbackServiceImpl implements IAppFeedbackService
{
@Autowired
private AppFeedbackMapper appFeedbackMapper;
/**
*
*
* @param id
* @return
*/
@Override
public AppFeedback selectAppFeedbackById(Long id)
{
return appFeedbackMapper.selectAppFeedbackById(id);
}
/**
*
*
* @param appFeedback
* @return
*/
@Override
public List<AppFeedback> selectAppFeedbackList(AppFeedback appFeedback)
{
return appFeedbackMapper.selectList(appFeedback);
}
/**
*
*
* @param appFeedback
* @return
*/
@Override
public int insertAppFeedback(AppFeedback appFeedback)
{
appFeedback.setCreateTime(DateUtils.getNowDate());
return appFeedbackMapper.insertAppFeedback(appFeedback);
}
/**
*
*
* @param appFeedback
* @return
*/
@Override
public int updateAppFeedback(AppFeedback appFeedback)
{
appFeedback.setUpdateTime(DateUtils.getNowDate());
return appFeedbackMapper.updateAppFeedback(appFeedback);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteAppFeedbackByIds(Long[] ids)
{
return appFeedbackMapper.deleteAppFeedbackByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteAppFeedbackById(Long id)
{
return appFeedbackMapper.deleteAppFeedbackById(id);
}
}

View File

@ -170,6 +170,7 @@ public class AppUserDynamicServiceImpl implements IAppUserDynamicService
appUserDynamic.setPrivacyStatus(0l);
AppUserFriend appUserFriend = new AppUserFriend();
appUserFriend.setUserId(appUserDynamic.getUserId());
appUserFriend.setStatus(0l);
List<AppUserFriend> friends = appUserFriendMapper.selectAppUserFriendList(appUserFriend);
if (friends != null && friends.size() > 0) {
// 好友的动态
@ -221,6 +222,7 @@ public class AppUserDynamicServiceImpl implements IAppUserDynamicService
AppUserFriend appUserFriend = new AppUserFriend();
appUserFriend.setUserId(appUserDynamic.getUserId());
appUserFriend.setStatus(0l);
List<AppUserFriend> friends = appUserFriendMapper.selectAppUserFriendList(appUserFriend);
if (friends.stream().map(AppUserFriend::getFriendId).collect(Collectors.toList()).contains(appUserDynamicVo.getUserId())) {
appUserDynamicVo.setIsFans(0);

View File

@ -205,6 +205,7 @@ public class AppUserServiceImpl implements IAppUserService {
// 查询我的用户列表
AppUserFriend appUserFriend = new AppUserFriend();
appUserFriend.setUserId(appUser.getAppId());
appUserFriend.setStatus(0l);
List<AppUserFriend> appUserFriends = appUserFriendMapper.selectAppUserFriendList(appUserFriend);
List<Long> ids = appUserFriends.stream().map(x -> x.getFriendId()).collect(Collectors.toList());
@ -260,6 +261,7 @@ public class AppUserServiceImpl implements IAppUserService {
case 1://好友
AppUserFriend appUserFriend = new AppUserFriend();
appUserFriend.setUserId(appUser.getAppId());
appUserFriend.setStatus(0l);
List<AppUserFriend> list = appUserFriendMapper.selectAppUserFriendList(appUserFriend);
ids = list.stream().map(x -> x.getFriendId()).collect(Collectors.toList());
break;

View File

@ -0,0 +1,92 @@
<?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.AppFeedbackMapper">
<resultMap type="AppFeedback" id="AppFeedbackResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="content" column="content" />
<result property="imgUrl" column="img_url" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectAppFeedbackVo">
select id, user_id, content, img_url, create_time, update_time, remark from app_feedback
</sql>
<select id="selectAppFeedbackList" parameterType="AppFeedback" resultMap="AppFeedbackResult">
<include refid="selectAppFeedbackVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
</where>
</select>
<select id="selectList" parameterType="AppFeedback" resultType="AppFeedback">
select a.id, a.user_id as "userId", a.content, a.img_url as "imgUrl", a.create_time as "createTime",
u.username as "username",
u.avatar_url as "avatarUrl"
from app_feedback a
LEFT JOIN app_user u on u.id = a.user_id
<where>
<if test="userId != null "> and a.user_id = #{userId}</if>
<if test="username != null "> and u.username like concat('%',#{username},'%')</if>
<if test="content != null and content != ''"> and a.content like concat('%',#{content},'%')</if>
<if test="imgUrl != null and imgUrl != ''"> and a.img_url = #{imgUrl}</if>
</where>
</select>
<select id="selectAppFeedbackById" parameterType="Long" resultMap="AppFeedbackResult">
<include refid="selectAppFeedbackVo"/>
where id = #{id}
</select>
<insert id="insertAppFeedback" parameterType="AppFeedback" useGeneratedKeys="true" keyProperty="id">
insert into app_feedback
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="content != null">content,</if>
<if test="imgUrl != null">img_url,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="content != null">#{content},</if>
<if test="imgUrl != null">#{imgUrl},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateAppFeedback" parameterType="AppFeedback">
update app_feedback
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="content != null">content = #{content},</if>
<if test="imgUrl != null">img_url = #{imgUrl},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAppFeedbackById" parameterType="Long">
delete from app_feedback where id = #{id}
</delete>
<delete id="deleteAppFeedbackByIds" parameterType="String">
delete from app_feedback where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -9,13 +9,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="content" column="content" />
<result property="userId" column="user_id" />
<result property="byUserId" column="by_user_id" />
<result property="imgUrl" column="img_url" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectAppInformVo">
select id, content, user_id, by_user_id, create_time, update_time, remark from app_inform
select id, content, user_id, by_user_id,img_url, create_time, update_time, remark from app_inform
</sql>
<select id="selectAppInformList" parameterType="AppInform" resultMap="AppInformResult">
@ -24,11 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null "> and user_id = #{userId}</if>
<if test="byUserId != null "> and by_user_id = #{byUserId}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
</where>
</select>
<select id="selectList" parameterType="AppInform" resultType="AppInform">
select a.id, a.content, a.user_id as "userId", a.by_user_id as "byUserId", a.create_time as "createTime", a.update_time, a.remark,
a.img_url as "imgUrl",
u.username as "username",
u.avatar_url as "avatarUrl",
au.username as "byUsername",
@ -56,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">user_id,</if>
<if test="byUserId != null">by_user_id,</if>
<if test="content != null">content,</if>
<if test="imgUrl != null">img_url,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
@ -64,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">#{userId},</if>
<if test="byUserId != null">#{byUserId},</if>
<if test="content != null">#{content},</if>
<if test="imgUrl != null">#{imgUrl},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
@ -76,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">user_id = #{userId},</if>
<if test="byUserId != null">by_user_id = #{byUserId},</if>
<if test="content != null">content = #{content},</if>
<if test="imgUrl != null">img_url = #{imgUrl},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>