Pre Merge pull request !462 from MHL/mhl

pull/462/MERGE
MHL 2023-08-13 06:58:56 +00:00 committed by Gitee
commit fe50a4a10c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 757 additions and 1 deletions

View File

@ -14,6 +14,7 @@ public class RuoYiApplication
{
public static void main(String[] args)
{
/*mahailong yyds dwbbawidbaicA;fihwbekCN*/
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +

View File

@ -0,0 +1,127 @@
package com.ruoyi.system.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.system.domain.JdStudent;
import com.ruoyi.system.service.IJdStudentService;
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-07-07
*/
@Controller
@RequestMapping("/system/student")
public class JdStudentController extends BaseController
{
private String prefix = "system/student";
@Autowired
private IJdStudentService jdStudentService;
@RequiresPermissions("system:student:view")
@GetMapping()
public String student()
{
return prefix + "/student";
}
/**
*
*/
@RequiresPermissions("system:student:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(JdStudent jdStudent)
{
startPage();
List<JdStudent> list = jdStudentService.selectJdStudentList(jdStudent);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:student:export")
@Log(title = "交大学生数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(JdStudent jdStudent)
{
List<JdStudent> list = jdStudentService.selectJdStudentList(jdStudent);
ExcelUtil<JdStudent> util = new ExcelUtil<JdStudent>(JdStudent.class);
return util.exportExcel(list, "交大学生数据数据");
}
/**
*
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
*
*/
@RequiresPermissions("system:student:add")
@Log(title = "交大学生数据", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(JdStudent jdStudent)
{
return toAjax(jdStudentService.insertJdStudent(jdStudent));
}
/**
*
*/
@RequiresPermissions("system:student:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
JdStudent jdStudent = jdStudentService.selectJdStudentById(id);
mmap.put("jdStudent", jdStudent);
return prefix + "/edit";
}
/**
*
*/
@RequiresPermissions("system:student:edit")
@Log(title = "交大学生数据", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(JdStudent jdStudent)
{
return toAjax(jdStudentService.updateJdStudent(jdStudent));
}
/**
*
*/
@RequiresPermissions("system:student:remove")
@Log(title = "交大学生数据", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(jdStudentService.deleteJdStudentByIds(ids));
}
}

View File

@ -0,0 +1,96 @@
package com.ruoyi.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* jd_student
*
* @author ruoyi
* @date 2023-07-07
*/
public class JdStudent extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 姓名 */
@Excel(name = "姓名")
private String name;
/** 性别 */
@Excel(name = "性别")
private String sex;
/** 入学时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "入学时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 描述 */
@Excel(name = "描述")
private String description;
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 setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("sex", getSex())
.append("startTime", getStartTime())
.append("description", getDescription())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.JdStudent;
/**
* Mapper
*
* @author ruoyi
* @date 2023-07-07
*/
public interface JdStudentMapper
{
/**
*
*
* @param id
* @return
*/
public JdStudent selectJdStudentById(Long id);
/**
*
*
* @param jdStudent
* @return
*/
public List<JdStudent> selectJdStudentList(JdStudent jdStudent);
/**
*
*
* @param jdStudent
* @return
*/
public int insertJdStudent(JdStudent jdStudent);
/**
*
*
* @param jdStudent
* @return
*/
public int updateJdStudent(JdStudent jdStudent);
/**
*
*
* @param id
* @return
*/
public int deleteJdStudentById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteJdStudentByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.JdStudent;
/**
* Service
*
* @author ruoyi
* @date 2023-07-07
*/
public interface IJdStudentService
{
/**
*
*
* @param id
* @return
*/
public JdStudent selectJdStudentById(Long id);
/**
*
*
* @param jdStudent
* @return
*/
public List<JdStudent> selectJdStudentList(JdStudent jdStudent);
/**
*
*
* @param jdStudent
* @return
*/
public int insertJdStudent(JdStudent jdStudent);
/**
*
*
* @param jdStudent
* @return
*/
public int updateJdStudent(JdStudent jdStudent);
/**
*
*
* @param ids
* @return
*/
public int deleteJdStudentByIds(String ids);
/**
*
*
* @param id
* @return
*/
public int deleteJdStudentById(Long id);
}

View File

@ -0,0 +1,94 @@
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.JdStudentMapper;
import com.ruoyi.system.domain.JdStudent;
import com.ruoyi.system.service.IJdStudentService;
import com.ruoyi.common.core.text.Convert;
/**
* Service
*
* @author ruoyi
* @date 2023-07-07
*/
@Service
public class JdStudentServiceImpl implements IJdStudentService
{
@Autowired
private JdStudentMapper jdStudentMapper;
/**
*
*
* @param id
* @return
*/
@Override
public JdStudent selectJdStudentById(Long id)
{
return jdStudentMapper.selectJdStudentById(id);
}
/**
*
*
* @param jdStudent
* @return
*/
@Override
public List<JdStudent> selectJdStudentList(JdStudent jdStudent)
{
return jdStudentMapper.selectJdStudentList(jdStudent);
}
/**
*
*
* @param jdStudent
* @return
*/
@Override
public int insertJdStudent(JdStudent jdStudent)
{
return jdStudentMapper.insertJdStudent(jdStudent);
}
/**
*
*
* @param jdStudent
* @return
*/
@Override
public int updateJdStudent(JdStudent jdStudent)
{
return jdStudentMapper.updateJdStudent(jdStudent);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteJdStudentByIds(String ids)
{
return jdStudentMapper.deleteJdStudentByIds(Convert.toStrArray(ids));
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteJdStudentById(Long id)
{
return jdStudentMapper.deleteJdStudentById(id);
}
}

View File

@ -8,7 +8,7 @@ spring:
master:
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: password
password: root
# 从库数据源
slave:
# 从数据源开关/默认关闭

View File

@ -0,0 +1,74 @@
<?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.system.mapper.JdStudentMapper">
<resultMap type="JdStudent" id="JdStudentResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="sex" column="sex" />
<result property="startTime" column="start_time" />
<result property="description" column="description" />
</resultMap>
<sql id="selectJdStudentVo">
select id, name, sex, start_time, description from jd_student
</sql>
<select id="selectJdStudentList" parameterType="JdStudent" resultMap="JdStudentResult">
<include refid="selectJdStudentVo"/>
<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="startTime != null "> and start_time = #{startTime}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
</where>
</select>
<select id="selectJdStudentById" parameterType="Long" resultMap="JdStudentResult">
<include refid="selectJdStudentVo"/>
where id = #{id}
</select>
<insert id="insertJdStudent" parameterType="JdStudent">
insert into jd_student
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null">name,</if>
<if test="sex != null">sex,</if>
<if test="startTime != null">start_time,</if>
<if test="description != null">description,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null">#{name},</if>
<if test="sex != null">#{sex},</if>
<if test="startTime != null">#{startTime},</if>
<if test="description != null">#{description},</if>
</trim>
</insert>
<update id="updateJdStudent" parameterType="JdStudent">
update jd_student
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="description != null">description = #{description},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteJdStudentById" parameterType="Long">
delete from jd_student where id = #{id}
</delete>
<delete id="deleteJdStudentByIds" parameterType="String">
delete from jd_student where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增交大学生数据')" />
<th:block th:include="include :: datetimepicker-css" />
</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">
<select name="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">入学时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="startTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">描述:</label>
<div class="col-sm-8">
<input name="description" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "system/student"
$("#form-student-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-student-add').serialize());
}
}
$("input[name='startTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改交大学生数据')" />
<th:block th:include="include :: datetimepicker-css" />
</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="${jdStudent}">
<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">
<select name="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{sex}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">入学时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="startTime" th:value="${#dates.format(jdStudent.startTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">描述:</label>
<div class="col-sm-8">
<input name="description" th:field="*{description}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "system/student";
$("#form-student-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-student-edit').serialize());
}
}
$("input[name='startTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -0,0 +1,117 @@
<!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>
<select name="sex" th:with="type=${@dict.getType('sys_user_sex')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>入学时间:</label>
<input type="text" class="time-input" placeholder="请选择入学时间" name="startTime"/>
</li>
<li>
<label>描述:</label>
<input type="text" name="description"/>
</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="system:student:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:student:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:student:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system: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('system:student:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:student:remove')}]];
var sexDatas = [[${@dict.getType('sys_user_sex')}]];
var prefix = ctx + "system/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: '主键',
visible: false
},
{
field: 'name',
title: '姓名'
},
{
field: 'sex',
title: '性别',
formatter: function(value, row, index) {
return $.table.selectDictLabel(sexDatas, value);
}
},
{
field: 'startTime',
title: '入学时间'
},
{
field: 'description',
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>