day01
parent
10341472e9
commit
20b5c5fd6e
|
@ -14,10 +14,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.89.120.67
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.89.120.67
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.89.120.67:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.89.120.67: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: 118.89.120.67:8718
|
||||||
# nacos配置持久化
|
# nacos配置持久化
|
||||||
datasource:
|
datasource:
|
||||||
ds1:
|
ds1:
|
||||||
nacos:
|
nacos:
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.89.120.67: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: 118.89.120.67:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.89.120.67: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: 118.89.120.67:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.89.120.67: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: 118.89.120.67:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.89.120.67:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.muyu.system.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.system.domain.BookInfo;
|
||||||
|
import com.muyu.system.service.BookInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName BookInfoController
|
||||||
|
* @Description 描述
|
||||||
|
* @Author ShiYu.Cui
|
||||||
|
* @Date 2024/2/22 21:04
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/book_info")
|
||||||
|
public class BookInfoController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private BookInfoService bookInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取书籍信息列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:book:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<BookInfo>> list (BookInfo bookInfo) {
|
||||||
|
startPage();
|
||||||
|
List<BookInfo> list = bookInfoService.pageQuery(bookInfo);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增书籍信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:book:add")
|
||||||
|
@Log(title = "书籍管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public Result add (@Validated @RequestBody BookInfo bookInfo) {
|
||||||
|
bookInfo.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
bookInfo.setCreateTime(new Date());
|
||||||
|
return toAjax(bookInfoService.save(bookInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据参数编号获取详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo (@PathVariable Long id) {
|
||||||
|
return success(bookInfoService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改书籍信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:book:edit")
|
||||||
|
@Log(title = "书籍管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public Result edit (@Validated @RequestBody BookInfo bookInfo) {
|
||||||
|
bookInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
bookInfo.setCreateTime(new Date());
|
||||||
|
return toAjax(bookInfoService.updateById(bookInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除参数配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:book:remove")
|
||||||
|
@Log(title = "书籍管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove (@PathVariable Long[] ids) {
|
||||||
|
bookInfoService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
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 ShiYu.Cui
|
||||||
|
* @Date 2024/2/22 20:43
|
||||||
|
*/
|
||||||
|
@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 Long id;
|
||||||
|
@Excel(name = "书籍名称")
|
||||||
|
private String title;
|
||||||
|
@Excel(name = "作者")
|
||||||
|
private String author;
|
||||||
|
@Excel(name = "类型", readConverterExp = "1=小说,2=文艺")
|
||||||
|
private String type;
|
||||||
|
@Excel(name = "图片")
|
||||||
|
private String images;
|
||||||
|
@Excel(name = "书籍描述")
|
||||||
|
private String content;
|
||||||
|
@Excel(name = "上架时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private Date shelTime;
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.muyu.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.system.domain.BookInfo;
|
||||||
|
import com.muyu.system.domain.SysConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName BookInfoMapper
|
||||||
|
* @Description 描述
|
||||||
|
* @Author ShiYu.Cui
|
||||||
|
* @Date 2024/2/22 20:59
|
||||||
|
*/
|
||||||
|
public interface BookInfoMapper extends BaseMapper<BookInfo> {
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.muyu.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.system.domain.BookInfo;
|
||||||
|
import com.muyu.system.domain.SysConfig;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName BookInfoService
|
||||||
|
* @Description 描述
|
||||||
|
* @Author ShiYu.Cui
|
||||||
|
* @Date 2024/2/22 21:01
|
||||||
|
*/
|
||||||
|
public interface BookInfoService extends IService<BookInfo> {
|
||||||
|
List<BookInfo> pageQuery(BookInfo bookInfo);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.muyu.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.system.domain.BookInfo;
|
||||||
|
import com.muyu.system.domain.SysConfig;
|
||||||
|
import com.muyu.system.mapper.BookInfoMapper;
|
||||||
|
import com.muyu.system.mapper.SysConfigMapper;
|
||||||
|
import com.muyu.system.service.BookInfoService;
|
||||||
|
import com.muyu.system.service.SysConfigService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName BookInfoServiceImpl
|
||||||
|
* @Description 描述
|
||||||
|
* @Author ShiYu.Cui
|
||||||
|
* @Date 2024/2/22 21:02
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BookInfoServiceImpl extends ServiceImpl<BookInfoMapper, BookInfo>
|
||||||
|
implements BookInfoService {
|
||||||
|
@Override
|
||||||
|
public List<BookInfo> pageQuery(BookInfo bookInfo) {
|
||||||
|
LambdaQueryWrapper<BookInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if(StringUtils.isNotEmpty(bookInfo.getTitle())){
|
||||||
|
queryWrapper.like(BookInfo::getTitle,bookInfo.getTitle());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotEmpty(bookInfo.getAuthor())){
|
||||||
|
queryWrapper.like(BookInfo::getAuthor,bookInfo.getAuthor());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotEmpty(bookInfo.getType())){
|
||||||
|
queryWrapper.like(BookInfo::getType,bookInfo.getType());
|
||||||
|
}
|
||||||
|
if(Objects.nonNull(bookInfo.getParams().get("beginTime"))
|
||||||
|
&& Objects.nonNull(bookInfo.getParams().get("endTime"))){
|
||||||
|
queryWrapper.between(BookInfo::getShelTime,
|
||||||
|
bookInfo.getParams().get("beginTime"),
|
||||||
|
bookInfo.getParams().get("endTime"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,10 +14,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.89.120.67:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.89.120.67: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: 118.89.120.67:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.89.120.67:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
Loading…
Reference in New Issue