DAY_01作业内容

day_01
yaoxin 2024-02-25 21:07:02 +08:00
parent c28bb19733
commit 0d2c933966
7 changed files with 43 additions and 7 deletions

View File

@ -46,6 +46,11 @@
<artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-transport-simple-http</artifactId>
</dependency>
<!-- Sentinel Datasource Nacos -->
<dependency>
<groupId>com.alibaba.csp</groupId>

View File

@ -28,7 +28,8 @@ spring:
eager: true
transport:
# 控制台地址
dashboard: 43.142.44.217:8718
dashboard: 43.142.44.217:8858
client-ip: 127.0.0.1
# nacos配置持久化
datasource:
ds1:

View File

@ -35,6 +35,17 @@
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- Sentinel Datasource Nacos -->
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-nacos</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-transport-simple-http</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
@ -78,6 +89,7 @@
<artifactId>muyu-common-swagger</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -3,6 +3,9 @@ package com.muyu.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.muyu.common.security.auth.AuthUtil;
import com.muyu.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -38,11 +41,14 @@ public class BookInfoController extends BaseController
/**
*
*/
@RequiresPermissions("system:info:list")
@RequiresPermissions("system:book:list")
@GetMapping("/list")
public Result<TableDataInfo<BookInfo>> list(BookInfo bookInfo)
{
startPage();
if (!AuthUtil.hasRole("admin")){
bookInfo.setCreateBy(SecurityUtils.getUsername());
}
List<BookInfo> list = bookInfoService.selectBookInfoList(bookInfo);
return getDataTable(list);
}
@ -50,7 +56,7 @@ public class BookInfoController extends BaseController
/**
*
*/
@RequiresPermissions("system:info:export")
@RequiresPermissions("system:book:list")
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BookInfo bookInfo)
@ -63,7 +69,7 @@ public class BookInfoController extends BaseController
/**
*
*/
@RequiresPermissions("system:info:query")
@RequiresPermissions("system:book:list")
@GetMapping(value = "/{bid}")
public Result getInfo(@PathVariable("bid") Long bid)
{
@ -73,29 +79,31 @@ public class BookInfoController extends BaseController
/**
*
*/
@RequiresPermissions("system:info:add")
@RequiresPermissions("system:book:list")
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
@PostMapping
public Result add(@RequestBody BookInfo bookInfo)
{
bookInfo.setCreateBy(SecurityUtils.getUsername());
return toAjax(bookInfoService.insertBookInfo(bookInfo));
}
/**
*
*/
@RequiresPermissions("system:info:edit")
@RequiresPermissions("system:book:list")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@PutMapping
public Result edit(@RequestBody BookInfo bookInfo)
{
bookInfo.setUpdateBy(SecurityUtils.getUsername());
return toAjax(bookInfoService.updateBookInfo(bookInfo));
}
/**
*
*/
@RequiresPermissions("system:info:remove")
@RequiresPermissions("system:book:list")
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
@DeleteMapping("/{bids}")
public Result remove(@PathVariable Long[] bids)

View File

@ -11,6 +11,14 @@ spring:
# 环境配置
active: dev
cloud:
sentinel:
# 取消控制台懒加载
eager: true
transport:
# 控制台地址
dashboard: 43.142.44.217:8858
client-ip: 127.0.0.1
port: 8721
nacos:
discovery:
# 服务注册地址

View File

@ -26,6 +26,7 @@
<select id="selectBookInfoList" parameterType="com.muyu.system.domain.BookInfo" resultMap="BookInfoResult">
<include refid="selectBookInfoVo"/>
<where>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy} </if>
<if test="title != null and title != ''"> and title like concat('%',#{title},'%') </if>
<if test="author != null and author != ''"> and author = #{author}</if>
<if test="type != null and type != ''"> and type = #{type}</if>

View File

@ -22,4 +22,5 @@
muyu-modules业务模块
</description>
</project>