From 10139db3038ce1dce2aaae13d73824a564a56499 Mon Sep 17 00:00:00 2001 From: hezi66677 <847517741@qq.com> Date: Sat, 7 Dec 2024 18:21:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysRoleController.java | 2 + .../controller/system/SysUserController.java | 8 ++ .../com/ruoyi/common/utils/SecurityUtils.java | 2 + .../system/controller/MycacheController.java | 104 +++++++++++++++++ .../java/com/ruoyi/system/domain/Mycache.java | 107 ++++++++++++++++++ .../ruoyi/system/mapper/MycacheMapper.java | 61 ++++++++++ .../ruoyi/system/service/IMycacheService.java | 61 ++++++++++ .../service/impl/MycacheServiceImpl.java | 93 +++++++++++++++ .../resources/mapper/system/MycacheMapper.xml | 76 +++++++++++++ 9 files changed, 514 insertions(+) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/controller/MycacheController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/Mycache.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/MycacheMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IMycacheService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MycacheServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/MycacheMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 42d9e8f..bb7e22c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -2,6 +2,8 @@ package com.ruoyi.web.controller.system; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.annotation.Anonymous; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 130c438..6528e5f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -3,6 +3,8 @@ package com.ruoyi.web.controller.system; import java.util.List; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.annotation.Anonymous; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -56,6 +58,7 @@ public class SysUserController extends BaseController /** * 获取用户列表 */ + /*@Anonymous*/ @PreAuthorize("@ss.hasPermi('system:user:list')") @GetMapping("/list") public TableDataInfo list(SysUser user) @@ -65,6 +68,7 @@ public class SysUserController extends BaseController return getDataTable(list); } + /*@Anonymous*/ @Log(title = "用户管理", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:user:export')") @PostMapping("/export") @@ -75,6 +79,7 @@ public class SysUserController extends BaseController util.exportExcel(response, list, "用户数据"); } + /* @Anonymous*/ @Log(title = "用户管理", businessType = BusinessType.IMPORT) @PreAuthorize("@ss.hasPermi('system:user:import')") @PostMapping("/importData") @@ -97,6 +102,8 @@ public class SysUserController extends BaseController /** * 根据用户编号获取详细信息 */ + + /* @Anonymous*/ @PreAuthorize("@ss.hasPermi('system:user:query')") @GetMapping(value = { "/", "/{userId}" }) public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) @@ -119,6 +126,7 @@ public class SysUserController extends BaseController /** * 新增用户 */ + /* @Anonymous*/ @PreAuthorize("@ss.hasPermi('system:user:add')") @Log(title = "用户管理", businessType = BusinessType.INSERT) @PostMapping diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java index 0d3ac5f..18d805f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java @@ -3,6 +3,8 @@ package com.ruoyi.common.utils; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; + +import com.ruoyi.common.annotation.Anonymous; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/MycacheController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/MycacheController.java new file mode 100644 index 0000000..4ed06b0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/MycacheController.java @@ -0,0 +1,104 @@ +package com.ruoyi.system.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +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.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.Mycache; +import com.ruoyi.system.service.IMycacheService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 内存管理Controller + * + * @author 徐天乐 + * @date 2024-12-06 + */ +@RestController +@RequestMapping("/system/mycache") +public class MycacheController extends BaseController +{ + @Autowired + private IMycacheService mycacheService; + + /** + * 查询内存管理列表 + */ + @PreAuthorize("@ss.hasPermi('system:mycache:list')") + @GetMapping("/list") + public TableDataInfo list(Mycache mycache) + { + startPage(); + List list = mycacheService.selectMycacheList(mycache); + return getDataTable(list); + } + + /** + * 导出内存管理列表 + */ + @PreAuthorize("@ss.hasPermi('system:mycache:export')") + @Log(title = "内存管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, Mycache mycache) + { + List list = mycacheService.selectMycacheList(mycache); + ExcelUtil util = new ExcelUtil(Mycache.class); + util.exportExcel(response, list, "内存管理数据"); + } + + /** + * 获取内存管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:mycache:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(mycacheService.selectMycacheById(id)); + } + + /** + * 新增内存管理 + */ + @PreAuthorize("@ss.hasPermi('system:mycache:add')") + @Log(title = "内存管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody Mycache mycache) + { + return toAjax(mycacheService.insertMycache(mycache)); + } + + /** + * 修改内存管理 + */ + @PreAuthorize("@ss.hasPermi('system:mycache:edit')") + @Log(title = "内存管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody Mycache mycache) + { + return toAjax(mycacheService.updateMycache(mycache)); + } + + /** + * 删除内存管理 + */ + @PreAuthorize("@ss.hasPermi('system:mycache:remove')") + @Log(title = "内存管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(mycacheService.deleteMycacheByIds(ids)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/Mycache.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/Mycache.java new file mode 100644 index 0000000..fa8b418 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/Mycache.java @@ -0,0 +1,107 @@ +package com.ruoyi.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 内存管理对象 mycache + * + * @author 徐天乐 + * @date 2024-12-06 + */ +public class Mycache extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 总内存 */ + @Excel(name = "总内存") + private String allcache; + + /** 使用内存 */ + @Excel(name = "使用内存") + private String usecache; + + /** 本地缓存 */ + @Excel(name = "本地缓存") + private String homecache; + + /** 剩余内存 */ + @Excel(name = "剩余内存") + private String surpluscache; + + /** 用户名 */ + @Excel(name = "用户名") + private String username; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setAllcache(String allcache) + { + this.allcache = allcache; + } + + public String getAllcache() + { + return allcache; + } + public void setUsecache(String usecache) + { + this.usecache = usecache; + } + + public String getUsecache() + { + return usecache; + } + public void setHomecache(String homecache) + { + this.homecache = homecache; + } + + public String getHomecache() + { + return homecache; + } + public void setSurpluscache(String surpluscache) + { + this.surpluscache = surpluscache; + } + + public String getSurpluscache() + { + return surpluscache; + } + public void setUsername(String username) + { + this.username = username; + } + + public String getUsername() + { + return username; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("allcache", getAllcache()) + .append("usecache", getUsecache()) + .append("homecache", getHomecache()) + .append("surpluscache", getSurpluscache()) + .append("username", getUsername()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MycacheMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MycacheMapper.java new file mode 100644 index 0000000..71dca83 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MycacheMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.Mycache; + +/** + * 内存管理Mapper接口 + * + * @author 徐天乐 + * @date 2024-12-06 + */ +public interface MycacheMapper +{ + /** + * 查询内存管理 + * + * @param id 内存管理主键 + * @return 内存管理 + */ + public Mycache selectMycacheById(Long id); + + /** + * 查询内存管理列表 + * + * @param mycache 内存管理 + * @return 内存管理集合 + */ + public List selectMycacheList(Mycache mycache); + + /** + * 新增内存管理 + * + * @param mycache 内存管理 + * @return 结果 + */ + public int insertMycache(Mycache mycache); + + /** + * 修改内存管理 + * + * @param mycache 内存管理 + * @return 结果 + */ + public int updateMycache(Mycache mycache); + + /** + * 删除内存管理 + * + * @param id 内存管理主键 + * @return 结果 + */ + public int deleteMycacheById(Long id); + + /** + * 批量删除内存管理 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMycacheByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IMycacheService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IMycacheService.java new file mode 100644 index 0000000..2b37160 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IMycacheService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.Mycache; + +/** + * 内存管理Service接口 + * + * @author 徐天乐 + * @date 2024-12-06 + */ +public interface IMycacheService +{ + /** + * 查询内存管理 + * + * @param id 内存管理主键 + * @return 内存管理 + */ + public Mycache selectMycacheById(Long id); + + /** + * 查询内存管理列表 + * + * @param mycache 内存管理 + * @return 内存管理集合 + */ + public List selectMycacheList(Mycache mycache); + + /** + * 新增内存管理 + * + * @param mycache 内存管理 + * @return 结果 + */ + public int insertMycache(Mycache mycache); + + /** + * 修改内存管理 + * + * @param mycache 内存管理 + * @return 结果 + */ + public int updateMycache(Mycache mycache); + + /** + * 批量删除内存管理 + * + * @param ids 需要删除的内存管理主键集合 + * @return 结果 + */ + public int deleteMycacheByIds(Long[] ids); + + /** + * 删除内存管理信息 + * + * @param id 内存管理主键 + * @return 结果 + */ + public int deleteMycacheById(Long id); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MycacheServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MycacheServiceImpl.java new file mode 100644 index 0000000..12d5822 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MycacheServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.MycacheMapper; +import com.ruoyi.system.domain.Mycache; +import com.ruoyi.system.service.IMycacheService; + +/** + * 内存管理Service业务层处理 + * + * @author 徐天乐 + * @date 2024-12-06 + */ +@Service +public class MycacheServiceImpl implements IMycacheService +{ + @Autowired + private MycacheMapper mycacheMapper; + + /** + * 查询内存管理 + * + * @param id 内存管理主键 + * @return 内存管理 + */ + @Override + public Mycache selectMycacheById(Long id) + { + return mycacheMapper.selectMycacheById(id); + } + + /** + * 查询内存管理列表 + * + * @param mycache 内存管理 + * @return 内存管理 + */ + @Override + public List selectMycacheList(Mycache mycache) + { + return mycacheMapper.selectMycacheList(mycache); + } + + /** + * 新增内存管理 + * + * @param mycache 内存管理 + * @return 结果 + */ + @Override + public int insertMycache(Mycache mycache) + { + return mycacheMapper.insertMycache(mycache); + } + + /** + * 修改内存管理 + * + * @param mycache 内存管理 + * @return 结果 + */ + @Override + public int updateMycache(Mycache mycache) + { + return mycacheMapper.updateMycache(mycache); + } + + /** + * 批量删除内存管理 + * + * @param ids 需要删除的内存管理主键 + * @return 结果 + */ + @Override + public int deleteMycacheByIds(Long[] ids) + { + return mycacheMapper.deleteMycacheByIds(ids); + } + + /** + * 删除内存管理信息 + * + * @param id 内存管理主键 + * @return 结果 + */ + @Override + public int deleteMycacheById(Long id) + { + return mycacheMapper.deleteMycacheById(id); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/MycacheMapper.xml b/ruoyi-system/src/main/resources/mapper/system/MycacheMapper.xml new file mode 100644 index 0000000..f5c91af --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/MycacheMapper.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + select id, allcache, usecache, homecache, surpluscache, username from mycache + + + + + + + + insert into mycache + + allcache, + usecache, + homecache, + surpluscache, + username, + + + #{allcache}, + #{usecache}, + #{homecache}, + #{surpluscache}, + #{username}, + + + + + update mycache + + allcache = #{allcache}, + usecache = #{usecache}, + homecache = #{homecache}, + surpluscache = #{surpluscache}, + username = #{username}, + + where id = #{id} + + + + delete from mycache where id = #{id} + + + + delete from mycache where id in + + #{id} + + + \ No newline at end of file