ruoyi-vue 官网介绍和要点CSMD说明

张开发
2026/4/16 20:36:32 15 分钟阅读

分享文章

ruoyi-vue 官网介绍和要点CSMD说明
创建数据库及数据表添加CSMD 相关文件代码Controllerpackage com.ruoyi.web.controller.system; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.system.domain.User; import com.ruoyi.system.service.impl.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; RestController RequestMapping(/system) public class HelloController extends BaseController { Autowired private UserService userService; GetMapping(/hello) public ListUser hello() { return userService.findAll(); } }添加CSMD 相关文件代码Servicepackage com.ruoyi.system.service.impl; import com.ruoyi.system.domain.User; import com.ruoyi.system.mapper.UserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; Service public class UserService { Autowired private UserMapper userMapper; public ListUser findAll() { return userMapper.findAll(); } }添加CSMD 相关文件代码Mapperpackage com.ruoyi.system.mapper; import com.ruoyi.system.domain.User; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import java.util.List; Mapper public interface UserMapper { Select(SELECT * FROM user) ListUser findAll(); }添加CSMD 相关文件代码Domainpackage com.ruoyi.system.domain; public class User { private Integer id; private String name; private Integer age; private Integer sex; private String createTime; public User() { } public Integer getId() { return id; } public void setId(Integer id) { this.id id; } public String getName() { return name; } public void setName(String name) { this.name name; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age age; } public Integer getSex() { return sex; } public void setSex(Integer sex) { this.sex sex; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime createTime; } }屏蔽新加接口安全防护策略.antMatchers(/login, /register, /captchaImage, /system/hello).anonymous() .antMatchers(/system/user/*).anonymous() .antMatchers(/hello).anonymous()Postman 测试新接口

更多文章