Compare commits

..

5 Commits

Author SHA1 Message Date
Saisai Liu 9100c76db4 区间查询,sentinel卫兵链接服务器 2024-02-26 09:15:48 +08:00
Saisai Liu a5f16646d4 book单表 2024-02-25 20:46:27 +08:00
Saisai Liu 11871c4b02 book单表 2024-02-25 11:09:17 +08:00
Saisai Liu cd8a13e2d9 book单表 2024-02-23 21:26:11 +08:00
Saisai Liu 9c612b837c book单表 2024-02-23 16:17:24 +08:00
19 changed files with 659 additions and 17 deletions

View File

@ -52,6 +52,7 @@
<artifactId>muyu-common-security</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -24,7 +24,7 @@ public class CacheConstants {
/**
* 10
*/
public final static long PASSWORD_LOCK_TIME = 10;
public final static long PASSWORD_LOCK_TIME = 3;
/**
*

View File

@ -88,6 +88,12 @@
<version>${swagger.fox.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-core</artifactId>
<version>1.8.7</version>
</dependency>
</dependencies>
<build>

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
# 配置文件格式
file-extension: yml
# 共享配置
@ -28,12 +28,12 @@ spring:
eager: true
transport:
# 控制台地址
dashboard: 127.0.0.1:8718
dashboard: 43.142.100.73:8719
# nacos配置持久化
datasource:
ds1:
nacos:
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
dataId: sentinel-muyu-gateway
groupId: DEFAULT_GROUP
data-type: json

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -78,6 +78,16 @@
<artifactId>muyu-common-swagger</artifactId>
</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>
<build>

View File

@ -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));
}
}

View File

@ -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;
}

View File

@ -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 ;
//
//}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -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>

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 43.142.100.73:8848
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -206,6 +206,7 @@
<version>${muyu.version}</version>
</dependency>
</dependencies>
</dependencyManagement>