Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
|
9100c76db4 | |
|
a5f16646d4 | |
|
11871c4b02 | |
|
cd8a13e2d9 | |
|
9c612b837c |
|
@ -52,6 +52,7 @@
|
||||||
<artifactId>muyu-common-security</artifactId>
|
<artifactId>muyu-common-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class CacheConstants {
|
||||||
/**
|
/**
|
||||||
* 密码锁定时间,默认10(分钟)
|
* 密码锁定时间,默认10(分钟)
|
||||||
*/
|
*/
|
||||||
public final static long PASSWORD_LOCK_TIME = 10;
|
public final static long PASSWORD_LOCK_TIME = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限缓存前缀
|
* 权限缓存前缀
|
||||||
|
|
|
@ -88,6 +88,12 @@
|
||||||
<version>${swagger.fox.version}</version>
|
<version>${swagger.fox.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.csp</groupId>
|
||||||
|
<artifactId>sentinel-core</artifactId>
|
||||||
|
<version>1.8.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
@ -28,12 +28,12 @@ spring:
|
||||||
eager: true
|
eager: true
|
||||||
transport:
|
transport:
|
||||||
# 控制台地址
|
# 控制台地址
|
||||||
dashboard: 127.0.0.1:8718
|
dashboard: 43.142.100.73:8719
|
||||||
# nacos配置持久化
|
# nacos配置持久化
|
||||||
datasource:
|
datasource:
|
||||||
ds1:
|
ds1:
|
||||||
nacos:
|
nacos:
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
dataId: sentinel-muyu-gateway
|
dataId: sentinel-muyu-gateway
|
||||||
groupId: DEFAULT_GROUP
|
groupId: DEFAULT_GROUP
|
||||||
data-type: json
|
data-type: json
|
||||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -78,6 +78,16 @@
|
||||||
<artifactId>muyu-common-swagger</artifactId>
|
<artifactId>muyu-common-swagger</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- sentinel流量监控-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.csp</groupId>
|
||||||
|
<artifactId>sentinel-core</artifactId>
|
||||||
|
<version>1.8.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.csp</groupId>
|
||||||
|
<artifactId>sentinel-annotation-aspectj</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
package com.muyu.system.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.alibaba.csp.sentinel.Entry;
|
||||||
|
import com.alibaba.csp.sentinel.SphU;
|
||||||
|
import com.alibaba.csp.sentinel.slots.block.BlockException;
|
||||||
|
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.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.system.domain.BookInfo;
|
||||||
|
import com.muyu.system.service.IBookInfoService;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 书籍Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-02-23
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/info")
|
||||||
|
public class BookInfoController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IBookInfoService bookInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:info:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<BookInfo>> list(BookInfo bookInfo)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<BookInfo> list = bookInfoService.selectBookInfoList(bookInfo);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出导出列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:info:export")
|
||||||
|
@Log(title = "导出", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, BookInfo bookInfo)
|
||||||
|
{
|
||||||
|
List<BookInfo> list = bookInfoService.selectBookInfoList(bookInfo);
|
||||||
|
ExcelUtil<BookInfo> util = new ExcelUtil<BookInfo>(BookInfo.class);
|
||||||
|
util.exportExcel(response, list, "bookInfo数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取书籍详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:info:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(bookInfoService.selectBookInfoById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增bookInfo
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:info:add")
|
||||||
|
@Log(title = "书籍添加", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@RequestBody BookInfo bookInfo)
|
||||||
|
{
|
||||||
|
return toAjax(bookInfoService.insertBookInfo(bookInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:info:edit")
|
||||||
|
@Log(title = "书记修改", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody BookInfo bookInfo)
|
||||||
|
{
|
||||||
|
return toAjax(bookInfoService.updateBookInfo(bookInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:info:remove")
|
||||||
|
@Log(title = "书记修改", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(bookInfoService.deleteBookInfoByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,128 @@
|
||||||
|
package com.muyu.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName BookInfo
|
||||||
|
* @Description 描述
|
||||||
|
* @Author SaiSai.Liu
|
||||||
|
* @Date 2024/2/22/0022 20:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("book_info")
|
||||||
|
public class BookInfo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
@Excel(name="编号", cellType = Excel.ColumnType.NUMERIC)
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作者
|
||||||
|
*/
|
||||||
|
@Excel(name="作者")
|
||||||
|
private String author;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 书名
|
||||||
|
*/
|
||||||
|
@Excel(name="书名")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 书名
|
||||||
|
*/
|
||||||
|
@Excel(name="书名")
|
||||||
|
private String remak;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
@Excel(name = "类型", readConverterExp = "1=名著,2=小说")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片上传
|
||||||
|
*/
|
||||||
|
@Excel(name="图片上传")
|
||||||
|
private String images;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述信息
|
||||||
|
*/
|
||||||
|
@Excel(name="描述信息")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上架时间
|
||||||
|
*/
|
||||||
|
@Excel(name="上架时间")
|
||||||
|
private String grounding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@Excel(name="创建人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@Excel(name="说明")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Excel(name="创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:dd:ss",timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@Excel(name="修改时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:dd:ss",timezone = "GMT+8")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@Excel(name="修改时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:dd:ss",timezone = "GMT+8")
|
||||||
|
private Date beginTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@Excel(name="修改时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:dd:ss",timezone = "GMT+8")
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
//package com.muyu.product.entity;
|
||||||
|
//
|
||||||
|
//import io.swagger.annotations.ApiModel;
|
||||||
|
//import io.swagger.annotations.ApiModelProperty;
|
||||||
|
//import javax.persistence.*;
|
||||||
|
//import java.io.Serializable;
|
||||||
|
//import java.util.Date;
|
||||||
|
//import lombok.AllArgsConstructor;
|
||||||
|
//import lombok.Data;
|
||||||
|
//import lombok.EqualsAndHashCode;
|
||||||
|
//import lombok.NoArgsConstructor;
|
||||||
|
//import lombok.experimental.SuperBuilder;
|
||||||
|
//import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
//import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
//import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 品类信息;
|
||||||
|
// * @author : http://www.chiner.pro
|
||||||
|
// * @date : 2024-2-24
|
||||||
|
// */
|
||||||
|
//@Data
|
||||||
|
//@SuperBuilder
|
||||||
|
//@NoArgsConstructor
|
||||||
|
//@AllArgsConstructor
|
||||||
|
//@EqualsAndHashCode(callSuper = true)
|
||||||
|
//@ApiModel(value = "品类信息")
|
||||||
|
//@TableName("category_info")
|
||||||
|
//public class CategoryInfo implements Serializable,Cloneable{
|
||||||
|
// /** 主键 */
|
||||||
|
// @TableId( type = IdType.AUTO)
|
||||||
|
// @GeneratedValue
|
||||||
|
// @ApiModelProperty(name = "主键")
|
||||||
|
// private id ;
|
||||||
|
// /** 品类名称 */
|
||||||
|
// @ApiModelProperty(name = "品类名称")
|
||||||
|
// private String name ;
|
||||||
|
// /** 图片 */
|
||||||
|
// @ApiModelProperty(name = "图片")
|
||||||
|
// private String image ;
|
||||||
|
// /** 父级品类 */
|
||||||
|
// @ApiModelProperty(name = "父级品类")
|
||||||
|
// private parentId ;
|
||||||
|
// /** 是否启用 */
|
||||||
|
// @ApiModelProperty(name = "是否启用")
|
||||||
|
// private String status ;
|
||||||
|
// /** 备注 */
|
||||||
|
// @ApiModelProperty(name = "备注")
|
||||||
|
// private String remark ;
|
||||||
|
// /** 创建人 */
|
||||||
|
// @ApiModelProperty(name = "创建人")
|
||||||
|
// private String createBy ;
|
||||||
|
// /** 创建时间 */
|
||||||
|
// @ApiModelProperty(name = "创建时间")
|
||||||
|
// private Date createTime ;
|
||||||
|
// /** 更新人 */
|
||||||
|
// @ApiModelProperty(name = "更新人")
|
||||||
|
// private String updateBy ;
|
||||||
|
// /** 更新时间 */
|
||||||
|
// @ApiModelProperty(name = "更新时间")
|
||||||
|
// private Date updateTime ;
|
||||||
|
//
|
||||||
|
//}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.muyu.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.system.domain.BookInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-02-23
|
||||||
|
*/
|
||||||
|
public interface BookInfoMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BookInfo selectBookInfoById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*
|
||||||
|
* @param bookInfo
|
||||||
|
* @return 集合
|
||||||
|
*/
|
||||||
|
public List<BookInfo> selectBookInfoList(BookInfo bookInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*
|
||||||
|
* @param bookInfo
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBookInfo(BookInfo bookInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*
|
||||||
|
* @param bookInfo
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBookInfo(BookInfo bookInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBookInfoById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBookInfoByIds(Long[] ids);
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.muyu.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.system.domain.BookInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bookInfoService接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-02-23
|
||||||
|
*/
|
||||||
|
public interface IBookInfoService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询bookInfo
|
||||||
|
*
|
||||||
|
* @param id bookInfo主键
|
||||||
|
* @return bookInfo
|
||||||
|
*/
|
||||||
|
public BookInfo selectBookInfoById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询bookInfo列表
|
||||||
|
*
|
||||||
|
* @param bookInfo bookInfo
|
||||||
|
* @return bookInfo集合
|
||||||
|
*/
|
||||||
|
public List<BookInfo> selectBookInfoList(BookInfo bookInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增bookInfo
|
||||||
|
*
|
||||||
|
* @param bookInfo bookInfo
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBookInfo(BookInfo bookInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改bookInfo
|
||||||
|
*
|
||||||
|
* @param bookInfo bookInfo
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBookInfo(BookInfo bookInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除bookInfo
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的bookInfo主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBookInfoByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除bookInfo信息
|
||||||
|
*
|
||||||
|
* @param id bookInfo主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBookInfoById(Long id);
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.muyu.system.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.csp.sentinel.EntryType;
|
||||||
|
import com.alibaba.csp.sentinel.annotation.SentinelResource;
|
||||||
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.system.domain.BookInfo;
|
||||||
|
import com.muyu.system.mapper.BookInfoMapper;
|
||||||
|
import com.muyu.system.service.IBookInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bookInfoService业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-02-23
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BookInfoServiceImpl implements IBookInfoService {
|
||||||
|
@Autowired
|
||||||
|
private BookInfoMapper bookInfoMapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询bookInfo
|
||||||
|
*
|
||||||
|
* @param id bookInfo主键
|
||||||
|
* @return bookInfo
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BookInfo selectBookInfoById(Long id) {
|
||||||
|
return bookInfoMapper.selectBookInfoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询bookInfo列表
|
||||||
|
*
|
||||||
|
* @param bookInfo bookInfo
|
||||||
|
* @return bookInfo
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@SentinelResource(value = "selectBookInfoList", entryType = EntryType.IN)
|
||||||
|
public List<BookInfo> selectBookInfoList(BookInfo bookInfo) {
|
||||||
|
bookInfo.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
return bookInfoMapper.selectBookInfoList(bookInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增bookInfo
|
||||||
|
*
|
||||||
|
* @param bookInfo bookInfo
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertBookInfo(BookInfo bookInfo) {
|
||||||
|
bookInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
|
bookInfo.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
return bookInfoMapper.insertBookInfo(bookInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改bookInfo
|
||||||
|
*
|
||||||
|
* @param bookInfo bookInfo
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateBookInfo(BookInfo bookInfo) {
|
||||||
|
bookInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
bookInfo.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
return bookInfoMapper.updateBookInfo(bookInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除bookInfo
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的bookInfo主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBookInfoByIds(Long[] ids) {
|
||||||
|
return bookInfoMapper.deleteBookInfoByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除bookInfo信息
|
||||||
|
*
|
||||||
|
* @param id bookInfo主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBookInfoById(Long id) {
|
||||||
|
return bookInfoMapper.deleteBookInfoById(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,10 +14,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
<?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.muyu.system.mapper.BookInfoMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.system.domain.BookInfo" id="BookInfoResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="title" column="title" />
|
||||||
|
<result property="author" column="author" />
|
||||||
|
<result property="type" column="type" />
|
||||||
|
<result property="images" column="images" />
|
||||||
|
<result property="remak" column="remak" />
|
||||||
|
<result property="content" column="content" />
|
||||||
|
<result property="grounding" column="grounding" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBookInfoVo">
|
||||||
|
select id, title, author, type, images, remak, content, grounding, create_by, create_time, update_time, update_by from book_info
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectBookInfoList" parameterType="com.muyu.system.domain.BookInfo" resultMap="BookInfoResult">
|
||||||
|
<include refid="selectBookInfoVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="title != null and title != ''"> and title = #{title}</if>
|
||||||
|
<if test="author != null and author != ''"> and author = #{author}</if>
|
||||||
|
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||||
|
<if test="images != null and images != ''"> and images = #{images}</if>
|
||||||
|
<if test="createBy != null and createBy != '' and createBy != 'admin'"> and create_by = #{createBy}</if>
|
||||||
|
<if test="remak != null and remak != ''"> and remak = #{remak}</if>
|
||||||
|
<if test="content != null and content != ''"> and content = #{content}</if>
|
||||||
|
<if test="grounding != null and grounding != ''"> and grounding = #{grounding}</if>
|
||||||
|
<if test="beginTime != null "> and grounding > #{beginTime}</if>
|
||||||
|
<if test="endTime != null "> and grounding lt; #{endTime}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBookInfoById" parameterType="Long" resultMap="BookInfoResult">
|
||||||
|
<include refid="selectBookInfoVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertBookInfo" parameterType="com.muyu.system.domain.BookInfo" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into book_info
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="title != null">title,</if>
|
||||||
|
<if test="author != null and author != ''">author,</if>
|
||||||
|
<if test="type != null and type != ''">type,</if>
|
||||||
|
<if test="images != null and images != ''">images,</if>
|
||||||
|
<if test="remak != null">remak,</if>
|
||||||
|
<if test="content != null">content,</if>
|
||||||
|
<if test="grounding != null and grounding != ''">grounding,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="title != null">#{title},</if>
|
||||||
|
<if test="author != null and author != ''">#{author},</if>
|
||||||
|
<if test="type != null and type != ''">#{type},</if>
|
||||||
|
<if test="images != null and images != ''">#{images},</if>
|
||||||
|
<if test="remak != null">#{remak},</if>
|
||||||
|
<if test="content != null">#{content},</if>
|
||||||
|
<if test="grounding != null and grounding != ''">#{grounding},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateBookInfo" parameterType="com.muyu.system.domain.BookInfo">
|
||||||
|
update book_info
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="title != null">title = #{title},</if>
|
||||||
|
<if test="author != null and author != ''">author = #{author},</if>
|
||||||
|
<if test="type != null and type != ''">type = #{type},</if>
|
||||||
|
<if test="images != null and images != ''">images = #{images},</if>
|
||||||
|
<if test="remak != null">remak = #{remak},</if>
|
||||||
|
<if test="content != null">content = #{content},</if>
|
||||||
|
<if test="grounding != null and grounding != ''">grounding = #{grounding},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = now(),</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteBookInfoById" parameterType="Long">
|
||||||
|
delete from book_info where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteBookInfoByIds" parameterType="String">
|
||||||
|
delete from book_info where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -14,10 +14,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 43.142.100.73:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
Loading…
Reference in New Issue