第一次

master
邓川江 2023-04-17 22:46:11 +08:00
parent 6da52c2c4c
commit 82796de6fc
14 changed files with 826 additions and 2 deletions

26
cs_student/pom.xml Normal file
View File

@ -0,0 +1,26 @@
<?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>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>4.7.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cs_student</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,127 @@
package com.ruoyi.edu.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.edu.domain.CsStudent;
import com.ruoyi.edu.service.ICsStudentService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-04-17
*/
@Controller
@RequestMapping("/edu/student")
public class CsStudentController extends BaseController
{
private String prefix = "edu/student";
@Autowired
private ICsStudentService csStudentService;
@RequiresPermissions("edu:student:view")
@GetMapping()
public String student()
{
return prefix + "/student";
}
/**
*
*/
@RequiresPermissions("edu:student:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(CsStudent csStudent)
{
startPage();
List<CsStudent> list = csStudentService.selectCsStudentList(csStudent);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("edu:student:export")
@Log(title = "学生管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(CsStudent csStudent)
{
List<CsStudent> list = csStudentService.selectCsStudentList(csStudent);
ExcelUtil<CsStudent> util = new ExcelUtil<CsStudent>(CsStudent.class);
return util.exportExcel(list, "学生管理数据");
}
/**
*
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
*
*/
@RequiresPermissions("edu:student:add")
@Log(title = "学生管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(CsStudent csStudent)
{
return toAjax(csStudentService.insertCsStudent(csStudent));
}
/**
*
*/
@RequiresPermissions("edu:student:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
CsStudent csStudent = csStudentService.selectCsStudentById(id);
mmap.put("csStudent", csStudent);
return prefix + "/edit";
}
/**
*
*/
@RequiresPermissions("edu:student:edit")
@Log(title = "学生管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(CsStudent csStudent)
{
return toAjax(csStudentService.updateCsStudent(csStudent));
}
/**
*
*/
@RequiresPermissions("edu:student:remove")
@Log(title = "学生管理", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(csStudentService.deleteCsStudentByIds(ids));
}
}

View File

@ -0,0 +1,107 @@
package com.ruoyi.edu.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;
/**
* cs_student
*
* @author ruoyi
* @date 2023-04-17
*/
public class CsStudent extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 姓名 */
@Excel(name = "姓名")
private String name;
/** 性别 */
@Excel(name = "性别")
private String sex;
/** 年龄 */
@Excel(name = "年龄")
private String age;
/** 部门 */
@Excel(name = "部门")
private String depart;
/** 班级 */
@Excel(name = "班级")
private String cclass;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setSex(String sex)
{
this.sex = sex;
}
public String getSex()
{
return sex;
}
public void setAge(String age)
{
this.age = age;
}
public String getAge()
{
return age;
}
public void setDepart(String depart)
{
this.depart = depart;
}
public String getDepart()
{
return depart;
}
public void setCclass(String cclass)
{
this.cclass = cclass;
}
public String getCclass()
{
return cclass;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("sex", getSex())
.append("age", getAge())
.append("depart", getDepart())
.append("cclass", getCclass())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.edu.mapper;
import java.util.List;
import com.ruoyi.edu.domain.CsStudent;
/**
* Mapper
*
* @author ruoyi
* @date 2023-04-17
*/
public interface CsStudentMapper
{
/**
*
*
* @param id
* @return
*/
public CsStudent selectCsStudentById(Long id);
/**
*
*
* @param csStudent
* @return
*/
public List<CsStudent> selectCsStudentList(CsStudent csStudent);
/**
*
*
* @param csStudent
* @return
*/
public int insertCsStudent(CsStudent csStudent);
/**
*
*
* @param csStudent
* @return
*/
public int updateCsStudent(CsStudent csStudent);
/**
*
*
* @param id
* @return
*/
public int deleteCsStudentById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteCsStudentByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.edu.service;
import java.util.List;
import com.ruoyi.edu.domain.CsStudent;
/**
* Service
*
* @author ruoyi
* @date 2023-04-17
*/
public interface ICsStudentService
{
/**
*
*
* @param id
* @return
*/
public CsStudent selectCsStudentById(Long id);
/**
*
*
* @param csStudent
* @return
*/
public List<CsStudent> selectCsStudentList(CsStudent csStudent);
/**
*
*
* @param csStudent
* @return
*/
public int insertCsStudent(CsStudent csStudent);
/**
*
*
* @param csStudent
* @return
*/
public int updateCsStudent(CsStudent csStudent);
/**
*
*
* @param ids
* @return
*/
public int deleteCsStudentByIds(String ids);
/**
*
*
* @param id
* @return
*/
public int deleteCsStudentById(Long id);
}

View File

@ -0,0 +1,94 @@
package com.ruoyi.edu.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.edu.mapper.CsStudentMapper;
import com.ruoyi.edu.domain.CsStudent;
import com.ruoyi.edu.service.ICsStudentService;
import com.ruoyi.common.core.text.Convert;
/**
* Service
*
* @author ruoyi
* @date 2023-04-17
*/
@Service
public class CsStudentServiceImpl implements ICsStudentService
{
@Autowired
private CsStudentMapper csStudentMapper;
/**
*
*
* @param id
* @return
*/
@Override
public CsStudent selectCsStudentById(Long id)
{
return csStudentMapper.selectCsStudentById(id);
}
/**
*
*
* @param csStudent
* @return
*/
@Override
public List<CsStudent> selectCsStudentList(CsStudent csStudent)
{
return csStudentMapper.selectCsStudentList(csStudent);
}
/**
*
*
* @param csStudent
* @return
*/
@Override
public int insertCsStudent(CsStudent csStudent)
{
return csStudentMapper.insertCsStudent(csStudent);
}
/**
*
*
* @param csStudent
* @return
*/
@Override
public int updateCsStudent(CsStudent csStudent)
{
return csStudentMapper.updateCsStudent(csStudent);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteCsStudentByIds(String ids)
{
return csStudentMapper.deleteCsStudentByIds(Convert.toStrArray(ids));
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteCsStudentById(Long id)
{
return csStudentMapper.deleteCsStudentById(id);
}
}

View File

@ -0,0 +1,77 @@
<?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="com.ruoyi.edu.mapper.CsStudentMapper">
<resultMap type="CsStudent" id="CsStudentResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="sex" column="sex" />
<result property="age" column="age" />
<result property="depart" column="depart" />
<result property="cclass" column="cclass" />
</resultMap>
<sql id="selectCsStudentVo">
select id, name, sex, age, depart, cclass from cs_student
</sql>
<select id="selectCsStudentList" parameterType="CsStudent" resultMap="CsStudentResult">
<include refid="selectCsStudentVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="sex != null and sex != ''"> and sex = #{sex}</if>
<if test="age != null and age != ''"> and age = #{age}</if>
<if test="depart != null and depart != ''"> and depart = #{depart}</if>
<if test="cclass != null and cclass != ''"> and cclass = #{cclass}</if>
</where>
</select>
<select id="selectCsStudentById" parameterType="Long" resultMap="CsStudentResult">
<include refid="selectCsStudentVo"/>
where id = #{id}
</select>
<insert id="insertCsStudent" parameterType="CsStudent" useGeneratedKeys="true" keyProperty="id">
insert into cs_student
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="sex != null">sex,</if>
<if test="age != null">age,</if>
<if test="depart != null">depart,</if>
<if test="cclass != null">cclass,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="sex != null">#{sex},</if>
<if test="age != null">#{age},</if>
<if test="depart != null">#{depart},</if>
<if test="cclass != null">#{cclass},</if>
</trim>
</insert>
<update id="updateCsStudent" parameterType="CsStudent">
update cs_student
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="age != null">age = #{age},</if>
<if test="depart != null">depart = #{depart},</if>
<if test="cclass != null">cclass = #{cclass},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCsStudentById" parameterType="Long">
delete from cs_student where id = #{id}
</delete>
<delete id="deleteCsStudentByIds" parameterType="String">
delete from cs_student where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增学生管理')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-student-add">
<div class="form-group">
<label class="col-sm-3 control-label">姓名:</label>
<div class="col-sm-8">
<input name="name" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">性别:</label>
<div class="col-sm-8">
<!-- <input name="sex" class="form-control" type="text">-->
<select name="sex" class="form-control" type="text">
<option value="男"></option>
<option value="女"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">年龄:</label>
<div class="col-sm-8">
<input name="age" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">部门:</label>
<div class="col-sm-8">
<!-- <input name="depart" class="form-control" type="text">-->
<select name="depart" class="form-control" type="text">
<option value="软件工程">软件工程</option>
<option value="大数据">大数据</option>
<option value="人工智能">人工智能</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">班级:</label>
<div class="col-sm-8">
<!-- <input name="cclass" class="form-control" type="text">-->
<select name="cclass" class="form-control" type="text">
<option value="20J01">20J01</option>
<option value="20J02">20J02</option>
<option value="20H05">20H05</option>
<option value="20游05">20游05</option>
<option value="20J05">20J05</option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "edu/student"
$("#form-student-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-student-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改学生管理')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-student-edit" th:object="${csStudent}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">姓名:</label>
<div class="col-sm-8">
<input name="name" th:field="*{name}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">性别:</label>
<div class="col-sm-8">
<!-- <input name="sex" th:field="*{sex}" class="form-control" type="text">-->
<select name="sex" th:field="*{sex}" class="form-control" type="text">
<option value="男"></option>
<option value="女"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">年龄:</label>
<div class="col-sm-8">
<input name="age" th:field="*{age}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">部门:</label>
<div class="col-sm-8">
<!-- <input name="depart" th:field="*{depart}" class="form-control" type="text">-->
<select name="depart" th:field="*{depart}" class="form-control" type="text">
<option value="软件工程">软件工程</option>
<option value="大数据">大数据</option>
<option value="人工智能">人工智能</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">班级:</label>
<div class="col-sm-8">
<!-- <input name="cclass" th:field="*{cclass}" class="form-control" type="text">-->
<select name="cclass" th:field="*{cclass}" class="form-control" type="text">
<option value="20J01">20J01</option>
<option value="20J02">20J02</option>
<option value="20H05">20H05</option>
<option value="20游05">20游05</option>
<option value="20J05">20J05</option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "edu/student";
$("#form-student-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-student-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,118 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('学生管理列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>姓名:</label>
<input type="text" name="name"/>
</li>
<li>
<label>性别:</label>
<input type="text" name="sex"/>
</li>
<li>
<label>年龄:</label>
<input type="text" name="age"/>
</li>
<li>
<label>部门:</label>
<input type="text" name="depart"/>
</li>
<li>
<label>班级:</label>
<input type="text" name="cclass"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="edu:student:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="edu:student:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="edu:student:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="edu:student:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('edu:student:edit')}]];
var removeFlag = [[${@permission.hasPermi('edu:student:remove')}]];
var prefix = ctx + "edu/student";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "学生管理",
columns: [{
checkbox: true
},
{
field: 'id',
title: 'id',
visible: false
},
{
field: 'name',
title: '姓名'
},
{
field: 'sex',
title: '性别'
},
{
field: 'age',
title: '年龄'
},
{
field: 'depart',
title: '部门'
},
{
field: 'cclass',
title: '班级'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
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> ');
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>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -171,6 +171,11 @@
<artifactId>cs_test1</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>cs_student</artifactId>
<version>${ruoyi.version}</version>
</dependency>
<!-- 核心模块-->
<dependency>
@ -205,6 +210,7 @@
<module>ruoyi-common</module>
<module>cs_test</module>
<module>cs_test1</module>
<module>cs_student</module>
</modules>
<packaging>pom</packaging>

View File

@ -76,6 +76,10 @@
<groupId>com.ruoyi</groupId>
<artifactId>cs_test1</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>cs_student</artifactId>
</dependency>
</dependencies>

View File

@ -98,7 +98,7 @@ shiro:
# 首页地址
indexUrl: /index
# 验证码开关
captchaEnabled: true
captchaEnabled: false
# 验证码类型 math 数组计算 char 字符
captchaType: math
cookie:

View File

@ -4,7 +4,7 @@ gen:
# 作者
author: ruoyi
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: com.ruoyi.system
packageName: com.ruoyi.edu
# 自动去除表前缀默认是false
autoRemovePre: false
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)