Skip to content

Commit 46d02a1

Browse files
committedJun 11, 2024
新增 学生管理系统
1 parent 2ec6375 commit 46d02a1

22 files changed

+1390
-0
lines changed
 

‎pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
<module>ruoyi-quartz</module>
204204
<module>ruoyi-generator</module>
205205
<module>ruoyi-common</module>
206+
<module>ums</module>
206207
</modules>
207208
<packaging>pom</packaging>
208209

‎ruoyi-admin/pom.xml

+6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@
6767
<artifactId>ruoyi-generator</artifactId>
6868
</dependency>
6969

70+
<dependency>
71+
<groupId>com.ruoyi</groupId>
72+
<artifactId>ums</artifactId>
73+
<version>4.7.9</version>
74+
</dependency>
75+
7076
</dependencies>
7177

7278
<build>

‎ums/pom.xml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>com.ruoyi</groupId>
8+
<artifactId>ruoyi</artifactId>
9+
<version>4.7.9</version>
10+
</parent>
11+
12+
<artifactId>ums</artifactId>
13+
14+
<properties>
15+
<maven.compiler.source>8</maven.compiler.source>
16+
<maven.compiler.target>8</maven.compiler.target>
17+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18+
</properties>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>com.ruoyi</groupId>
23+
<artifactId>ruoyi-common</artifactId>
24+
</dependency>
25+
</dependencies>
26+
27+
</project>

