我的发布--添加--FollowInfo表
This commit is contained in:
parent
ed247ff62e
commit
6513a5b5f3
@ -0,0 +1,104 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
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.FollowInfo;
|
||||
import com.ruoyi.system.service.IFollowInfoService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 关注信息Controller
|
||||
*
|
||||
* @author haotian
|
||||
* @date 2024-12-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/info")
|
||||
public class FollowInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IFollowInfoService followInfoService;
|
||||
|
||||
/**
|
||||
* 查询关注信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(FollowInfo followInfo)
|
||||
{
|
||||
startPage();
|
||||
List<FollowInfo> list = followInfoService.selectFollowInfoList(followInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出关注信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:export')")
|
||||
@Log(title = "关注信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, FollowInfo followInfo)
|
||||
{
|
||||
List<FollowInfo> list = followInfoService.selectFollowInfoList(followInfo);
|
||||
ExcelUtil<FollowInfo> util = new ExcelUtil<FollowInfo>(FollowInfo.class);
|
||||
util.exportExcel(response, list, "关注信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关注信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:query')")
|
||||
@GetMapping(value = "/{followInfoId}")
|
||||
public AjaxResult getInfo(@PathVariable("followInfoId") Long followInfoId)
|
||||
{
|
||||
return success(followInfoService.selectFollowInfoByFollowInfoId(followInfoId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增关注信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:add')")
|
||||
@Log(title = "关注信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody FollowInfo followInfo)
|
||||
{
|
||||
return toAjax(followInfoService.insertFollowInfo(followInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改关注信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:edit')")
|
||||
@Log(title = "关注信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody FollowInfo followInfo)
|
||||
{
|
||||
return toAjax(followInfoService.updateFollowInfo(followInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除关注信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:info:remove')")
|
||||
@Log(title = "关注信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{followInfoIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] followInfoIds)
|
||||
{
|
||||
return toAjax(followInfoService.deleteFollowInfoByFollowInfoIds(followInfoIds));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,110 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 关注信息对象 follow_info
|
||||
*
|
||||
* @author haotian
|
||||
* @date 2024-12-26
|
||||
*/
|
||||
public class FollowInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 关注信息id,主键,唯一 */
|
||||
private Long followInfoId;
|
||||
|
||||
/** 关注者id,关联user_account中的user_id */
|
||||
@Excel(name = "关注者id,关联user_account中的user_id")
|
||||
private String followerId;
|
||||
|
||||
/** 被关注者id */
|
||||
@Excel(name = "被关注者id")
|
||||
private String userId;
|
||||
|
||||
/** 关注时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "关注时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date followTime;
|
||||
|
||||
/** 删除标志:0代表未删除,1代表删除 */
|
||||
private String delFlag;
|
||||
|
||||
/** 关注状态:0单方面关注,1互关 */
|
||||
@Excel(name = "关注状态:0单方面关注,1互关")
|
||||
private String followStatus;
|
||||
|
||||
public void setFollowInfoId(Long followInfoId)
|
||||
{
|
||||
this.followInfoId = followInfoId;
|
||||
}
|
||||
|
||||
public Long getFollowInfoId()
|
||||
{
|
||||
return followInfoId;
|
||||
}
|
||||
public void setFollowerId(String followerId)
|
||||
{
|
||||
this.followerId = followerId;
|
||||
}
|
||||
|
||||
public String getFollowerId()
|
||||
{
|
||||
return followerId;
|
||||
}
|
||||
public void setUserId(String userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setFollowTime(Date followTime)
|
||||
{
|
||||
this.followTime = followTime;
|
||||
}
|
||||
|
||||
public Date getFollowTime()
|
||||
{
|
||||
return followTime;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
public void setFollowStatus(String followStatus)
|
||||
{
|
||||
this.followStatus = followStatus;
|
||||
}
|
||||
|
||||
public String getFollowStatus()
|
||||
{
|
||||
return followStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("followInfoId", getFollowInfoId())
|
||||
.append("followerId", getFollowerId())
|
||||
.append("userId", getUserId())
|
||||
.append("followTime", getFollowTime())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("remark", getRemark())
|
||||
.append("followStatus", getFollowStatus())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.FollowInfo;
|
||||
|
||||
/**
|
||||
* 关注信息Mapper接口
|
||||
*
|
||||
* @author haotian
|
||||
* @date 2024-12-26
|
||||
*/
|
||||
public interface FollowInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询关注信息
|
||||
*
|
||||
* @param followInfoId 关注信息主键
|
||||
* @return 关注信息
|
||||
*/
|
||||
public FollowInfo selectFollowInfoByFollowInfoId(Long followInfoId);
|
||||
|
||||
/**
|
||||
* 查询关注信息列表
|
||||
*
|
||||
* @param followInfo 关注信息
|
||||
* @return 关注信息集合
|
||||
*/
|
||||
public List<FollowInfo> selectFollowInfoList(FollowInfo followInfo);
|
||||
|
||||
/**
|
||||
* 新增关注信息
|
||||
*
|
||||
* @param followInfo 关注信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFollowInfo(FollowInfo followInfo);
|
||||
|
||||
/**
|
||||
* 修改关注信息
|
||||
*
|
||||
* @param followInfo 关注信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFollowInfo(FollowInfo followInfo);
|
||||
|
||||
/**
|
||||
* 删除关注信息
|
||||
*
|
||||
* @param followInfoId 关注信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFollowInfoByFollowInfoId(Long followInfoId);
|
||||
|
||||
/**
|
||||
* 批量删除关注信息
|
||||
*
|
||||
* @param followInfoIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFollowInfoByFollowInfoIds(Long[] followInfoIds);
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.FollowInfo;
|
||||
|
||||
/**
|
||||
* 关注信息Service接口
|
||||
*
|
||||
* @author haotian
|
||||
* @date 2024-12-26
|
||||
*/
|
||||
public interface IFollowInfoService
|
||||
{
|
||||
/**
|
||||
* 查询关注信息
|
||||
*
|
||||
* @param followInfoId 关注信息主键
|
||||
* @return 关注信息
|
||||
*/
|
||||
public FollowInfo selectFollowInfoByFollowInfoId(Long followInfoId);
|
||||
|
||||
/**
|
||||
* 查询关注信息列表
|
||||
*
|
||||
* @param followInfo 关注信息
|
||||
* @return 关注信息集合
|
||||
*/
|
||||
public List<FollowInfo> selectFollowInfoList(FollowInfo followInfo);
|
||||
|
||||
/**
|
||||
* 新增关注信息
|
||||
*
|
||||
* @param followInfo 关注信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFollowInfo(FollowInfo followInfo);
|
||||
|
||||
/**
|
||||
* 修改关注信息
|
||||
*
|
||||
* @param followInfo 关注信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFollowInfo(FollowInfo followInfo);
|
||||
|
||||
/**
|
||||
* 批量删除关注信息
|
||||
*
|
||||
* @param followInfoIds 需要删除的关注信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFollowInfoByFollowInfoIds(Long[] followInfoIds);
|
||||
|
||||
/**
|
||||
* 删除关注信息信息
|
||||
*
|
||||
* @param followInfoId 关注信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFollowInfoByFollowInfoId(Long followInfoId);
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.FollowInfoMapper;
|
||||
import com.ruoyi.system.domain.FollowInfo;
|
||||
import com.ruoyi.system.service.IFollowInfoService;
|
||||
|
||||
/**
|
||||
* 关注信息Service业务层处理
|
||||
*
|
||||
* @author haotian
|
||||
* @date 2024-12-26
|
||||
*/
|
||||
@Service
|
||||
public class FollowInfoServiceImpl implements IFollowInfoService
|
||||
{
|
||||
@Autowired
|
||||
private FollowInfoMapper followInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询关注信息
|
||||
*
|
||||
* @param followInfoId 关注信息主键
|
||||
* @return 关注信息
|
||||
*/
|
||||
@Override
|
||||
public FollowInfo selectFollowInfoByFollowInfoId(Long followInfoId)
|
||||
{
|
||||
return followInfoMapper.selectFollowInfoByFollowInfoId(followInfoId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询关注信息列表
|
||||
*
|
||||
* @param followInfo 关注信息
|
||||
* @return 关注信息
|
||||
*/
|
||||
@Override
|
||||
public List<FollowInfo> selectFollowInfoList(FollowInfo followInfo)
|
||||
{
|
||||
return followInfoMapper.selectFollowInfoList(followInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增关注信息
|
||||
*
|
||||
* @param followInfo 关注信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertFollowInfo(FollowInfo followInfo)
|
||||
{
|
||||
return followInfoMapper.insertFollowInfo(followInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改关注信息
|
||||
*
|
||||
* @param followInfo 关注信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateFollowInfo(FollowInfo followInfo)
|
||||
{
|
||||
return followInfoMapper.updateFollowInfo(followInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除关注信息
|
||||
*
|
||||
* @param followInfoIds 需要删除的关注信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFollowInfoByFollowInfoIds(Long[] followInfoIds)
|
||||
{
|
||||
return followInfoMapper.deleteFollowInfoByFollowInfoIds(followInfoIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除关注信息信息
|
||||
*
|
||||
* @param followInfoId 关注信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFollowInfoByFollowInfoId(Long followInfoId)
|
||||
{
|
||||
return followInfoMapper.deleteFollowInfoByFollowInfoId(followInfoId);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
<?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.system.mapper.FollowInfoMapper">
|
||||
|
||||
<resultMap type="FollowInfo" id="FollowInfoResult">
|
||||
<result property="followInfoId" column="follow_info_id" />
|
||||
<result property="followerId" column="follower_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="followTime" column="follow_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="followStatus" column="follow_status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectFollowInfoVo">
|
||||
select follow_info_id, follower_id, user_id, follow_time, del_flag, remark, follow_status from follow_info
|
||||
</sql>
|
||||
|
||||
<select id="selectFollowInfoList" parameterType="FollowInfo" resultMap="FollowInfoResult">
|
||||
<include refid="selectFollowInfoVo"/>
|
||||
<where>
|
||||
<if test="followerId != null and followerId != ''"> and follower_id = #{followerId}</if>
|
||||
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
|
||||
<if test="followTime != null "> and follow_time = #{followTime}</if>
|
||||
<if test="followStatus != null and followStatus != ''"> and follow_status = #{followStatus}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectFollowInfoByFollowInfoId" parameterType="Long" resultMap="FollowInfoResult">
|
||||
<include refid="selectFollowInfoVo"/>
|
||||
where follow_info_id = #{followInfoId}
|
||||
</select>
|
||||
|
||||
<insert id="insertFollowInfo" parameterType="FollowInfo" useGeneratedKeys="true" keyProperty="followInfoId">
|
||||
insert into follow_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="followerId != null and followerId != ''">follower_id,</if>
|
||||
<if test="userId != null and userId != ''">user_id,</if>
|
||||
<if test="followTime != null">follow_time,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="followStatus != null and followStatus != ''">follow_status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="followerId != null and followerId != ''">#{followerId},</if>
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
<if test="followTime != null">#{followTime},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="followStatus != null and followStatus != ''">#{followStatus},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateFollowInfo" parameterType="FollowInfo">
|
||||
update follow_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="followerId != null and followerId != ''">follower_id = #{followerId},</if>
|
||||
<if test="userId != null and userId != ''">user_id = #{userId},</if>
|
||||
<if test="followTime != null">follow_time = #{followTime},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="followStatus != null and followStatus != ''">follow_status = #{followStatus},</if>
|
||||
</trim>
|
||||
where follow_info_id = #{followInfoId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteFollowInfoByFollowInfoId" parameterType="Long">
|
||||
delete from follow_info where follow_info_id = #{followInfoId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteFollowInfoByFollowInfoIds" parameterType="String">
|
||||
delete from follow_info where follow_info_id in
|
||||
<foreach item="followInfoId" collection="array" open="(" separator="," close=")">
|
||||
#{followInfoId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user