完成笔记搜索模块
This commit is contained in:
parent
b16ef37566
commit
88d5c939d5
@ -1,6 +1,9 @@
|
|||||||
package com.dd.admin.business.api;
|
package com.dd.admin.business.api;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.dd.admin.business.author.domain.AuthorDto;
|
||||||
|
import com.dd.admin.business.author.domain.AuthorVo;
|
||||||
import com.dd.admin.business.author.entity.Author;
|
import com.dd.admin.business.author.entity.Author;
|
||||||
import com.dd.admin.business.author.service.AuthorService;
|
import com.dd.admin.business.author.service.AuthorService;
|
||||||
import com.dd.admin.business.chat.service.ChatService;
|
import com.dd.admin.business.chat.service.ChatService;
|
||||||
@ -161,6 +164,18 @@ public class AuthAuthorApi {
|
|||||||
return ResultBean.success(followMes);
|
return ResultBean.success(followMes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取模糊查询博主")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping("/api/auth/getAuthorList")
|
||||||
|
@OperLog(operModule = "获取模糊查询博主",operType = OperType.QUERY,operDesc = "获取模糊查询博主")
|
||||||
|
public ResultBean getFollowMes(AuthorDto authorDto) {
|
||||||
|
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||||
|
authorDto.setAuthorId(authorId);
|
||||||
|
//关注我的列表
|
||||||
|
IPage<AuthorVo> authorVoIPage = authorService.selectAuthorList(authorDto);
|
||||||
|
return ResultBean.success(authorVoIPage);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "获取关注目标互相关注的人")
|
@ApiOperation(value = "获取关注目标互相关注的人")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
@GetMapping("/api/auth/getMyFriends")
|
@GetMapping("/api/auth/getMyFriends")
|
||||||
|
@ -3,6 +3,7 @@ package com.dd.admin.business.api;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
import com.dd.admin.business.author.entity.Author;
|
import com.dd.admin.business.author.entity.Author;
|
||||||
@ -17,6 +18,10 @@ import com.dd.admin.business.follow.domain.FollowDto;
|
|||||||
import com.dd.admin.business.follow.domain.FollowVo;
|
import com.dd.admin.business.follow.domain.FollowVo;
|
||||||
import com.dd.admin.business.follow.entity.Follow;
|
import com.dd.admin.business.follow.entity.Follow;
|
||||||
import com.dd.admin.business.follow.service.FollowService;
|
import com.dd.admin.business.follow.service.FollowService;
|
||||||
|
import com.dd.admin.business.history.domain.HistoryDto;
|
||||||
|
import com.dd.admin.business.history.domain.HistoryVo;
|
||||||
|
import com.dd.admin.business.history.entity.History;
|
||||||
|
import com.dd.admin.business.history.service.HistoryService;
|
||||||
import com.dd.admin.business.note.domain.NoteDto;
|
import com.dd.admin.business.note.domain.NoteDto;
|
||||||
import com.dd.admin.business.note.domain.NoteVo;
|
import com.dd.admin.business.note.domain.NoteVo;
|
||||||
import com.dd.admin.business.note.domain.ReplayMeVo;
|
import com.dd.admin.business.note.domain.ReplayMeVo;
|
||||||
@ -83,6 +88,8 @@ public class AuthNoteApi {
|
|||||||
FollowService followService;
|
FollowService followService;
|
||||||
@Autowired
|
@Autowired
|
||||||
ReplyService replyService;
|
ReplyService replyService;
|
||||||
|
@Autowired
|
||||||
|
HistoryService historyService;
|
||||||
|
|
||||||
@ApiOperation(value = "获取所有关注笔记")
|
@ApiOperation(value = "获取所有关注笔记")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
@ -159,6 +166,14 @@ public class AuthNoteApi {
|
|||||||
return ResultBean.success(pageInfo);
|
return ResultBean.success(pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "模糊查询笔记")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping("/api/auth/getNotesLike")
|
||||||
|
@OperLog(operModule = "模糊查询笔记",operType = OperType.QUERY,operDesc = "模糊查询笔记")
|
||||||
|
public ResultBean<IPage<NoteVo>> getNotesLike(NoteDto noteDto) {
|
||||||
|
IPage<NoteVo> pageInfo = noteService.selectNoteListLike(noteDto);
|
||||||
|
return ResultBean.success(pageInfo);
|
||||||
|
}
|
||||||
|
|
||||||
//外层倒叙 回复正序
|
//外层倒叙 回复正序
|
||||||
@ApiOperation(value = "获取笔记评论")
|
@ApiOperation(value = "获取笔记评论")
|
||||||
@ -270,6 +285,58 @@ public class AuthNoteApi {
|
|||||||
return ResultBean.success(pageInfo);
|
return ResultBean.success(pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "创建搜索记录")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@PostMapping("/api/auth/addHistory")
|
||||||
|
@OperLog(operModule = "创建搜索记录",operType = OperType.ADD,operDesc = "创建搜索记录")
|
||||||
|
public ResultBean addHistory(@RequestBody History history) {
|
||||||
|
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||||
|
history.setAuthorId(authorId);
|
||||||
|
historyService.save(history);
|
||||||
|
return ResultBean.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除搜索记录")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping("/api/auth/deleteHistory")
|
||||||
|
@OperLog(operModule = "删除搜索记录",operType = OperType.ADD,operDesc = "删除搜索记录")
|
||||||
|
public ResultBean deleteHistory() {
|
||||||
|
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||||
|
LambdaUpdateWrapper<History> deleteWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
deleteWrapper.eq(History::getAuthorId,authorId);
|
||||||
|
historyService.remove(deleteWrapper);
|
||||||
|
return ResultBean.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取搜索记录")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping("/api/auth/getHistory")
|
||||||
|
@OperLog(operModule = "获取搜索记录",operType = OperType.ADD,operDesc = "获取搜索记录")
|
||||||
|
public ResultBean getHistory() {
|
||||||
|
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||||
|
HistoryDto history = new HistoryDto();
|
||||||
|
history.setAuthorId(authorId);
|
||||||
|
List<HistoryVo> historyList = historyService.selectHistoryList(history);
|
||||||
|
return ResultBean.success(historyList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取热搜记录")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping("/api/auth/getHotHistory")
|
||||||
|
@OperLog(operModule = "获取热搜记录",operType = OperType.ADD,operDesc = "获取热搜记录")
|
||||||
|
public ResultBean getHotHistory() {
|
||||||
|
List<HistoryVo> historyList = historyService.selectHotHistoryList();
|
||||||
|
return ResultBean.success(historyList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取热搜笔记")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping("/api/auth/getHotNotes")
|
||||||
|
@OperLog(operModule = "获取热搜笔记",operType = OperType.ADD,operDesc = "获取热搜笔记")
|
||||||
|
public ResultBean getHotNotes() {
|
||||||
|
List<NoteVo> historyList = noteService.selectHotNoteList();
|
||||||
|
return ResultBean.success(historyList);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "创建笔记")
|
@ApiOperation(value = "创建笔记")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
|
@ -46,8 +46,8 @@ public class AuthorController {
|
|||||||
@ApiOperation(value = "作者(博主)-列表")
|
@ApiOperation(value = "作者(博主)-列表")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 2)
|
||||||
@GetMapping("/admin/author/list")
|
@GetMapping("/admin/author/list")
|
||||||
public ResultBean<List<AuthorVo>> list(AuthorDto authorDto) {
|
public ResultBean<IPage<AuthorVo>> list(AuthorDto authorDto) {
|
||||||
List<AuthorVo> list = authorService.selectAuthorList(authorDto);
|
IPage<AuthorVo> list = authorService.selectAuthorList(authorDto);
|
||||||
return ResultBean.success(list);
|
return ResultBean.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,5 +108,7 @@ public class AuthorVo {
|
|||||||
@ApiModelProperty(value = "手机号")
|
@ApiModelProperty(value = "手机号")
|
||||||
private String phoneNumber;
|
private String phoneNumber;
|
||||||
|
|
||||||
|
private Boolean isFollowMe = Boolean.FALSE;
|
||||||
|
private Boolean isFollow = Boolean.FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ public interface AuthorMapper extends BaseMapper<Author> {
|
|||||||
|
|
||||||
IPage<AuthorVo> selectAuthorPage(Page<AuthorVo> page, @Param("authorDto") AuthorDto authorDto);
|
IPage<AuthorVo> selectAuthorPage(Page<AuthorVo> page, @Param("authorDto") AuthorDto authorDto);
|
||||||
|
|
||||||
List<AuthorVo> selectAuthorList(@Param("authorDto") AuthorDto authorDto);
|
IPage<AuthorVo> selectAuthorList(Page<AuthorVo> page, @Param("authorDto") AuthorDto authorDto);
|
||||||
|
|
||||||
Author selectAuthorByPhoneNumber(@Param("phoneNumber") String phoneNumber);
|
Author selectAuthorByPhoneNumber(@Param("phoneNumber") String phoneNumber);
|
||||||
|
|
||||||
|
@ -63,9 +63,33 @@
|
|||||||
|
|
||||||
<select id="selectAuthorList" resultType="com.dd.admin.business.author.domain.AuthorVo">
|
<select id="selectAuthorList" resultType="com.dd.admin.business.author.domain.AuthorVo">
|
||||||
select
|
select
|
||||||
*
|
*,
|
||||||
from business_author where 1 = 1
|
(
|
||||||
|
SELECT
|
||||||
|
count(1)
|
||||||
|
FROM
|
||||||
|
business_follow
|
||||||
|
WHERE
|
||||||
|
follow_id = a.AUTHOR_ID
|
||||||
|
AND author_id = #{authorDto.authorId}
|
||||||
|
) AS isFollowMe
|
||||||
|
,
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
count(1)
|
||||||
|
FROM
|
||||||
|
business_follow
|
||||||
|
WHERE
|
||||||
|
follow_id = #{authorDto.authorId}
|
||||||
|
AND author_id = a.AUTHOR_ID
|
||||||
|
) AS isFollow
|
||||||
|
from business_author a where 1 = 1
|
||||||
|
<if test="authorDto.keyword != null and authorDto.keyword != ''">
|
||||||
|
and (a.AUTHOR_NAME like CONCAT('%', #{authorDto.keyword}, '%')
|
||||||
|
or a.PHONE_NUMBER like CONCAT('%', #{authorDto.keyword}, '%'))
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAuthorUpAndStarTotalCount" resultType="java.lang.Long">
|
<select id="selectAuthorUpAndStarTotalCount" resultType="java.lang.Long">
|
||||||
|
|
||||||
SELECT IFNULL(SUM(subquery_counts.count_value), 0) AS total_count
|
SELECT IFNULL(SUM(subquery_counts.count_value), 0) AS total_count
|
||||||
|
@ -23,7 +23,7 @@ public interface AuthorService extends IService<Author> {
|
|||||||
IPage<AuthorVo> selectAuthorPage(AuthorDto authorDto);
|
IPage<AuthorVo> selectAuthorPage(AuthorDto authorDto);
|
||||||
|
|
||||||
//作者(博主)-列表
|
//作者(博主)-列表
|
||||||
List<AuthorVo> selectAuthorList(AuthorDto authorDto);
|
IPage<AuthorVo> selectAuthorList(AuthorDto authorDto);
|
||||||
|
|
||||||
Author selectAuthorByPhoneNumber(String phoneNumber);
|
Author selectAuthorByPhoneNumber(String phoneNumber);
|
||||||
|
|
||||||
|
@ -41,8 +41,9 @@ public class AuthorServiceImpl extends ServiceImpl<AuthorMapper, Author> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AuthorVo> selectAuthorList(AuthorDto authorDto) {
|
public IPage<AuthorVo> selectAuthorList(AuthorDto authorDto) {
|
||||||
return baseMapper.selectAuthorList(authorDto);
|
Page page = PageFactory.defaultPage();
|
||||||
|
return baseMapper.selectAuthorList(page,authorDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,88 @@
|
|||||||
|
package com.dd.admin.business.history.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import com.dd.admin.common.model.UpdateGroup;
|
||||||
|
import com.dd.admin.common.model.result.ResultBean;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import com.dd.admin.business.history.entity.History;
|
||||||
|
import com.dd.admin.business.history.domain.HistoryVo;
|
||||||
|
import com.dd.admin.business.history.domain.HistoryDto;
|
||||||
|
import com.dd.admin.business.history.service.HistoryService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 搜索历史表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2025-01-16
|
||||||
|
*/
|
||||||
|
@Api(tags = "搜索历史表")
|
||||||
|
@RestController
|
||||||
|
public class HistoryController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
HistoryService historyService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "搜索历史表-分页列表")
|
||||||
|
@ApiOperationSupport(order = 1)
|
||||||
|
@GetMapping("/admin/history/page")
|
||||||
|
public ResultBean<IPage<HistoryVo>> page(HistoryDto historyDto) {
|
||||||
|
IPage<HistoryVo> pageInfo = historyService.selectHistoryPage(historyDto);
|
||||||
|
return ResultBean.success(pageInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "搜索历史表-列表")
|
||||||
|
@ApiOperationSupport(order = 2)
|
||||||
|
@GetMapping("/admin/history/list")
|
||||||
|
public ResultBean<List<HistoryVo>> list(HistoryDto historyDto) {
|
||||||
|
List<HistoryVo> list = historyService.selectHistoryList(historyDto);
|
||||||
|
return ResultBean.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "搜索历史表-添加")
|
||||||
|
@ApiOperationSupport(order = 3)
|
||||||
|
@PostMapping("/admin/history/add")
|
||||||
|
public ResultBean<History> add(@RequestBody @Validated HistoryDto historyDto) {
|
||||||
|
History history = BeanUtil.copyProperties(historyDto, History.class);
|
||||||
|
historyService.save(history);
|
||||||
|
return ResultBean.success(history);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "搜索历史表-查询")
|
||||||
|
@ApiOperationSupport(order = 4)
|
||||||
|
@GetMapping("/admin/history/{historyId}")
|
||||||
|
public ResultBean<HistoryVo> get(@PathVariable @NotBlank String historyId) {
|
||||||
|
History history = historyService.getById(historyId);
|
||||||
|
HistoryVo historyVo = BeanUtil.copyProperties(history,HistoryVo.class);
|
||||||
|
return ResultBean.success(historyVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "搜索历史表-修改")
|
||||||
|
@ApiOperationSupport(order = 5)
|
||||||
|
@PostMapping("/admin/history/update")
|
||||||
|
public ResultBean<History> update(@RequestBody @Validated(UpdateGroup.class) HistoryDto historyDto) {
|
||||||
|
History history = BeanUtil.copyProperties(historyDto, History.class);
|
||||||
|
historyService.updateById(history);
|
||||||
|
return ResultBean.success(history);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "搜索历史表-删除")
|
||||||
|
@ApiOperationSupport(order = 6)
|
||||||
|
@GetMapping("/admin/history/delete/{historyId}")
|
||||||
|
public ResultBean<History> delete(@PathVariable @NotBlank String historyId) {
|
||||||
|
Boolean b = historyService.removeById(historyId);
|
||||||
|
return ResultBean.success(b);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.dd.admin.business.history.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.Version;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import com.dd.admin.common.model.UpdateGroup;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 搜索历史表返回对象
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2025-01-16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value="搜索历史表接收对象")
|
||||||
|
public class HistoryDto {
|
||||||
|
|
||||||
|
|
||||||
|
@NotBlank(message = "搜索历史表id不能为空",groups = UpdateGroup.class)
|
||||||
|
private String historyId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "博主id")
|
||||||
|
private String authorId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "博主名")
|
||||||
|
private String aurhorName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "搜索内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "0正常 1删除")
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.dd.admin.business.history.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.Version;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 搜索历史表返回对象
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2025-01-16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value="搜索历史表返回对象")
|
||||||
|
public class HistoryVo {
|
||||||
|
|
||||||
|
|
||||||
|
private String historyId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "博主id")
|
||||||
|
private String authorId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "博主名")
|
||||||
|
private String aurhorName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "搜索内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "0正常 1删除")
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.dd.admin.business.history.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.Version;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 搜索历史表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2025-01-16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("business_history")
|
||||||
|
@ApiModel(value="History对象", description="搜索历史表")
|
||||||
|
public class History implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "HISTORY_ID", type = IdType.ASSIGN_UUID)
|
||||||
|
private String historyId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "博主id")
|
||||||
|
@TableField("AUTHOR_ID")
|
||||||
|
private String authorId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "博主名")
|
||||||
|
@TableField("AURHOR_NAME")
|
||||||
|
private String aurhorName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "搜索内容")
|
||||||
|
@TableField("CONTENT")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "0正常 1删除")
|
||||||
|
@TableField("DELETED")
|
||||||
|
@TableLogic
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.dd.admin.business.history.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.dd.admin.business.history.entity.History;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.dd.admin.business.history.domain.HistoryVo;
|
||||||
|
import com.dd.admin.business.history.domain.HistoryDto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 搜索历史表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2025-01-16
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface HistoryMapper extends BaseMapper<History> {
|
||||||
|
|
||||||
|
IPage<HistoryVo> selectHistoryPage(Page<HistoryVo> page, @Param("historyDto") HistoryDto historyDto);
|
||||||
|
|
||||||
|
List<HistoryVo> selectHistoryList(@Param("historyDto") HistoryDto historyDto);
|
||||||
|
List<HistoryVo> selectHotHistoryList();
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
<?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.dd.admin.business.history.mapper.HistoryMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="com.dd.admin.business.history.entity.History">
|
||||||
|
<id column="HISTORY_ID" property="historyId" />
|
||||||
|
<result column="AUTHOR_ID" property="authorId" />
|
||||||
|
<result column="AURHOR_NAME" property="aurhorName" />
|
||||||
|
<result column="CONTENT" property="content" />
|
||||||
|
<result column="DELETED" property="deleted" />
|
||||||
|
<result column="CREATE_TIME" property="createTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
HISTORY_ID, AUTHOR_ID, AURHOR_NAME, CONTENT, DELETED, CREATE_TIME
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectHistoryPage" resultType="com.dd.admin.business.history.domain.HistoryVo">
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from business_history where 1 = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectHistoryList" resultType="com.dd.admin.business.history.domain.HistoryVo">
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from business_history where deleted = 0
|
||||||
|
<if test="historyDto.authorId != null and historyDto.authorId != ''">
|
||||||
|
and AUTHOR_ID = #{historyDto.authorId}
|
||||||
|
</if>
|
||||||
|
group by content
|
||||||
|
order by create_time desc limit 10
|
||||||
|
</select>
|
||||||
|
<select id="selectHotHistoryList" resultType="com.dd.admin.business.history.domain.HistoryVo">
|
||||||
|
SELECT
|
||||||
|
CONTENT,
|
||||||
|
count(1) count
|
||||||
|
FROM
|
||||||
|
business_history
|
||||||
|
GROUP BY
|
||||||
|
CONTENT
|
||||||
|
order by count desc limit 6
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.dd.admin.business.history.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.dd.admin.business.history.entity.History;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.dd.admin.business.history.domain.HistoryVo;
|
||||||
|
import com.dd.admin.business.history.domain.HistoryDto;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 搜索历史表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2025-01-16
|
||||||
|
*/
|
||||||
|
public interface HistoryService extends IService<History> {
|
||||||
|
|
||||||
|
//搜索历史表-分页列表
|
||||||
|
IPage<HistoryVo> selectHistoryPage(HistoryDto historyDto);
|
||||||
|
|
||||||
|
//搜索历史表-列表
|
||||||
|
List<HistoryVo> selectHistoryList(HistoryDto historyDto);
|
||||||
|
|
||||||
|
List<HistoryVo> selectHotHistoryList();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package com.dd.admin.business.history.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.dd.admin.common.model.PageFactory;
|
||||||
|
import com.dd.admin.business.history.entity.History;
|
||||||
|
import com.dd.admin.business.history.mapper.HistoryMapper;
|
||||||
|
import com.dd.admin.business.history.service.HistoryService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.dd.admin.business.history.domain.HistoryVo;
|
||||||
|
import com.dd.admin.business.history.domain.HistoryDto;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 搜索历史表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 727869402@qq.com
|
||||||
|
* @since 2025-01-16
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class HistoryServiceImpl extends ServiceImpl<HistoryMapper, History> implements HistoryService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<HistoryVo> selectHistoryPage(HistoryDto historyDto) {
|
||||||
|
Page page = PageFactory.defaultPage();
|
||||||
|
return baseMapper.selectHistoryPage(page,historyDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HistoryVo> selectHistoryList(HistoryDto historyDto) {
|
||||||
|
return baseMapper.selectHistoryList(historyDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HistoryVo> selectHotHistoryList() {
|
||||||
|
return baseMapper.selectHotHistoryList();
|
||||||
|
}
|
||||||
|
}
|
@ -95,4 +95,7 @@ public class NoteVo {
|
|||||||
private List<String> imgList;
|
private List<String> imgList;
|
||||||
|
|
||||||
private Integer noteStatus;
|
private Integer noteStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "查看数")
|
||||||
|
private Long viewCount;
|
||||||
}
|
}
|
||||||
|
@ -38,4 +38,6 @@ public interface NoteMapper extends BaseMapper<Note> {
|
|||||||
IPage<UpMeVo> selectUpMeNotes(Page<NoteVo> page, @Param("authorId")String authorId);
|
IPage<UpMeVo> selectUpMeNotes(Page<NoteVo> page, @Param("authorId")String authorId);
|
||||||
IPage<ReplayMeVo> selectReplyMeNotes(Page<NoteVo> page, @Param("authorId")String authorId);
|
IPage<ReplayMeVo> selectReplyMeNotes(Page<NoteVo> page, @Param("authorId")String authorId);
|
||||||
|
|
||||||
|
IPage<NoteVo> selectNoteListLike(Page<NoteVo> page, @Param("noteDto") NoteDto noteDto);
|
||||||
|
List<NoteVo> selectHotNoteList();
|
||||||
}
|
}
|
||||||
|
@ -272,4 +272,36 @@
|
|||||||
ORDER BY
|
ORDER BY
|
||||||
r.create_time DESC
|
r.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectNoteListLike" resultType="com.dd.admin.business.note.domain.NoteVo">
|
||||||
|
select note_id,note_title from business_note where 1 = 1
|
||||||
|
<if test="noteDto.noteTitle != null and noteDto.noteTitle != ''">
|
||||||
|
and note_title like CONCAT('%', #{noteDto.noteTitle}, '%')
|
||||||
|
group by note_title
|
||||||
|
</if>
|
||||||
|
<if test="noteDto.noteContent != null and noteDto.noteContent != ''">
|
||||||
|
and (note_title like CONCAT('%', #{noteDto.noteContent}, '%')
|
||||||
|
or note_content like CONCAT('%', #{noteDto.noteContent}, '%'))
|
||||||
|
</if>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<select id="selectHotNoteList" resultType="com.dd.admin.business.note.domain.NoteVo">
|
||||||
|
SELECT
|
||||||
|
a.NOTE_TITLE,
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
count(1)
|
||||||
|
FROM
|
||||||
|
business_view
|
||||||
|
WHERE
|
||||||
|
note_id = a.note_id
|
||||||
|
) viewCount
|
||||||
|
FROM
|
||||||
|
business_note a
|
||||||
|
GROUP BY
|
||||||
|
a.NOTE_TITLE
|
||||||
|
ORDER BY
|
||||||
|
viewCount DESC
|
||||||
|
LIMIT 10
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -37,4 +37,8 @@ public interface NoteService extends IService<Note> {
|
|||||||
|
|
||||||
IPage<ReplayMeVo> selectReplyMeNotes(String authorId);
|
IPage<ReplayMeVo> selectReplyMeNotes(String authorId);
|
||||||
|
|
||||||
|
|
||||||
|
IPage<NoteVo> selectNoteListLike(NoteDto noteDto);
|
||||||
|
|
||||||
|
List<NoteVo> selectHotNoteList();
|
||||||
}
|
}
|
||||||
|
@ -64,4 +64,15 @@ public class NoteServiceImpl extends ServiceImpl<NoteMapper, Note> implements No
|
|||||||
Page page = PageFactory.defaultPage();
|
Page page = PageFactory.defaultPage();
|
||||||
return baseMapper.selectReplyMeNotes(page,authorId);
|
return baseMapper.selectReplyMeNotes(page,authorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<NoteVo> selectNoteListLike( NoteDto noteDto) {
|
||||||
|
Page page = PageFactory.defaultPage();
|
||||||
|
return baseMapper.selectNoteListLike(page,noteDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NoteVo> selectHotNoteList() {
|
||||||
|
return baseMapper.selectHotNoteList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
<select id="selectReplyList" resultType="com.dd.admin.business.reply.domain.ReplyVo">
|
<select id="selectReplyList" resultType="com.dd.admin.business.reply.domain.ReplyVo">
|
||||||
SELECT
|
SELECT
|
||||||
r.*,
|
ba.AUTHOR_NAME,ba.avatar_url,r.*,
|
||||||
COALESCE(COUNT(urp.REPLY_UP_ID), 0) AS upCount
|
COALESCE(COUNT(urp.REPLY_UP_ID), 0) AS upCount
|
||||||
<if test="replyDto.followId!= null and replyDto.followId!= ''">
|
<if test="replyDto.followId!= null and replyDto.followId!= ''">
|
||||||
,CASE WHEN EXISTS (
|
,CASE WHEN EXISTS (
|
||||||
@ -52,6 +52,8 @@
|
|||||||
business_reply r
|
business_reply r
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
business_up_replys urp ON r.reply_id = urp.REPLY_ID
|
business_up_replys urp ON r.reply_id = urp.REPLY_ID
|
||||||
|
left join
|
||||||
|
business_author ba on r.AUTHOR_ID = ba.AUTHOR_ID
|
||||||
WHERE
|
WHERE
|
||||||
r.DELETED = 0
|
r.DELETED = 0
|
||||||
<if test="replyDto.noteId!= null and replyDto.noteId!= ''">
|
<if test="replyDto.noteId!= null and replyDto.noteId!= ''">
|
||||||
|
41
web/src/api/business/history/history.js
Normal file
41
web/src/api/business/history/history.js
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getHistoryPage(params) {
|
||||||
|
return request({
|
||||||
|
url: '/admin/history/page',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getHistoryList(params) {
|
||||||
|
return request({
|
||||||
|
url: '/admin/history/list',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addHistory(data) {
|
||||||
|
return request({
|
||||||
|
url: '/admin/history/add',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function editHistory(data) {
|
||||||
|
return request({
|
||||||
|
url: '/admin/history/update',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteHistory(historyId) {
|
||||||
|
return request({
|
||||||
|
url: '/admin/history/delete/' + historyId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
106
web/src/views/business/history/addHistory.vue
Normal file
106
web/src/views/business/history/addHistory.vue
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
top="8vh"
|
||||||
|
width="40%"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
center
|
||||||
|
@close="handleCancel"
|
||||||
|
>
|
||||||
|
<div class="el-dialog-div">
|
||||||
|
<el-form
|
||||||
|
:rules="rules"
|
||||||
|
ref="dataForm"
|
||||||
|
:model="temp"
|
||||||
|
label-position="right"
|
||||||
|
label-width="120px"
|
||||||
|
style="height: 90%;"
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-form-item label="" prop="historyId" class="is-required">
|
||||||
|
<el-input v-model="temp.historyId" placeholder="" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="博主id" prop="authorId" class="is-required">
|
||||||
|
<el-input v-model="temp.authorId" placeholder="博主id" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="博主名" prop="aurhorName" class="is-required">
|
||||||
|
<el-input v-model="temp.aurhorName" placeholder="博主名" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="搜索内容" prop="content" class="is-required">
|
||||||
|
<el-input v-model="temp.content" placeholder="搜索内容" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="0正常 1删除" prop="deleted" class="is-required">
|
||||||
|
<el-input v-model="temp.deleted" placeholder="0正常 1删除" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="创建时间" prop="createTime" class="is-required">
|
||||||
|
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="handleCancel">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submit">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {addHistory} from "@/api/business/history/history";
|
||||||
|
import {setRequiredFields} from "@/utils";
|
||||||
|
const requiredFields = []
|
||||||
|
export default {
|
||||||
|
name: "addForm",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
rules: setRequiredFields(requiredFields),
|
||||||
|
dialogVisible: false,
|
||||||
|
temp: {
|
||||||
|
historyId:'',
|
||||||
|
authorId:'',
|
||||||
|
aurhorName:'',
|
||||||
|
content:'',
|
||||||
|
deleted:'',
|
||||||
|
createTime:'',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open() {
|
||||||
|
this.dialogVisible = true
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
this.$refs['dataForm'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
addHistory(this.temp).then(response =>{
|
||||||
|
this.handleCancel()
|
||||||
|
this.$emit('ok', response.data)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log('error submit!!');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleCancel() {
|
||||||
|
//初始化
|
||||||
|
this.temp = this.$options.data().temp
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.$refs['dataForm'].resetFields();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
107
web/src/views/business/history/editHistory.vue
Normal file
107
web/src/views/business/history/editHistory.vue
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
top="8vh"
|
||||||
|
width="40%"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
center
|
||||||
|
@close="handleCancel"
|
||||||
|
>
|
||||||
|
<div class="el-dialog-div">
|
||||||
|
<el-form
|
||||||
|
:rules="rules"
|
||||||
|
ref="dataForm"
|
||||||
|
:model="temp"
|
||||||
|
label-position="right"
|
||||||
|
label-width="120px"
|
||||||
|
style="height: 90%;"
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-form-item label="" prop="historyId" class="is-required">
|
||||||
|
<el-input v-model="temp.historyId" placeholder="" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="博主id" prop="authorId" class="is-required">
|
||||||
|
<el-input v-model="temp.authorId" placeholder="博主id" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="博主名" prop="aurhorName" class="is-required">
|
||||||
|
<el-input v-model="temp.aurhorName" placeholder="博主名" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="搜索内容" prop="content" class="is-required">
|
||||||
|
<el-input v-model="temp.content" placeholder="搜索内容" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="0正常 1删除" prop="deleted" class="is-required">
|
||||||
|
<el-input v-model="temp.deleted" placeholder="0正常 1删除" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="创建时间" prop="createTime" class="is-required">
|
||||||
|
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="handleCancel">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submit">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { editHistory } from "@/api/business/history/history";
|
||||||
|
import {setRequiredFields} from "@/utils";
|
||||||
|
const requiredFields = []
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "editForm",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
rules: setRequiredFields(requiredFields),
|
||||||
|
dialogVisible: false,
|
||||||
|
temp: {
|
||||||
|
historyId:'',
|
||||||
|
authorId:'',
|
||||||
|
aurhorName:'',
|
||||||
|
content:'',
|
||||||
|
deleted:'',
|
||||||
|
createTime:'',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(row) {
|
||||||
|
this.temp = this.$options.data().temp
|
||||||
|
this.temp = row
|
||||||
|
this.dialogVisible = true
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
this.$refs['dataForm'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
editHistory(this.temp).then(response => {
|
||||||
|
this.handleCancel()
|
||||||
|
this.$emit('ok', response.data)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log('error submit!!');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleCancel() {
|
||||||
|
//初始化
|
||||||
|
this.temp = this.$options.data().temp
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.$refs['dataForm'].resetFields()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
243
web/src/views/business/history/historyList.vue
Normal file
243
web/src/views/business/history/historyList.vue
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
|
||||||
|
<div class="filter-container">
|
||||||
|
<el-input
|
||||||
|
v-model="listQuery.keyword"
|
||||||
|
size="small"
|
||||||
|
placeholder="请输入关键词"
|
||||||
|
clearable
|
||||||
|
class="filter-item"
|
||||||
|
style="width: 200px;margin-left: 10px;"
|
||||||
|
/>
|
||||||
|
<el-button-group style="margin-left: 10px;">
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
class="filter-item"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
@click="search"
|
||||||
|
>
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
class="filter-item"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-refresh"
|
||||||
|
@click="refresh"
|
||||||
|
>
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
|
</el-button-group>
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
class="filter-item"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
style="margin-left: 10px;"
|
||||||
|
@click="add"
|
||||||
|
>
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="listLoading"
|
||||||
|
:data="list"
|
||||||
|
element-loading-text="Loading"
|
||||||
|
border
|
||||||
|
fit
|
||||||
|
height="100%"
|
||||||
|
class="table-container"
|
||||||
|
highlight-current-row
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="序号"
|
||||||
|
width="150"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.$index+1 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label=""
|
||||||
|
width="160"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.historyId }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="博主id"
|
||||||
|
width="160"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.authorId }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="博主名"
|
||||||
|
width="160"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.aurhorName }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="搜索内容"
|
||||||
|
width="160"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.content }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="0正常 1删除"
|
||||||
|
width="160"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.deleted }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
width="160"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.createTime }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
fixed="right"
|
||||||
|
label="操作"
|
||||||
|
width="200"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button-group>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
@click="edit(scope)"
|
||||||
|
>
|
||||||
|
修改
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
@click="del(scope)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</el-button-group>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
:total="total"
|
||||||
|
:page.sync="listQuery.page"
|
||||||
|
:limit.sync="listQuery.limit"
|
||||||
|
@pagination="fetchData"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<add-form ref="addForm" @ok="addOk" />
|
||||||
|
<edit-form ref="editForm" @ok="editOk" />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {getHistoryPage,deleteHistory} from "@/api/business/history/history";
|
||||||
|
import {deepClone,success} from "@/utils";
|
||||||
|
|
||||||
|
import confirm from "@/utils/confirm";
|
||||||
|
import Pagination from '@/components/Pagination'
|
||||||
|
import addForm from "@/views/business/history/addHistory";
|
||||||
|
import editForm from "@/views/business/history/editHistory";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'history',
|
||||||
|
components: {addForm,editForm,Pagination},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
total: 0,
|
||||||
|
list: [],
|
||||||
|
listLoading: true,
|
||||||
|
listQuery: {
|
||||||
|
page: 1,
|
||||||
|
limit: 50,
|
||||||
|
keyword: ''
|
||||||
|
},
|
||||||
|
temp: {},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
search() {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
refresh() {
|
||||||
|
this.listQuery = this.$options.data().listQuery
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
fetchData() {
|
||||||
|
this.listLoading = true
|
||||||
|
getHistoryPage(this.listQuery).then(response => {
|
||||||
|
const { records, total } = response.data
|
||||||
|
this.list = records
|
||||||
|
this.total = total
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
add(){
|
||||||
|
this.$refs.addForm.open()
|
||||||
|
},
|
||||||
|
addOk(){
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
edit(scope) {
|
||||||
|
const temp = deepClone(scope.row)
|
||||||
|
this.$refs.editForm.open(temp)
|
||||||
|
},
|
||||||
|
editOk(){
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
del(scope) {
|
||||||
|
confirm("确定要删除吗?").then(res=>{
|
||||||
|
if(res){
|
||||||
|
deleteHistory(scope.row.historyId).then(response => {
|
||||||
|
console.log(response)
|
||||||
|
success('删除成功')
|
||||||
|
this.fetchData()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
@ -144,9 +144,9 @@
|
|||||||
//等于1时执行页面滚动操作
|
//等于1时执行页面滚动操作
|
||||||
if(this.contact.page==res.data.pages){
|
if(this.contact.page==res.data.pages){
|
||||||
console.log('相等了')
|
console.log('相等了')
|
||||||
next(messages,true);
|
next(messages.reverse(),true);
|
||||||
}else{
|
}else{
|
||||||
next(messages,false);
|
next(messages.reverse(),false);
|
||||||
}
|
}
|
||||||
this.contact.page++
|
this.contact.page++
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user