‎ums/sql/ums.sql

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# drop database if exists ry;
2+
# create database ry charset utf8mb4;
3+
use ry;
4+
5+
create table if not exists ums_class
6+
(
7+
id int auto_increment primary key,
8+
name varchar(32) not null
9+
);
10+
11+
create table if not exists ums_student
12+
(
13+
id int auto_increment primary key,
14+
name varchar(32) not null,
15+
age smallint not null,
16+
class_id int not null,
17+
foreign key (class_id) references ums_class (id)
18+
);
19+
20+
select *
21+
from ums_class;
22+
23+
select *
24+
from ums_student;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
package com.ruoyi.ums.controller;
2+
3+
import java.util.List;
4+
import org.apache.shiro.authz.annotation.RequiresPermissions;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.stereotype.Controller;
7+
import org.springframework.ui.ModelMap;
8+
import org.springframework.web.bind.annotation.GetMapping;
9+
import org.springframework.web.bind.annotation.PathVariable;
10+
import org.springframework.web.bind.annotation.PostMapping;
11+
import org.springframework.web.bind.annotation.RequestMapping;
12+
import org.springframework.web.bind.annotation.ResponseBody;
13+
import com.ruoyi.common.annotation.Log;
14+
import com.ruoyi.common.enums.BusinessType;
15+
import com.ruoyi.ums.domain.UmsClass;
16+
import com.ruoyi.ums.service.IUmsClassService;
17+
import com.ruoyi.common.core.controller.BaseController;
18+
import com.ruoyi.common.core.domain.AjaxResult;
19+
import com.ruoyi.common.utils.poi.ExcelUtil;
20+
import com.ruoyi.common.core.page.TableDataInfo;
21+
22+
/**
23+
* 班级管理Controller
24+
*
25+
* @author ruoyi
26+
* @date 2024-06-11
27+
*/
28+
@Controller
29+
@RequestMapping("/ums/umsClass")
30+
public class UmsClassController extends BaseController
31+
{
32+
private String prefix = "ums/umsClass";
33+
34+
@Autowired
35+
private IUmsClassService umsClassService;
36+
37+
@RequiresPermissions("ums:umsClass:view")
38+
@GetMapping()
39+
public String umsClass()
40+
{
41+
return prefix + "/umsClass";
42+
}
43+
44+
/**
45+
* 查询班级管理列表
46+
*/
47+
@RequiresPermissions("ums:umsClass:list")
48+
@PostMapping("/list")
49+
@ResponseBody
50+
public TableDataInfo list(UmsClass umsClass)
51+
{
52+
startPage();
53+
List<UmsClass> list = umsClassService.selectUmsClassList(umsClass);
54+
return getDataTable(list);
55+
}
56+
57+
/**
58+
* 导出班级管理列表
59+
*/
60+
@RequiresPermissions("ums:umsClass:export")
61+
@Log(title = "班级管理", businessType = BusinessType.EXPORT)
62+
@PostMapping("/export")
63+
@ResponseBody
64+
public AjaxResult export(UmsClass umsClass)
65+
{
66+
List<UmsClass> list = umsClassService.selectUmsClassList(umsClass);
67+
ExcelUtil<UmsClass> util = new ExcelUtil<UmsClass>(UmsClass.class);
68+
return util.exportExcel(list, "班级管理数据");
69+
}
70+
71+
/**
72+
* 新增班级管理
73+
*/
74+
@GetMapping("/add")
75+
public String add()
76+
{
77+
return prefix + "/add";
78+
}
79+
80+
/**
81+
* 新增保存班级管理
82+
*/
83+
@RequiresPermissions("ums:umsClass:add")
84+
@Log(title = "班级管理", businessType = BusinessType.INSERT)
85+
@PostMapping("/add")
86+
@ResponseBody
87+
public AjaxResult addSave(UmsClass umsClass)
88+
{
89+
return toAjax(umsClassService.insertUmsClass(umsClass));
90+
}
91+
92+
/**
93+
* 修改班级管理
94+
*/
95+
@RequiresPermissions("ums:umsClass:edit")
96+
@GetMapping("/edit/{id}")
97+
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
98+
{
99+
UmsClass umsClass = umsClassService.selectUmsClassById(id);
100+
mmap.put("umsClass", umsClass);
101+
return prefix + "/edit";
102+
}
103+
104+
/**
105+
* 修改保存班级管理
106+
*/
107+
@RequiresPermissions("ums:umsClass:edit")
108+
@Log(title = "班级管理", businessType = BusinessType.UPDATE)
109+
@PostMapping("/edit")
110+
@ResponseBody
111+
public AjaxResult editSave(UmsClass umsClass)
112+
{
113+
return toAjax(umsClassService.updateUmsClass(umsClass));
114+
}
115+
116+
/**
117+
* 删除班级管理
118+
*/
119+
@RequiresPermissions("ums:umsClass:remove")
120+
@Log(title = "班级管理", businessType = BusinessType.DELETE)
121+
@PostMapping( "/remove")
122+
@ResponseBody
123+
public AjaxResult remove(String ids)
124+
{
125+
return toAjax(umsClassService.deleteUmsClassByIds(ids));
126+
}
127+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
package com.ruoyi.ums.controller;
2+
3+
import java.util.List;
4+
5+
import com.ruoyi.ums.domain.UmsClass;
6+
import com.ruoyi.ums.service.IUmsClassService;
7+
import org.apache.shiro.authz.annotation.RequiresPermissions;
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
import org.springframework.stereotype.Controller;
10+
import org.springframework.ui.ModelMap;
11+
import org.springframework.web.bind.annotation.GetMapping;
12+
import org.springframework.web.bind.annotation.PathVariable;
13+
import org.springframework.web.bind.annotation.PostMapping;
14+
import org.springframework.web.bind.annotation.RequestMapping;
15+
import org.springframework.web.bind.annotation.ResponseBody;
16+
import com.ruoyi.common.annotation.Log;
17+
import com.ruoyi.common.enums.BusinessType;
18+
import com.ruoyi.ums.domain.UmsStudent;
19+
import com.ruoyi.ums.service.IUmsStudentService;
20+
import com.ruoyi.common.core.controller.BaseController;
21+
import com.ruoyi.common.core.domain.AjaxResult;
22+
import com.ruoyi.common.utils.poi.ExcelUtil;
23+
import com.ruoyi.common.core.page.TableDataInfo;
24+
25+
/**
26+
* 学生管理Controller
27+
*
28+
* @author ruoyi
29+
* @date 2024-06-11
30+
*/
31+
@Controller
32+
@RequestMapping("/ums/umsStudent")
33+
public class UmsStudentController extends BaseController
34+
{
35+
private String prefix = "ums/umsStudent";
36+
37+
@Autowired
38+
private IUmsStudentService umsStudentService;
39+
40+
@Autowired
41+
private IUmsClassService umsClassService;
42+
43+
@RequiresPermissions("ums:umsStudent:view")
44+
@GetMapping()
45+
public String umsStudent()
46+
{
47+
return prefix + "/umsStudent";
48+
}
49+
50+
/**
51+
* 查询学生管理列表
52+
*/
53+
@RequiresPermissions("ums:umsStudent:list")
54+
@PostMapping("/list")
55+
@ResponseBody
56+
public TableDataInfo list(UmsStudent umsStudent)
57+
{
58+
startPage();
59+
List<UmsStudent> list = umsStudentService.selectUmsStudentList(umsStudent);
60+
return getDataTable(list);
61+
}
62+
63+
/**
64+
* 导出学生管理列表
65+
*/
66+
@RequiresPermissions("ums:umsStudent:export")
67+
@Log(title = "学生管理", businessType = BusinessType.EXPORT)
68+
@PostMapping("/export")
69+
@ResponseBody
70+
public AjaxResult export(UmsStudent umsStudent)
71+
{
72+
List<UmsStudent> list = umsStudentService.selectUmsStudentList(umsStudent);
73+
ExcelUtil<UmsStudent> util = new ExcelUtil<UmsStudent>(UmsStudent.class);
74+
return util.exportExcel(list, "学生管理数据");
75+
}
76+
77+
/**
78+
* 新增学生管理
79+
*/
80+
@GetMapping("/add")
81+
public String add(ModelMap mmap)
82+
{
83+
mmap.put("umsClasses", umsClassService.selectUmsClassList(null));
84+
return prefix + "/add";
85+
}
86+
87+
/**
88+
* 新增保存学生管理
89+
*/
90+
@RequiresPermissions("ums:umsStudent:add")
91+
@Log(title = "学生管理", businessType = BusinessType.INSERT)
92+
@PostMapping("/add")
93+
@ResponseBody
94+
public AjaxResult addSave(UmsStudent umsStudent)
95+
{
96+
return toAjax(umsStudentService.insertUmsStudent(umsStudent));
97+
}
98+
99+
/**
100+
* 修改学生管理
101+
*/
102+
@RequiresPermissions("ums:umsStudent:edit")
103+
@GetMapping("/edit/{id}")
104+
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
105+
{
106+
UmsStudent umsStudent = umsStudentService.selectUmsStudentById(id);
107+
mmap.put("umsStudent", umsStudent);
108+
mmap.put("umsClasses", umsClassService.selectUmsClassList(null));
109+
return prefix + "/edit";
110+
}
111+
112+
/**
113+
* 修改保存学生管理
114+
*/
115+
@RequiresPermissions("ums:umsStudent:edit")
116+
@Log(title = "学生管理", businessType = BusinessType.UPDATE)
117+
@PostMapping("/edit")
118+
@ResponseBody
119+
public AjaxResult editSave(UmsStudent umsStudent)
120+
{
121+
return toAjax(umsStudentService.updateUmsStudent(umsStudent));
122+
}
123+
124+
/**
125+
* 删除学生管理
126+
*/
127+
@RequiresPermissions("ums:umsStudent:remove")
128+
@Log(title = "学生管理", businessType = BusinessType.DELETE)
129+
@PostMapping( "/remove")
130+
@ResponseBody
131+
public AjaxResult remove(String ids)
132+
{
133+
return toAjax(umsStudentService.deleteUmsStudentByIds(ids));
134+
}
135+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package com.ruoyi.ums.domain;
2+
3+
import java.util.List;
4+
import org.apache.commons.lang3.builder.ToStringBuilder;
5+
import org.apache.commons.lang3.builder.ToStringStyle;
6+
import com.ruoyi.common.annotation.Excel;
7+
import com.ruoyi.common.core.domain.BaseEntity;
8+
9+
/**
10+
* 班级管理对象 ums_class
11+
*
12+
* @author ruoyi
13+
* @date 2024-06-11
14+
*/
15+
public class UmsClass extends BaseEntity
16+
{
17+
private static final long serialVersionUID = 1L;
18+
19+
/** 编号 */
20+
private Integer id;
21+
22+
/** 名称 */
23+
@Excel(name = "名称")
24+
private String name;
25+
26+
public void setId(Integer id)
27+
{
28+
this.id = id;
29+
}
30+
31+
public Integer getId()
32+
{
33+
return id;
34+
}
35+
36+
public void setName(String name)
37+
{
38+
this.name = name;
39+
}
40+
41+
public String getName()
42+
{
43+
return name;
44+
}
45+
46+
@Override
47+
public String toString() {
48+
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
49+
.append("id", getId())
50+
.append("name", getName())
51+
.toString();
52+
}
53+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
package com.ruoyi.ums.domain;
2+
3+
import java.util.List;
4+
import org.apache.commons.lang3.builder.ToStringBuilder;
5+
import org.apache.commons.lang3.builder.ToStringStyle;
6+
import com.ruoyi.common.annotation.Excel;
7+
import com.ruoyi.common.core.domain.BaseEntity;
8+
9+
/**
10+
* 学生管理对象 ums_student
11+
*
12+
* @author ruoyi
13+
* @date 2024-06-11
14+
*/
15+
public class UmsStudent extends BaseEntity
16+
{
17+
private static final long serialVersionUID = 1L;
18+
19+
/** 编号 */
20+
private Integer id;
21+
22+
/** 名称 */
23+
@Excel(name = "名称")
24+
private String name;
25+
26+
/** 年龄 */
27+
@Excel(name = "年龄")
28+
private Integer age;
29+
30+
/** 班级编号 */
31+
@Excel(name = "班级编号")
32+
private Integer classId;
33+
34+
private UmsClass umsClass;
35+
36+
public void setId(Integer id)
37+
{
38+
this.id = id;
39+
}
40+
41+
public Integer getId()
42+
{
43+
return id;
44+
}
45+
46+
public void setName(String name)
47+
{
48+
this.name = name;
49+
}
50+
51+
public String getName()
52+
{
53+
return name;
54+
}
55+
56+
public void setAge(Integer age)
57+
{
58+
this.age = age;
59+
}
60+
61+
public Integer getAge()
62+
{
63+
return age;
64+
}
65+
66+
public void setClassId(Integer classId)
67+
{
68+
this.classId = classId;
69+
}
70+
71+
public Integer getClassId()
72+
{
73+
return classId;
74+
}
75+
76+
public UmsClass getUmsClass() {
77+
return umsClass;
78+
}
79+
80+
public void setUmsClass(UmsClass umsClass) {
81+
this.umsClass = umsClass;
82+
}
83+
84+
@Override
85+
public String toString() {
86+
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
87+
.append("id", getId())
88+
.append("name", getName())
89+
.append("age", getAge())
90+
.append("classId", getClassId())
91+
.append("umsClass", getUmsClass())
92+
.toString();
93+
}
94+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.ruoyi.ums.mapper;
2+
3+
import java.util.List;
4+
import com.ruoyi.ums.domain.UmsClass;
5+
6+
/**
7+
* 班级管理Mapper接口
8+
*
9+
* @author ruoyi
10+
* @date 2024-06-11
11+
*/
12+
public interface UmsClassMapper
13+
{
14+
/**
15+
* 查询班级管理
16+
*
17+
* @param id 班级管理主键
18+
* @return 班级管理
19+
*/
20+
public UmsClass selectUmsClassById(Integer id);
21+
22+
/**
23+
* 查询班级管理列表
24+
*
25+
* @param umsClass 班级管理
26+
* @return 班级管理集合
27+
*/
28+
public List<UmsClass> selectUmsClassList(UmsClass umsClass);
29+
30+
/**
31+
* 新增班级管理
32+
*
33+
* @param umsClass 班级管理
34+
* @return 结果
35+
*/
36+
public int insertUmsClass(UmsClass umsClass);
37+
38+
/**
39+
* 修改班级管理
40+
*
41+
* @param umsClass 班级管理
42+
* @return 结果
43+
*/
44+
public int updateUmsClass(UmsClass umsClass);
45+
46+
/**
47+
* 删除班级管理
48+
*
49+
* @param id 班级管理主键
50+
* @return 结果
51+
*/
52+
public int deleteUmsClassById(Integer id);
53+
54+
/**
55+
* 批量删除班级管理
56+
*
57+
* @param ids 需要删除的数据主键集合
58+
* @return 结果
59+
*/
60+
public int deleteUmsClassByIds(String[] ids);
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.ruoyi.ums.mapper;
2+
3+
import java.util.List;
4+
import com.ruoyi.ums.domain.UmsStudent;
5+
6+
/**
7+
* 学生管理Mapper接口
8+
*
9+
* @author ruoyi
10+
* @date 2024-06-11
11+
*/
12+
public interface UmsStudentMapper
13+
{
14+
/**
15+
* 查询学生管理
16+
*
17+
* @param id 学生管理主键
18+
* @return 学生管理
19+
*/
20+
public UmsStudent selectUmsStudentById(Integer id);
21+
22+
/**
23+
* 查询学生管理列表
24+
*
25+
* @param umsStudent 学生管理
26+
* @return 学生管理集合
27+
*/
28+
public List<UmsStudent> selectUmsStudentList(UmsStudent umsStudent);
29+
30+
/**
31+
* 新增学生管理
32+
*
33+
* @param umsStudent 学生管理
34+
* @return 结果
35+
*/
36+
public int insertUmsStudent(UmsStudent umsStudent);
37+
38+
/**
39+
* 修改学生管理
40+
*
41+
* @param umsStudent 学生管理
42+
* @return 结果
43+
*/
44+
public int updateUmsStudent(UmsStudent umsStudent);
45+
46+
/**
47+
* 删除学生管理
48+
*
49+
* @param id 学生管理主键
50+
* @return 结果
51+
*/
52+
public int deleteUmsStudentById(Integer id);
53+
54+
/**
55+
* 批量删除学生管理
56+
*
57+
* @param ids 需要删除的数据主键集合
58+
* @return 结果
59+
*/
60+
public int deleteUmsStudentByIds(String[] ids);
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.ruoyi.ums.service;
2+
3+
import java.util.List;
4+
import com.ruoyi.ums.domain.UmsClass;
5+
6+
/**
7+
* 班级管理Service接口
8+
*
9+
* @author ruoyi
10+
* @date 2024-06-11
11+
*/
12+
public interface IUmsClassService
13+
{
14+
/**
15+
* 查询班级管理
16+
*
17+
* @param id 班级管理主键
18+
* @return 班级管理
19+
*/
20+
public UmsClass selectUmsClassById(Integer id);
21+
22+
/**
23+
* 查询班级管理列表
24+
*
25+
* @param umsClass 班级管理
26+
* @return 班级管理集合
27+
*/
28+
public List<UmsClass> selectUmsClassList(UmsClass umsClass);
29+
30+
/**
31+
* 新增班级管理
32+
*
33+
* @param umsClass 班级管理
34+
* @return 结果
35+
*/
36+
public int insertUmsClass(UmsClass umsClass);
37+
38+
/**
39+
* 修改班级管理
40+
*
41+
* @param umsClass 班级管理
42+
* @return 结果
43+
*/
44+
public int updateUmsClass(UmsClass umsClass);
45+
46+
/**
47+
* 批量删除班级管理
48+
*
49+
* @param ids 需要删除的班级管理主键集合
50+
* @return 结果
51+
*/
52+
public int deleteUmsClassByIds(String ids);
53+
54+
/**
55+
* 删除班级管理信息
56+
*
57+
* @param id 班级管理主键
58+
* @return 结果
59+
*/
60+
public int deleteUmsClassById(Integer id);
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.ruoyi.ums.service;
2+
3+
import java.util.List;
4+
import com.ruoyi.ums.domain.UmsStudent;
5+
6+
/**
7+
* 学生管理Service接口
8+
*
9+
* @author ruoyi
10+
* @date 2024-06-11
11+
*/
12+
public interface IUmsStudentService
13+
{
14+
/**
15+
* 查询学生管理
16+
*
17+
* @param id 学生管理主键
18+
* @return 学生管理
19+
*/
20+
public UmsStudent selectUmsStudentById(Integer id);
21+
22+
/**
23+
* 查询学生管理列表
24+
*
25+
* @param umsStudent 学生管理
26+
* @return 学生管理集合
27+
*/
28+
public List<UmsStudent> selectUmsStudentList(UmsStudent umsStudent);
29+
30+
/**
31+
* 新增学生管理
32+
*
33+
* @param umsStudent 学生管理
34+
* @return 结果
35+
*/
36+
public int insertUmsStudent(UmsStudent umsStudent);
37+
38+
/**
39+
* 修改学生管理
40+
*
41+
* @param umsStudent 学生管理
42+
* @return 结果
43+
*/
44+
public int updateUmsStudent(UmsStudent umsStudent);
45+
46+
/**
47+
* 批量删除学生管理
48+
*
49+
* @param ids 需要删除的学生管理主键集合
50+
* @return 结果
51+
*/
52+
public int deleteUmsStudentByIds(String ids);
53+
54+
/**
55+
* 删除学生管理信息
56+
*
57+
* @param id 学生管理主键
58+
* @return 结果
59+
*/
60+
public int deleteUmsStudentById(Integer id);
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
package com.ruoyi.ums.service.impl;
2+
3+
import java.util.List;
4+
import org.springframework.beans.factory.annotation.Autowired;
5+
import org.springframework.stereotype.Service;
6+
import com.ruoyi.ums.mapper.UmsClassMapper;
7+
import com.ruoyi.ums.domain.UmsClass;
8+
import com.ruoyi.ums.service.IUmsClassService;
9+
import com.ruoyi.common.core.text.Convert;
10+
11+
/**
12+
* 班级管理Service业务层处理
13+
*
14+
* @author ruoyi
15+
* @date 2024-06-11
16+
*/
17+
@Service
18+
public class UmsClassServiceImpl implements IUmsClassService
19+
{
20+
@Autowired
21+
private UmsClassMapper umsClassMapper;
22+
23+
/**
24+
* 查询班级管理
25+
*
26+
* @param id 班级管理主键
27+
* @return 班级管理
28+
*/
29+
@Override
30+
public UmsClass selectUmsClassById(Integer id)
31+
{
32+
return umsClassMapper.selectUmsClassById(id);
33+
}
34+
35+
/**
36+
* 查询班级管理列表
37+
*
38+
* @param umsClass 班级管理
39+
* @return 班级管理
40+
*/
41+
@Override
42+
public List<UmsClass> selectUmsClassList(UmsClass umsClass)
43+
{
44+
return umsClassMapper.selectUmsClassList(umsClass);
45+
}
46+
47+
/**
48+
* 新增班级管理
49+
*
50+
* @param umsClass 班级管理
51+
* @return 结果
52+
*/
53+
@Override
54+
public int insertUmsClass(UmsClass umsClass)
55+
{
56+
return umsClassMapper.insertUmsClass(umsClass);
57+
}
58+
59+
/**
60+
* 修改班级管理
61+
*
62+
* @param umsClass 班级管理
63+
* @return 结果
64+
*/
65+
@Override
66+
public int updateUmsClass(UmsClass umsClass)
67+
{
68+
return umsClassMapper.updateUmsClass(umsClass);
69+
}
70+
71+
/**
72+
* 批量删除班级管理
73+
*
74+
* @param ids 需要删除的班级管理主键
75+
* @return 结果
76+
*/
77+
@Override
78+
public int deleteUmsClassByIds(String ids)
79+
{
80+
return umsClassMapper.deleteUmsClassByIds(Convert.toStrArray(ids));
81+
}
82+
83+
/**
84+
* 删除班级管理信息
85+
*
86+
* @param id 班级管理主键
87+
* @return 结果
88+
*/
89+
@Override
90+
public int deleteUmsClassById(Integer id)
91+
{
92+
return umsClassMapper.deleteUmsClassById(id);
93+
}
94+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
package com.ruoyi.ums.service.impl;
2+
3+
import java.util.List;
4+
import org.springframework.beans.factory.annotation.Autowired;
5+
import org.springframework.stereotype.Service;
6+
import com.ruoyi.ums.mapper.UmsStudentMapper;
7+
import com.ruoyi.ums.domain.UmsStudent;
8+
import com.ruoyi.ums.service.IUmsStudentService;
9+
import com.ruoyi.common.core.text.Convert;
10+
11+
/**
12+
* 学生管理Service业务层处理
13+
*
14+
* @author ruoyi
15+
* @date 2024-06-11
16+
*/
17+
@Service
18+
public class UmsStudentServiceImpl implements IUmsStudentService
19+
{
20+
@Autowired
21+
private UmsStudentMapper umsStudentMapper;
22+
23+
/**
24+
* 查询学生管理
25+
*
26+
* @param id 学生管理主键
27+
* @return 学生管理
28+
*/
29+
@Override
30+
public UmsStudent selectUmsStudentById(Integer id)
31+
{
32+
return umsStudentMapper.selectUmsStudentById(id);
33+
}
34+
35+
/**
36+
* 查询学生管理列表
37+
*
38+
* @param umsStudent 学生管理
39+
* @return 学生管理
40+
*/
41+
@Override
42+
public List<UmsStudent> selectUmsStudentList(UmsStudent umsStudent)
43+
{
44+
return umsStudentMapper.selectUmsStudentList(umsStudent);
45+
}
46+
47+
/**
48+
* 新增学生管理
49+
*
50+
* @param umsStudent 学生管理
51+
* @return 结果
52+
*/
53+
@Override
54+
public int insertUmsStudent(UmsStudent umsStudent)
55+
{
56+
return umsStudentMapper.insertUmsStudent(umsStudent);
57+
}
58+
59+
/**
60+
* 修改学生管理
61+
*
62+
* @param umsStudent 学生管理
63+
* @return 结果
64+
*/
65+
@Override
66+
public int updateUmsStudent(UmsStudent umsStudent)
67+
{
68+
return umsStudentMapper.updateUmsStudent(umsStudent);
69+
}
70+
71+
/**
72+
* 批量删除学生管理
73+
*
74+
* @param ids 需要删除的学生管理主键
75+
* @return 结果
76+
*/
77+
@Override
78+
public int deleteUmsStudentByIds(String ids)
79+
{
80+
return umsStudentMapper.deleteUmsStudentByIds(Convert.toStrArray(ids));
81+
}
82+
83+
/**
84+
* 删除学生管理信息
85+
*
86+
* @param id 学生管理主键
87+
* @return 结果
88+
*/
89+
@Override
90+
public int deleteUmsStudentById(Integer id)
91+
{
92+
return umsStudentMapper.deleteUmsStudentById(id);
93+
}
94+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!DOCTYPE mapper
3+
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4+
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5+
<mapper namespace="com.ruoyi.ums.mapper.UmsClassMapper">
6+
7+
<resultMap type="UmsClass" id="UmsClassResult">
8+
<result property="id" column="id" />
9+
<result property="name" column="name" />
10+
</resultMap>
11+
12+
<sql id="selectUmsClassVo">
13+
select id, name from ums_class
14+
</sql>
15+
16+
<select id="selectUmsClassList" parameterType="UmsClass" resultMap="UmsClassResult">
17+
<include refid="selectUmsClassVo"/>
18+
<where>
19+
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
20+
</where>
21+
</select>
22+
23+
<select id="selectUmsClassById" parameterType="Integer" resultMap="UmsClassResult">
24+
<include refid="selectUmsClassVo"/>
25+
where id = #{id}
26+
</select>
27+
28+
<insert id="insertUmsClass" parameterType="UmsClass" useGeneratedKeys="true" keyProperty="id">
29+
insert into ums_class
30+
<trim prefix="(" suffix=")" suffixOverrides=",">
31+
<if test="name != null and name != ''">name,</if>
32+
</trim>
33+
<trim prefix="values (" suffix=")" suffixOverrides=",">
34+
<if test="name != null and name != ''">#{name},</if>
35+
</trim>
36+
</insert>
37+
38+
<update id="updateUmsClass" parameterType="UmsClass">
39+
update ums_class
40+
<trim prefix="SET" suffixOverrides=",">
41+
<if test="name != null and name != ''">name = #{name},</if>
42+
</trim>
43+
where id = #{id}
44+
</update>
45+
46+
<delete id="deleteUmsClassById" parameterType="Integer">
47+
delete from ums_class where id = #{id}
48+
</delete>
49+
50+
<delete id="deleteUmsClassByIds" parameterType="String">
51+
delete from ums_class where id in
52+
<foreach item="id" collection="array" open="(" separator="," close=")">
53+
#{id}
54+
</foreach>
55+
</delete>
56+
57+
</mapper>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!DOCTYPE mapper
3+
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4+
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5+
<mapper namespace="com.ruoyi.ums.mapper.UmsStudentMapper">
6+
7+
<resultMap type="UmsStudent" id="UmsStudentResult">
8+
<result property="id" column="id" />
9+
<result property="name" column="name" />
10+
<result property="age" column="age" />
11+
<result property="classId" column="class_id" />
12+
</resultMap>
13+
14+
<resultMap type="UmsStudent" id="UmsStudentWithUmsClassResult">
15+
<result property="id" column="id" />
16+
<result property="name" column="name" />
17+
<result property="age" column="age" />
18+
<result property="classId" column="class_id" />
19+
<association property="umsClass" javaType="UmsClass">
20+
<result property="id" column="class_id"/>
21+
<result property="name" column="class_name"/>
22+
</association>
23+
</resultMap>
24+
25+
<sql id="selectUmsStudentVo">
26+
select ums_student.id as id, ums_student.name as name, age, class_id, ums_class.name as class_name from ums_student
27+
left join ums_class on ums_student.class_id = ums_class.id
28+
</sql>
29+
30+
<select id="selectUmsStudentList" parameterType="UmsStudent" resultMap="UmsStudentWithUmsClassResult">
31+
<include refid="selectUmsStudentVo"/>
32+
<where>
33+
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
34+
<if test="age != null "> and age = #{age}</if>
35+
<if test="classId != null "> and class_id = #{classId}</if>
36+
</where>
37+
</select>
38+
39+
<select id="selectUmsStudentById" parameterType="Integer" resultMap="UmsStudentWithUmsClassResult">
40+
<include refid="selectUmsStudentVo"/>
41+
where ums_student.id = #{id}
42+
</select>
43+
44+
<insert id="insertUmsStudent" parameterType="UmsStudent" useGeneratedKeys="true" keyProperty="id">
45+
insert into ums_student
46+
<trim prefix="(" suffix=")" suffixOverrides=",">
47+
<if test="name != null and name != ''">name,</if>
48+
<if test="age != null">age,</if>
49+
<if test="classId != null">class_id,</if>
50+
</trim>
51+
<trim prefix="values (" suffix=")" suffixOverrides=",">
52+
<if test="name != null and name != ''">#{name},</if>
53+
<if test="age != null">#{age},</if>
54+
<if test="classId != null">#{classId},</if>
55+
</trim>
56+
</insert>
57+
58+
<update id="updateUmsStudent" parameterType="UmsStudent">
59+
update ums_student
60+
<trim prefix="SET" suffixOverrides=",">
61+
<if test="name != null and name != ''">name = #{name},</if>
62+
<if test="age != null">age = #{age},</if>
63+
<if test="classId != null">class_id = #{classId},</if>
64+
</trim>
65+
where id = #{id}
66+
</update>
67+
68+
<delete id="deleteUmsStudentById" parameterType="Integer">
69+
delete from ums_student where id = #{id}
70+
</delete>
71+
72+
<delete id="deleteUmsStudentByIds" parameterType="String">
73+
delete from ums_student where id in
74+
<foreach item="id" collection="array" open="(" separator="," close=")">
75+
#{id}
76+
</foreach>
77+
</delete>
78+
79+
</mapper>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
3+
<head>
4+
<th:block th:include="include :: header('新增班级管理')" />
5+
</head>
6+
<body class="white-bg">
7+
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
8+
<form class="form-horizontal m" id="form-umsClass-add">
9+
<div class="col-xs-12">
10+
<div class="form-group">
11+
<label class="col-sm-3 control-label is-required">名称:</label>
12+
<div class="col-sm-8">
13+
<input name="name" class="form-control" type="text" required>
14+
</div>
15+
</div>
16+
</div>
17+
</form>
18+
</div>
19+
<th:block th:include="include :: footer" />
20+
<script th:inline="javascript">
21+
var prefix = ctx + "ums/umsClass"
22+
$("#form-umsClass-add").validate({
23+
focusCleanup: true
24+
});
25+
26+
function submitHandler() {
27+
if ($.validate.form()) {
28+
$.operate.save(prefix + "/add", $('#form-umsClass-add').serialize());
29+
}
30+
}
31+
</script>
32+
</body>
33+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
3+
<head>
4+
<th:block th:include="include :: header('修改班级管理')" />
5+
</head>
6+
<body class="white-bg">
7+
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
8+
<form class="form-horizontal m" id="form-umsClass-edit" th:object="${umsClass}">
9+
<input name="id" th:field="*{id}" type="hidden">
10+
<div class="col-xs-12">
11+
<div class="form-group">
12+
<label class="col-sm-3 control-label is-required">名称:</label>
13+
<div class="col-sm-8">
14+
<input name="name" th:field="*{name}" class="form-control" type="text" required>
15+
</div>
16+
</div>
17+
</div>
18+
</form>
19+
</div>
20+
<th:block th:include="include :: footer" />
21+
<script th:inline="javascript">
22+
var prefix = ctx + "ums/umsClass";
23+
$("#form-umsClass-edit").validate({
24+
focusCleanup: true
25+
});
26+
27+
function submitHandler() {
28+
if ($.validate.form()) {
29+
$.operate.save(prefix + "/edit", $('#form-umsClass-edit').serialize());
30+
}
31+
}
32+
</script>
33+
</body>
34+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<!DOCTYPE html>
2+
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
3+
<head>
4+
<th:block th:include="include :: header('班级管理列表')" />
5+
</head>
6+
<body class="gray-bg">
7+
<div class="container-div">
8+
<div class="row">
9+
<div class="col-sm-12 search-collapse">
10+
<form id="formId">
11+
<div class="select-list">
12+
<ul>
13+
<li>
14+
<label>名称:</label>
15+
<input type="text" name="name"/>
16+
</li>
17+
<li>
18+
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
19+
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
20+
</li>
21+
</ul>
22+
</div>
23+
</form>
24+
</div>
25+
26+
<div class="btn-group-sm" id="toolbar" role="group">
27+
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="ums:umsClass:add">
28+
<i class="fa fa-plus"></i> 添加
29+
</a>
30+
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="ums:umsClass:edit">
31+
<i class="fa fa-edit"></i> 修改
32+
</a>
33+
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="ums:umsClass:remove">
34+
<i class="fa fa-remove"></i> 删除
35+
</a>
36+
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ums:umsClass:export">
37+
<i class="fa fa-download"></i> 导出
38+
</a>
39+
</div>
40+
<div class="col-sm-12 select-table table-striped">
41+
<table id="bootstrap-table"></table>
42+
</div>
43+
</div>
44+
</div>
45+
<th:block th:include="include :: footer" />
46+
<script th:inline="javascript">
47+
var editFlag = [[${@permission.hasPermi('ums:umsClass:edit')}]];
48+
var removeFlag = [[${@permission.hasPermi('ums:umsClass:remove')}]];
49+
var prefix = ctx + "ums/umsClass";
50+
51+
$(function() {
52+
var options = {
53+
url: prefix + "/list",
54+
createUrl: prefix + "/add",
55+
updateUrl: prefix + "/edit/{id}",
56+
removeUrl: prefix + "/remove",
57+
exportUrl: prefix + "/export",
58+
modalName: "班级管理",
59+
columns: [{
60+
checkbox: true
61+
},
62+
{
63+
field: 'id',
64+
title: '编号',
65+
visible: false
66+
},
67+
{
68+
field: 'name',
69+
title: '名称'
70+
},
71+
{
72+
title: '操作',
73+
align: 'center',
74+
formatter: function(value, row, index) {
75+
var actions = [];
76+
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
77+
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
78+
return actions.join('');
79+
}
80+
}]
81+
};
82+
$.table.init(options);
83+
});
84+
</script>
85+
</body>
86+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!DOCTYPE html>
2+
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
3+
<head>
4+
<th:block th:include="include :: header('新增学生管理')" />
5+
</head>
6+
<body class="white-bg">
7+
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
8+
<form class="form-horizontal m" id="form-umsStudent-add">
9+
<div class="col-xs-12">
10+
<div class="form-group">
11+
<label class="col-sm-3 control-label is-required">名称:</label>
12+
<div class="col-sm-8">
13+
<input name="name" class="form-control" type="text" required>
14+
</div>
15+
</div>
16+
</div>
17+
<div class="col-xs-12">
18+
<div class="form-group">
19+
<label class="col-sm-3 control-label is-required">年龄:</label>
20+
<div class="col-sm-8">
21+
<input name="age" class="form-control" type="text" required>
22+
</div>
23+
</div>
24+
</div>
25+
<div class="col-xs-12">
26+
<div class="form-group">
27+
<label class="col-sm-3 control-label is-required">班级:</label>
28+
<div class="col-sm-8">
29+
<select name="classId" class="form-control">
30+
<option th:each="item : ${umsClasses}" th:text="${item.name}" th:value="${item.id}"/>
31+
</select>
32+
</div>
33+
</div>
34+
</div>
35+
</form>
36+
</div>
37+
<th:block th:include="include :: footer" />
38+
<script th:inline="javascript">
39+
var prefix = ctx + "ums/umsStudent"
40+
$("#form-umsStudent-add").validate({
41+
focusCleanup: true
42+
});
43+
44+
function submitHandler() {
45+
if ($.validate.form()) {
46+
$.operate.save(prefix + "/add", $('#form-umsStudent-add').serialize());
47+
}
48+
}
49+
</script>
50+
</body>
51+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE html>
2+
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
3+
<head>
4+
<th:block th:include="include :: header('修改学生管理')" />
5+
</head>
6+
<body class="white-bg">
7+
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
8+
<form class="form-horizontal m" id="form-umsStudent-edit" th:object="${umsStudent}">
9+
<input name="id" th:field="*{id}" type="hidden">
10+
<div class="col-xs-12">
11+
<div class="form-group">
12+
<label class="col-sm-3 control-label is-required">名称:</label>
13+
<div class="col-sm-8">
14+
<input name="name" th:field="*{name}" class="form-control" type="text" required>
15+
</div>
16+
</div>
17+
</div>
18+
<div class="col-xs-12">
19+
<div class="form-group">
20+
<label class="col-sm-3 control-label is-required">年龄:</label>
21+
<div class="col-sm-8">
22+
<input name="age" th:field="*{age}" class="form-control" type="text" required>
23+
</div>
24+
</div>
25+
</div>
26+
<div class="col-xs-12">
27+
<div class="form-group">
28+
<label class="col-sm-3 control-label is-required">班级:</label>
29+
<div class="col-sm-8">
30+
<select name="classId" class="form-control">
31+
<option th:each="item : ${umsClasses}" th:text="${item.name}" th:value="${item.id}" th:field="*{classId}"/>
32+
</select>
33+
</div>
34+
</div>
35+
</div>
36+
</form>
37+
</div>
38+
<th:block th:include="include :: footer" />
39+
<script th:inline="javascript">
40+
var prefix = ctx + "ums/umsStudent";
41+
$("#form-umsStudent-edit").validate({
42+
focusCleanup: true
43+
});
44+
45+
function submitHandler() {
46+
if ($.validate.form()) {
47+
$.operate.save(prefix + "/edit", $('#form-umsStudent-edit').serialize());
48+
}
49+
}
50+
</script>
51+
</body>
52+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<!DOCTYPE html>
2+
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
3+
<head>
4+
<th:block th:include="include :: header('学生管理列表')" />
5+
</head>
6+
<body class="gray-bg">
7+
<div class="container-div">
8+
<div class="row">
9+
<div class="col-sm-12 search-collapse">
10+
<form id="formId">
11+
<div class="select-list">
12+
<ul>
13+
<li>
14+
<label>名称:</label>
15+
<input type="text" name="name"/>
16+
</li>
17+
<li>
18+
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
19+
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
20+
</li>
21+
</ul>
22+
</div>
23+
</form>
24+
</div>
25+
26+
<div class="btn-group-sm" id="toolbar" role="group">
27+
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="ums:umsStudent:add">
28+
<i class="fa fa-plus"></i> 添加
29+
</a>
30+
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="ums:umsStudent:edit">
31+
<i class="fa fa-edit"></i> 修改
32+
</a>
33+
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="ums:umsStudent:remove">
34+
<i class="fa fa-remove"></i> 删除
35+
</a>
36+
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ums:umsStudent:export">
37+
<i class="fa fa-download"></i> 导出
38+
</a>
39+
</div>
40+
<div class="col-sm-12 select-table table-striped">
41+
<table id="bootstrap-table"></table>
42+
</div>
43+
</div>
44+
</div>
45+
<th:block th:include="include :: footer" />
46+
<script th:inline="javascript">
47+
var editFlag = [[${@permission.hasPermi('ums:umsStudent:edit')}]];
48+
var removeFlag = [[${@permission.hasPermi('ums:umsStudent:remove')}]];
49+
var prefix = ctx + "ums/umsStudent";
50+
51+
$(function() {
52+
var options = {
53+
url: prefix + "/list",
54+
createUrl: prefix + "/add",
55+
updateUrl: prefix + "/edit/{id}",
56+
removeUrl: prefix + "/remove",
57+
exportUrl: prefix + "/export",
58+
modalName: "学生管理",
59+
columns: [{
60+
checkbox: true
61+
},
62+
{
63+
field: 'id',
64+
title: '编号',
65+
visible: false
66+
},
67+
{
68+
field: 'name',
69+
title: '名称'
70+
},
71+
{
72+
field: 'age',
73+
title: '年龄'
74+
},
75+
{
76+
field: 'classId',
77+
title: '班级编号',
78+
visible: false
79+
},
80+
{
81+
field: 'umsClass.name',
82+
title: '班级名称',
83+
},
84+
{
85+
title: '操作',
86+
align: 'center',
87+
formatter: function(value, row, index) {
88+
var actions = [];
89+
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
90+
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
91+
return actions.join('');
92+
}
93+
}]
94+
};
95+
$.table.init(options);
96+
});
97+
</script>
98+
</body>
99+
</html>

0 commit comments

Comments
 (0)
Please sign in to comment.