显示班级
This commit is contained in:
@@ -93,6 +93,12 @@
|
|||||||
<artifactId>ruoyi-workflow</artifactId>
|
<artifactId>ruoyi-workflow</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.dromara</groupId>
|
||||||
|
<artifactId>ruoyi-student</artifactId>
|
||||||
|
<version>5.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.codecentric</groupId>
|
<groupId>de.codecentric</groupId>
|
||||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||||
|
@@ -4,6 +4,8 @@ import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties
|
|||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
|
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.ComponentScans;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动程序
|
* 启动程序
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
server:
|
server:
|
||||||
# 服务器的HTTP端口,默认为8080
|
# 服务器的HTTP端口,默认为8080
|
||||||
port: 8080
|
port: 8888
|
||||||
servlet:
|
servlet:
|
||||||
# 应用的访问路径
|
# 应用的访问路径
|
||||||
context-path: /
|
context-path: /
|
||||||
|
@@ -36,11 +36,11 @@ public class MybatisPlusConfig {
|
|||||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
// 多租户插件 必须放到第一位
|
// 多租户插件 必须放到第一位
|
||||||
try {
|
// try {
|
||||||
TenantLineInnerInterceptor tenant = SpringUtils.getBean(TenantLineInnerInterceptor.class);
|
// TenantLineInnerInterceptor tenant = SpringUtils.getBean(TenantLineInnerInterceptor.class);
|
||||||
interceptor.addInnerInterceptor(tenant);
|
// interceptor.addInnerInterceptor(tenant);
|
||||||
} catch (BeansException ignore) {
|
// } catch (BeansException ignore) {
|
||||||
}
|
// }
|
||||||
// 数据权限处理
|
// 数据权限处理
|
||||||
interceptor.addInnerInterceptor(dataPermissionInterceptor());
|
interceptor.addInnerInterceptor(dataPermissionInterceptor());
|
||||||
// 分页插件
|
// 分页插件
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
<module>ruoyi-job</module>
|
<module>ruoyi-job</module>
|
||||||
<module>ruoyi-system</module>
|
<module>ruoyi-system</module>
|
||||||
<module>ruoyi-workflow</module>
|
<module>ruoyi-workflow</module>
|
||||||
|
<module>ruoyi-student</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
|
38
ruoyi-modules/ruoyi-student/pom.xml
Normal file
38
ruoyi-modules/ruoyi-student/pom.xml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>org.dromara</groupId>
|
||||||
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>ruoyi-student</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>21</maven.compiler.source>
|
||||||
|
<maven.compiler.target>21</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.dromara</groupId>
|
||||||
|
<artifactId>ruoyi-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.dromara</groupId>
|
||||||
|
<artifactId>ruoyi-common-mybatis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.dromara</groupId>
|
||||||
|
<artifactId>ruoyi-common-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.dromara</groupId>
|
||||||
|
<artifactId>ruoyi-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@@ -0,0 +1,55 @@
|
|||||||
|
package org.dromara.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一返回的包装类
|
||||||
|
*/
|
||||||
|
public class Result {
|
||||||
|
private String code;
|
||||||
|
private String msg;
|
||||||
|
private Object data;
|
||||||
|
|
||||||
|
public static Result success() {
|
||||||
|
Result result = new Result();
|
||||||
|
result.setCode("200");
|
||||||
|
result.setMsg("请求成功");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result success(Object data) {
|
||||||
|
Result result = success();
|
||||||
|
result.setData(data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result error() {
|
||||||
|
Result result = new Result();
|
||||||
|
result.setCode("500");
|
||||||
|
result.setMsg("系统错误");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result error(String code, String msg) {
|
||||||
|
Result result = new Result();
|
||||||
|
result.setCode(code);
|
||||||
|
result.setMsg(msg);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
public Object getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
public void setData(Object data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,63 @@
|
|||||||
|
package org.dromara.controller;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.dromara.common.Result;
|
||||||
|
import org.dromara.domain.Cls;
|
||||||
|
import org.dromara.service.ClsService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/cls")
|
||||||
|
public class ClsController {
|
||||||
|
@Resource
|
||||||
|
private ClsService clsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result add(@RequestBody Cls cls) {
|
||||||
|
clsService.add(cls);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新数据
|
||||||
|
*/
|
||||||
|
@PutMapping("/update")
|
||||||
|
public Result update(@RequestBody Cls cls) {
|
||||||
|
clsService.update(cls);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/deleteById/{id}")
|
||||||
|
public Result deleteById(@PathVariable Integer id) {
|
||||||
|
clsService.deleteById(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/selectAll")
|
||||||
|
public Result selectAll(@RequestBody Cls cls) {
|
||||||
|
List<Cls> list = clsService.selectAll(cls);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询单个数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectById/{id}")
|
||||||
|
public Result selectById(@PathVariable Integer id) {
|
||||||
|
Cls cls = clsService.selectById(id);
|
||||||
|
return Result.success(cls);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,63 @@
|
|||||||
|
package org.dromara.controller;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.dromara.common.Result;
|
||||||
|
import org.dromara.domain.Student;
|
||||||
|
import org.dromara.service.StudentService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/student")
|
||||||
|
public class StudentController {
|
||||||
|
@Resource
|
||||||
|
private StudentService studentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result add(@RequestBody Student student) {
|
||||||
|
studentService.add(student);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新数据
|
||||||
|
*/
|
||||||
|
@PutMapping("/update")
|
||||||
|
public Result update(@RequestBody Student student) {
|
||||||
|
studentService.update(student);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/deleteById/{id}")
|
||||||
|
public Result deleteById(@PathVariable Integer id) {
|
||||||
|
studentService.deleteById(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectAll")
|
||||||
|
public Result selectAll(Student student) {
|
||||||
|
List<Student> list = studentService.selectAll(student);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询单个数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectById/{id}")
|
||||||
|
public Result selectById(@PathVariable Integer id) {
|
||||||
|
Student student = studentService.selectById(id);
|
||||||
|
return Result.success(student);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,10 @@
|
|||||||
|
package org.dromara.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Cls {
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,17 @@
|
|||||||
|
package org.dromara.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Student {
|
||||||
|
private Integer id;
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String role;
|
||||||
|
private String name;
|
||||||
|
private Integer age;
|
||||||
|
private String sex;
|
||||||
|
private String address;
|
||||||
|
private String clsId;
|
||||||
|
private String courseId;
|
||||||
|
}
|
@@ -0,0 +1,22 @@
|
|||||||
|
package org.dromara.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Delete;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
import org.dromara.domain.Cls;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ClsMapper {
|
||||||
|
List<Cls> selectAll(Cls cls);
|
||||||
|
@Select("select * from cls where id = #{id}")
|
||||||
|
Cls selectById(Integer id);
|
||||||
|
|
||||||
|
void insert(Cls cls);
|
||||||
|
|
||||||
|
void updateById(Cls cls);
|
||||||
|
|
||||||
|
@Delete("delete from `cls` where id = #{id}")
|
||||||
|
void deleteById(Integer id);
|
||||||
|
@Select("select * from cls where username = #{username}")
|
||||||
|
Cls selectByUsername(String username);
|
||||||
|
}
|
@@ -0,0 +1,23 @@
|
|||||||
|
package org.dromara.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Delete;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
import org.dromara.domain.Student;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface StudentMapper {
|
||||||
|
List<Student> selectAll(Student student);
|
||||||
|
@Select("select * from student where id = #{id}")
|
||||||
|
Student selectById(Integer id);
|
||||||
|
|
||||||
|
void insert(Student student);
|
||||||
|
|
||||||
|
void updateById(Student student);
|
||||||
|
|
||||||
|
@Delete("delete from `student` where id = #{id}")
|
||||||
|
void deleteById(Integer id);
|
||||||
|
@Select("select * from student where username = #{username}")
|
||||||
|
Student selectByUsername(String username);
|
||||||
|
}
|
@@ -0,0 +1,36 @@
|
|||||||
|
package org.dromara.service;
|
||||||
|
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.dromara.domain.Cls;
|
||||||
|
import org.dromara.mapper.ClsMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ClsService {
|
||||||
|
@Resource
|
||||||
|
private ClsMapper clsMapper;
|
||||||
|
|
||||||
|
public void add(Cls cls) {
|
||||||
|
clsMapper.insert(cls);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(Cls cls) {
|
||||||
|
clsMapper.updateById(cls);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteById(Integer id) {
|
||||||
|
clsMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Cls> selectAll(Cls cls) {
|
||||||
|
return clsMapper.selectAll(cls);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cls selectById( Integer id) {
|
||||||
|
return clsMapper.selectById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@@ -0,0 +1,35 @@
|
|||||||
|
package org.dromara.service;
|
||||||
|
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.dromara.domain.Student;
|
||||||
|
import org.dromara.mapper.StudentMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
@Service
|
||||||
|
public class StudentService {
|
||||||
|
@Resource
|
||||||
|
private StudentMapper studentMapper;
|
||||||
|
|
||||||
|
public void add(Student student) {
|
||||||
|
studentMapper.insert(student);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(Student student) {
|
||||||
|
studentMapper.updateById(student);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteById(Integer id) {
|
||||||
|
studentMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Student> selectAll(Student student) {
|
||||||
|
return studentMapper.selectAll(student);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Student selectById( Integer id) {
|
||||||
|
return studentMapper.selectById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@@ -0,0 +1,24 @@
|
|||||||
|
<?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="org.dromara.mapper.ClsMapper">
|
||||||
|
<select id="selectAll" resultType="org.dromara.domain.Cls" parameterType="org.dromara.domain.Cls">
|
||||||
|
select *
|
||||||
|
from cls
|
||||||
|
<where>
|
||||||
|
<if test="name != null">name like concat('%', #{name}, '%')</if>
|
||||||
|
</where>
|
||||||
|
order by id desc
|
||||||
|
</select>
|
||||||
|
<insert id="insert" parameterType="org.dromara.domain.Cls">
|
||||||
|
insert into `cls` (name)
|
||||||
|
values (#{name})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateById" parameterType="org.dromara.domain.Cls">
|
||||||
|
update `cls`
|
||||||
|
set name= #{name}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
@@ -0,0 +1,33 @@
|
|||||||
|
<?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="org.dromara.mapper.StudentMapper">
|
||||||
|
<select id="selectAll" resultType="org.dromara.domain.Student" parameterType="org.dromara.domain.Student">
|
||||||
|
select
|
||||||
|
student.id, student.username, student.password, student.role, student.name, student.age, student.sex, student.address, student.cls_id, student.course_id, student.avatar, student.create_dept, student.create_by, student.create_time, student.update_by, student.update_time, student.remark, student.del_flag, cls.name as clsName from student
|
||||||
|
left join cls on student.cls_id = cls.id
|
||||||
|
<where>
|
||||||
|
<if test="name != null">student.name like concat('%', #{name}, '%')</if>
|
||||||
|
</where>
|
||||||
|
order by student.id desc
|
||||||
|
</select>
|
||||||
|
<insert id="insert" parameterType="org.dromara.domain.Student">
|
||||||
|
insert into `student` (username, password, role, name, age, sex, address, cls_id, course_id)
|
||||||
|
values (#{username}, #{password}, #{role}, #{name}, #{age}, #{sex}, #{address}, #{clsId}, #{courseId})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateById" parameterType="org.dromara.domain.Student">
|
||||||
|
update `student`
|
||||||
|
set username= #{username},
|
||||||
|
password= #{password},
|
||||||
|
role= #{role},
|
||||||
|
name= #{name},
|
||||||
|
age= #{age},
|
||||||
|
sex= #{sex},
|
||||||
|
address= #{address},
|
||||||
|
cls_id= #{clsId},
|
||||||
|
course_id= #{courseId}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
Reference in New Issue
Block a user