完成笔记模块后台
This commit is contained in:
parent
2e054b0966
commit
2d1f8141bf
36
src/main/java/com/dd/admin/business/api/ApiController.java
Normal file
36
src/main/java/com/dd/admin/business/api/ApiController.java
Normal file
@ -0,0 +1,36 @@
|
||||
package com.dd.admin.business.api;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.dd.admin.business.card.domain.CardDto;
|
||||
import com.dd.admin.business.card.domain.CardVo;
|
||||
import com.dd.admin.business.note.domain.NoteDto;
|
||||
import com.dd.admin.business.note.domain.NoteVo;
|
||||
import com.dd.admin.business.note.entity.Note;
|
||||
import com.dd.admin.business.note.service.NoteService;
|
||||
import com.dd.admin.common.aop.operationLog.aop.OperLog;
|
||||
import com.dd.admin.common.aop.operationLog.aop.OperType;
|
||||
import com.dd.admin.common.model.result.ResultBean;
|
||||
import com.dd.admin.common.security.SecurityUtil;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
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.RestController;
|
||||
|
||||
@RestController
|
||||
public class ApiController {
|
||||
@Autowired
|
||||
NoteService noteService;
|
||||
|
||||
@ApiOperation(value = "获取所有笔记")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/api/notes")
|
||||
@OperLog(operModule = "获取所有笔记",operType = OperType.QUERY,operDesc = "获取所有笔记")
|
||||
public ResultBean<IPage<NoteVo>> page(NoteDto noteDto) {
|
||||
IPage<NoteVo> pageInfo = noteService.selectNotePage(noteDto);
|
||||
return ResultBean.success(pageInfo);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package com.dd.admin.business.note.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.note.entity.Note;
|
||||
import com.dd.admin.business.note.domain.NoteVo;
|
||||
import com.dd.admin.business.note.domain.NoteDto;
|
||||
import com.dd.admin.business.note.service.NoteService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 笔记表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
@Api(tags = "笔记表")
|
||||
@RestController
|
||||
public class NoteController {
|
||||
|
||||
@Autowired
|
||||
NoteService noteService;
|
||||
|
||||
@ApiOperation(value = "笔记表-分页列表")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/admin/note/page")
|
||||
public ResultBean<IPage<NoteVo>> page(NoteDto noteDto) {
|
||||
IPage<NoteVo> pageInfo = noteService.selectNotePage(noteDto);
|
||||
return ResultBean.success(pageInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "笔记表-列表")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@GetMapping("/admin/note/list")
|
||||
public ResultBean<List<NoteVo>> list(NoteDto noteDto) {
|
||||
List<NoteVo> list = noteService.selectNoteList(noteDto);
|
||||
return ResultBean.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "笔记表-添加")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@PostMapping("/admin/note/add")
|
||||
public ResultBean<Note> add(@RequestBody @Validated NoteDto noteDto) {
|
||||
Note note = BeanUtil.copyProperties(noteDto, Note.class);
|
||||
noteService.save(note);
|
||||
return ResultBean.success(note);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "笔记表-查询")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@GetMapping("/admin/note/{noteId}")
|
||||
public ResultBean<NoteVo> get(@PathVariable @NotBlank String noteId) {
|
||||
Note note = noteService.getById(noteId);
|
||||
NoteVo noteVo = BeanUtil.copyProperties(note,NoteVo.class);
|
||||
return ResultBean.success(noteVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "笔记表-修改")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@PostMapping("/admin/note/update")
|
||||
public ResultBean<Note> update(@RequestBody @Validated(UpdateGroup.class) NoteDto noteDto) {
|
||||
Note note = BeanUtil.copyProperties(noteDto, Note.class);
|
||||
noteService.updateById(note);
|
||||
return ResultBean.success(note);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "笔记表-删除")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@GetMapping("/admin/note/delete/{noteId}")
|
||||
public ResultBean<Note> delete(@PathVariable @NotBlank String noteId) {
|
||||
Boolean b = noteService.removeById(noteId);
|
||||
return ResultBean.success(b);
|
||||
}
|
||||
}
|
89
src/main/java/com/dd/admin/business/note/domain/NoteDto.java
Normal file
89
src/main/java/com/dd/admin/business/note/domain/NoteDto.java
Normal file
@ -0,0 +1,89 @@
|
||||
package com.dd.admin.business.note.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 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="笔记表接收对象")
|
||||
public class NoteDto {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "笔记id")
|
||||
@NotBlank(message = "笔记表id不能为空",groups = UpdateGroup.class)
|
||||
private String noteId;
|
||||
|
||||
@ApiModelProperty(value = "笔记标题")
|
||||
private String noteTitle;
|
||||
|
||||
@ApiModelProperty(value = "笔记内容")
|
||||
private String noteContent;
|
||||
|
||||
@ApiModelProperty(value = "类型id")
|
||||
private String noteCategory;
|
||||
|
||||
@ApiModelProperty(value = "笔记类型名")
|
||||
private String noteCategoryName;
|
||||
|
||||
@ApiModelProperty(value = "1 图文 2视频 3文字")
|
||||
private Integer noteType;
|
||||
|
||||
@ApiModelProperty(value = "作者ID")
|
||||
private String authorId;
|
||||
|
||||
@ApiModelProperty(value = "作者头像")
|
||||
private String authorAvatar;
|
||||
|
||||
@ApiModelProperty(value = "作者名字")
|
||||
private String authorName;
|
||||
|
||||
@ApiModelProperty(value = "首图URL")
|
||||
private String firstPicture;
|
||||
|
||||
@ApiModelProperty(value = "乐观锁字段")
|
||||
private Long version;
|
||||
|
||||
@ApiModelProperty(value = "0正常 1删除")
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "ip地址")
|
||||
private String ipAddress;
|
||||
|
||||
@ApiModelProperty(value = "真实ip地址")
|
||||
private String ipRealAddress;
|
||||
|
||||
@ApiModelProperty(value = "点赞数")
|
||||
private Long upCount;
|
||||
|
||||
@ApiModelProperty(value = "收藏数")
|
||||
private Long starCount;
|
||||
|
||||
|
||||
}
|
91
src/main/java/com/dd/admin/business/note/domain/NoteVo.java
Normal file
91
src/main/java/com/dd/admin/business/note/domain/NoteVo.java
Normal file
@ -0,0 +1,91 @@
|
||||
package com.dd.admin.business.note.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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 笔记表返回对象
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="笔记表返回对象")
|
||||
public class NoteVo {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "笔记id")
|
||||
private String noteId;
|
||||
|
||||
@ApiModelProperty(value = "笔记标题")
|
||||
private String noteTitle;
|
||||
|
||||
@ApiModelProperty(value = "笔记内容")
|
||||
private String noteContent;
|
||||
|
||||
@ApiModelProperty(value = "类型id")
|
||||
private String noteCategory;
|
||||
|
||||
@ApiModelProperty(value = "笔记类型名")
|
||||
private String noteCategoryName;
|
||||
|
||||
@ApiModelProperty(value = "1 图文 2视频 3文字")
|
||||
private Integer noteType;
|
||||
|
||||
@ApiModelProperty(value = "作者ID")
|
||||
private String authorId;
|
||||
|
||||
@ApiModelProperty(value = "作者头像")
|
||||
private String authorAvatar;
|
||||
|
||||
@ApiModelProperty(value = "作者名字")
|
||||
private String authorName;
|
||||
|
||||
@ApiModelProperty(value = "首图URL")
|
||||
private String firstPicture;
|
||||
|
||||
@ApiModelProperty(value = "乐观锁字段")
|
||||
private Long version;
|
||||
|
||||
@ApiModelProperty(value = "0正常 1删除")
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern="MM-dd", timezone = "GMT+8")
|
||||
private Date createTimeStr;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "ip地址")
|
||||
private String ipAddress;
|
||||
|
||||
@ApiModelProperty(value = "真实ip地址")
|
||||
private String ipRealAddress;
|
||||
|
||||
@ApiModelProperty(value = "点赞数")
|
||||
private Long upCount;
|
||||
|
||||
@ApiModelProperty(value = "收藏数")
|
||||
private Long starCount;
|
||||
|
||||
|
||||
}
|
108
src/main/java/com/dd/admin/business/note/entity/Note.java
Normal file
108
src/main/java/com/dd/admin/business/note/entity/Note.java
Normal file
@ -0,0 +1,108 @@
|
||||
package com.dd.admin.business.note.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 2024-12-09
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("business_note")
|
||||
@ApiModel(value="Note对象", description="笔记表")
|
||||
public class Note implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "笔记id")
|
||||
@TableId(value = "NOTE_ID", type = IdType.ASSIGN_UUID)
|
||||
private String noteId;
|
||||
|
||||
@ApiModelProperty(value = "笔记标题")
|
||||
@TableField("NOTE_TITLE")
|
||||
private String noteTitle;
|
||||
|
||||
@ApiModelProperty(value = "笔记内容")
|
||||
@TableField("NOTE_CONTENT")
|
||||
private String noteContent;
|
||||
|
||||
@ApiModelProperty(value = "类型id")
|
||||
@TableField("NOTE_CATEGORY")
|
||||
private String noteCategory;
|
||||
|
||||
@ApiModelProperty(value = "笔记类型名")
|
||||
@TableField("NOTE_CATEGORY_NAME")
|
||||
private String noteCategoryName;
|
||||
|
||||
@ApiModelProperty(value = "1 图文 2视频 3文字")
|
||||
@TableField("NOTE_TYPE")
|
||||
private Integer noteType;
|
||||
|
||||
@ApiModelProperty(value = "作者ID")
|
||||
@TableField("AUTHOR_ID")
|
||||
private String authorId;
|
||||
|
||||
@ApiModelProperty(value = "作者头像")
|
||||
@TableField("AUTHOR_AVATAR")
|
||||
private String authorAvatar;
|
||||
|
||||
@ApiModelProperty(value = "作者名字")
|
||||
@TableField("AUTHOR_NAME")
|
||||
private String authorName;
|
||||
|
||||
@ApiModelProperty(value = "首图URL")
|
||||
@TableField("FIRST_PICTURE")
|
||||
private String firstPicture;
|
||||
|
||||
@ApiModelProperty(value = "乐观锁字段")
|
||||
@TableField("VERSION")
|
||||
@Version
|
||||
private Long version;
|
||||
|
||||
@ApiModelProperty(value = "0正常 1删除")
|
||||
@TableField("DELETED")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
@TableField(value = "UPDATE_TIME", fill = FieldFill.UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "ip地址")
|
||||
@TableField("IP_ADDRESS")
|
||||
private String ipAddress;
|
||||
|
||||
@ApiModelProperty(value = "真实ip地址")
|
||||
@TableField("IP_REAL_ADDRESS")
|
||||
private String ipRealAddress;
|
||||
|
||||
@ApiModelProperty(value = "点赞数")
|
||||
@TableField("UP_COUNT")
|
||||
private Long upCount;
|
||||
|
||||
@ApiModelProperty(value = "收藏数")
|
||||
@TableField("STAR_COUNT")
|
||||
private Long starCount;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.dd.admin.business.note.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.note.entity.Note;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dd.admin.business.note.domain.NoteVo;
|
||||
import com.dd.admin.business.note.domain.NoteDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 笔记表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
@Mapper
|
||||
public interface NoteMapper extends BaseMapper<Note> {
|
||||
|
||||
IPage<NoteVo> selectNotePage(Page<NoteVo> page, @Param("noteDto") NoteDto noteDto);
|
||||
|
||||
List<NoteVo> selectNoteList(@Param("noteDto") NoteDto noteDto);
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
<?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.note.mapper.NoteMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.dd.admin.business.note.entity.Note">
|
||||
<id column="NOTE_ID" property="noteId" />
|
||||
<result column="NOTE_TITLE" property="noteTitle" />
|
||||
<result column="NOTE_CONTENT" property="noteContent" />
|
||||
<result column="NOTE_CATEGORY" property="noteCategory" />
|
||||
<result column="NOTE_CATEGORY_NAME" property="noteCategoryName" />
|
||||
<result column="NOTE_TYPE" property="noteType" />
|
||||
<result column="AUTHOR_ID" property="authorId" />
|
||||
<result column="AUTHOR_AVATAR" property="authorAvatar" />
|
||||
<result column="AUTHOR_NAME" property="authorName" />
|
||||
<result column="FIRST_PICTURE" property="firstPicture" />
|
||||
<result column="VERSION" property="version" />
|
||||
<result column="DELETED" property="deleted" />
|
||||
<result column="CREATE_TIME" property="createTime" />
|
||||
<result column="UPDATE_TIME" property="updateTime" />
|
||||
<result column="IP_ADDRESS" property="ipAddress" />
|
||||
<result column="IP_REAL_ADDRESS" property="ipRealAddress" />
|
||||
<result column="UP_COUNT" property="upCount" />
|
||||
<result column="STAR_COUNT" property="starCount" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
NOTE_ID, NOTE_TITLE, NOTE_CONTENT, NOTE_CATEGORY, NOTE_CATEGORY_NAME, NOTE_TYPE, AUTHOR_ID, AUTHOR_AVATAR, AUTHOR_NAME, FIRST_PICTURE, VERSION, DELETED, CREATE_TIME, UPDATE_TIME, IP_ADDRESS, IP_REAL_ADDRESS, UP_COUNT, STAR_COUNT
|
||||
</sql>
|
||||
|
||||
<select id="selectNotePage" resultType="com.dd.admin.business.note.domain.NoteVo">
|
||||
select
|
||||
*,CREATE_TIME AS createTimeStr
|
||||
from business_note where 1 = 1
|
||||
order by CREATE_TIME desc
|
||||
</select>
|
||||
|
||||
<select id="selectNoteList" resultType="com.dd.admin.business.note.domain.NoteVo">
|
||||
select
|
||||
*
|
||||
from business_note where 1 = 1
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,26 @@
|
||||
package com.dd.admin.business.note.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.dd.admin.business.note.entity.Note;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dd.admin.business.note.domain.NoteVo;
|
||||
import com.dd.admin.business.note.domain.NoteDto;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 笔记表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
public interface NoteService extends IService<Note> {
|
||||
|
||||
//笔记表-分页列表
|
||||
IPage<NoteVo> selectNotePage(NoteDto noteDto);
|
||||
|
||||
//笔记表-列表
|
||||
List<NoteVo> selectNoteList(NoteDto noteDto);
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.dd.admin.business.note.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.note.entity.Note;
|
||||
import com.dd.admin.business.note.mapper.NoteMapper;
|
||||
import com.dd.admin.business.note.service.NoteService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.dd.admin.business.note.domain.NoteVo;
|
||||
import com.dd.admin.business.note.domain.NoteDto;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 笔记表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2024-12-09
|
||||
*/
|
||||
@Service
|
||||
public class NoteServiceImpl extends ServiceImpl<NoteMapper, Note> implements NoteService {
|
||||
|
||||
@Override
|
||||
public IPage<NoteVo> selectNotePage(NoteDto noteDto) {
|
||||
Page page = PageFactory.defaultPage();
|
||||
return baseMapper.selectNotePage(page,noteDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NoteVo> selectNoteList(NoteDto noteDto) {
|
||||
return baseMapper.selectNoteList(noteDto);
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ spring:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
dd:
|
||||
uploadPath: /www/store/upload/
|
||||
uploadPath: /www/xhs/upload/
|
||||
|
||||
knife4j:
|
||||
enable: true
|
||||
|
@ -7,7 +7,7 @@ spring:
|
||||
|
||||
datasource:
|
||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
||||
url: jdbc:p6spy:mysql://127.0.0.1:3306/dd?useSSL=false&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
|
||||
url: jdbc:p6spy:mysql://127.0.0.1:3306/ddxhs?useSSL=false&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: admin
|
||||
|
||||
@ -39,6 +39,7 @@ jwt:
|
||||
- "/favicon.ico"
|
||||
# 需要过滤的请求,不限方法
|
||||
pattern:
|
||||
- "/api/**"
|
||||
- "/upload/**"
|
||||
- "/doc.html"
|
||||
- "/swagger-resources/**"
|
||||
|
41
web/src/api/business/note/note.js
Normal file
41
web/src/api/business/note/note.js
Normal file
@ -0,0 +1,41 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getNotePage(params) {
|
||||
return request({
|
||||
url: '/admin/note/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function getNoteList(params) {
|
||||
return request({
|
||||
url: '/admin/note/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function addNote(data) {
|
||||
return request({
|
||||
url: '/admin/note/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function editNote(data) {
|
||||
return request({
|
||||
url: '/admin/note/update',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteNote(noteId) {
|
||||
return request({
|
||||
url: '/admin/note/delete/' + noteId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
166
web/src/views/business/note/addNote.vue
Normal file
166
web/src/views/business/note/addNote.vue
Normal file
@ -0,0 +1,166 @@
|
||||
<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="笔记id" prop="noteId" class="is-required">
|
||||
<el-input v-model="temp.noteId" placeholder="笔记id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="笔记标题" prop="noteTitle" class="is-required">
|
||||
<el-input v-model="temp.noteTitle" placeholder="笔记标题" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="笔记内容" prop="noteContent" class="is-required">
|
||||
<el-input v-model="temp.noteContent" placeholder="笔记内容" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="类型id" prop="noteCategory" class="is-required">
|
||||
<el-input v-model="temp.noteCategory" placeholder="类型id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="笔记类型名" prop="noteCategoryName" class="is-required">
|
||||
<el-input v-model="temp.noteCategoryName" placeholder="笔记类型名" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="1 图文 2视频 3文字" prop="noteType" class="is-required">
|
||||
<el-input v-model="temp.noteType" placeholder="1 图文 2视频 3文字" />
|
||||
</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="authorAvatar" class="is-required">
|
||||
<el-input v-model="temp.authorAvatar" placeholder="作者头像" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="作者名字" prop="authorName" class="is-required">
|
||||
<el-input v-model="temp.authorName" placeholder="作者名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="首图URL" prop="firstPicture" class="is-required">
|
||||
<el-input v-model="temp.firstPicture" placeholder="首图URL" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="乐观锁字段" prop="version" class="is-required">
|
||||
<el-input v-model="temp.version" 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-item label="修改时间" prop="updateTime" class="is-required">
|
||||
<el-input v-model="temp.updateTime" placeholder="修改时间" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="ip地址" prop="ipAddress" class="is-required">
|
||||
<el-input v-model="temp.ipAddress" placeholder="ip地址" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="真实ip地址" prop="ipRealAddress" class="is-required">
|
||||
<el-input v-model="temp.ipRealAddress" placeholder="真实ip地址" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="点赞数" prop="upCount" class="is-required">
|
||||
<el-input v-model="temp.upCount" placeholder="点赞数" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="收藏数" prop="starCount" class="is-required">
|
||||
<el-input v-model="temp.starCount" 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 {addNote} from "@/api/business/note/note";
|
||||
import {setRequiredFields} from "@/utils";
|
||||
const requiredFields = []
|
||||
export default {
|
||||
name: "addForm",
|
||||
data() {
|
||||
return {
|
||||
rules: setRequiredFields(requiredFields),
|
||||
dialogVisible: false,
|
||||
temp: {
|
||||
noteId:'',
|
||||
noteTitle:'',
|
||||
noteContent:'',
|
||||
noteCategory:'',
|
||||
noteCategoryName:'',
|
||||
noteType:'',
|
||||
authorId:'',
|
||||
authorAvatar:'',
|
||||
authorName:'',
|
||||
firstPicture:'',
|
||||
version:'',
|
||||
deleted:'',
|
||||
createTime:'',
|
||||
updateTime:'',
|
||||
ipAddress:'',
|
||||
ipRealAddress:'',
|
||||
upCount:'',
|
||||
starCount:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.dialogVisible = true
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
addNote(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>
|
167
web/src/views/business/note/editNote.vue
Normal file
167
web/src/views/business/note/editNote.vue
Normal file
@ -0,0 +1,167 @@
|
||||
<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="笔记id" prop="noteId" class="is-required">
|
||||
<el-input v-model="temp.noteId" placeholder="笔记id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="笔记标题" prop="noteTitle" class="is-required">
|
||||
<el-input v-model="temp.noteTitle" placeholder="笔记标题" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="笔记内容" prop="noteContent" class="is-required">
|
||||
<el-input v-model="temp.noteContent" placeholder="笔记内容" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="类型id" prop="noteCategory" class="is-required">
|
||||
<el-input v-model="temp.noteCategory" placeholder="类型id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="笔记类型名" prop="noteCategoryName" class="is-required">
|
||||
<el-input v-model="temp.noteCategoryName" placeholder="笔记类型名" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="1 图文 2视频 3文字" prop="noteType" class="is-required">
|
||||
<el-input v-model="temp.noteType" placeholder="1 图文 2视频 3文字" />
|
||||
</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="authorAvatar" class="is-required">
|
||||
<el-input v-model="temp.authorAvatar" placeholder="作者头像" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="作者名字" prop="authorName" class="is-required">
|
||||
<el-input v-model="temp.authorName" placeholder="作者名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="首图URL" prop="firstPicture" class="is-required">
|
||||
<el-input v-model="temp.firstPicture" placeholder="首图URL" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="乐观锁字段" prop="version" class="is-required">
|
||||
<el-input v-model="temp.version" 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-item label="修改时间" prop="updateTime" class="is-required">
|
||||
<el-input v-model="temp.updateTime" placeholder="修改时间" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="ip地址" prop="ipAddress" class="is-required">
|
||||
<el-input v-model="temp.ipAddress" placeholder="ip地址" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="真实ip地址" prop="ipRealAddress" class="is-required">
|
||||
<el-input v-model="temp.ipRealAddress" placeholder="真实ip地址" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="点赞数" prop="upCount" class="is-required">
|
||||
<el-input v-model="temp.upCount" placeholder="点赞数" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="收藏数" prop="starCount" class="is-required">
|
||||
<el-input v-model="temp.starCount" 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 { editNote } from "@/api/business/note/note";
|
||||
import {setRequiredFields} from "@/utils";
|
||||
const requiredFields = []
|
||||
|
||||
export default {
|
||||
name: "editForm",
|
||||
data() {
|
||||
return {
|
||||
rules: setRequiredFields(requiredFields),
|
||||
dialogVisible: false,
|
||||
temp: {
|
||||
noteId:'',
|
||||
noteTitle:'',
|
||||
noteContent:'',
|
||||
noteCategory:'',
|
||||
noteCategoryName:'',
|
||||
noteType:'',
|
||||
authorId:'',
|
||||
authorAvatar:'',
|
||||
authorName:'',
|
||||
firstPicture:'',
|
||||
version:'',
|
||||
deleted:'',
|
||||
createTime:'',
|
||||
updateTime:'',
|
||||
ipAddress:'',
|
||||
ipRealAddress:'',
|
||||
upCount:'',
|
||||
starCount:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(row) {
|
||||
this.temp = this.$options.data().temp
|
||||
this.temp = row
|
||||
this.dialogVisible = true
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
editNote(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>
|
363
web/src/views/business/note/noteList.vue
Normal file
363
web/src/views/business/note/noteList.vue
Normal file
@ -0,0 +1,363 @@
|
||||
<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="笔记id"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.noteId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="笔记标题"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.noteTitle }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="笔记内容"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.noteContent }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="类型id"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.noteCategory }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="笔记类型名"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.noteCategoryName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="1 图文 2视频 3文字"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.noteType }}
|
||||
</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.authorAvatar }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="作者名字"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.authorName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="首图URL"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.firstPicture }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="乐观锁字段"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.version }}
|
||||
</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
|
||||
label="修改时间"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.updateTime }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="ip地址"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.ipAddress }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="真实ip地址"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.ipRealAddress }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="点赞数"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.upCount }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="收藏数"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.starCount }}
|
||||
</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 {getNotePage,deleteNote} from "@/api/business/note/note";
|
||||
import {deepClone,success} from "@/utils";
|
||||
|
||||
import confirm from "@/utils/confirm";
|
||||
import Pagination from '@/components/Pagination'
|
||||
import addForm from "@/views/business/note/addNote";
|
||||
import editForm from "@/views/business/note/editNote";
|
||||
|
||||
export default {
|
||||
name: 'note',
|
||||
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
|
||||
getNotePage(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){
|
||||
deleteNote(scope.row.noteId).then(response => {
|
||||
console.log(response)
|
||||
success('删除成功')
|
||||
this.fetchData()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user