添加:单表演示程序,支持mybatis-flex
This commit is contained in:
parent
f34c143499
commit
faebcb7a6a
44
flex-ui/src/api/mf/student.js
Normal file
44
flex-ui/src/api/mf/student.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询学生信息表列表
|
||||
export function listStudent(query) {
|
||||
return request({
|
||||
url: '/mf/student/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询学生信息表详细
|
||||
export function getStudent(studentId) {
|
||||
return request({
|
||||
url: '/mf/student/' + studentId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增学生信息表
|
||||
export function addStudent(data) {
|
||||
return request({
|
||||
url: '/mf/student',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改学生信息表
|
||||
export function updateStudent(data) {
|
||||
return request({
|
||||
url: '/mf/student',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除学生信息表
|
||||
export function delStudent(studentId) {
|
||||
return request({
|
||||
url: '/mf/student/' + studentId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
336
flex-ui/src/views/mf/student/index.vue
Normal file
336
flex-ui/src/views/mf/student/index.vue
Normal file
@ -0,0 +1,336 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="学生名称" prop="studentName">
|
||||
<el-input
|
||||
v-model="queryParams.studentName"
|
||||
placeholder="请输入学生名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="studentStatus">
|
||||
<el-select v-model="queryParams.studentStatus" placeholder="请选择状态" clearable>
|
||||
<el-option
|
||||
v-for="dict in sys_student_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['mf:student:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['mf:student:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['mf:student:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['mf:student:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="studentList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="编号" align="center" prop="studentId" />
|
||||
<el-table-column label="学生名称" align="center" prop="studentName" />
|
||||
<el-table-column label="年龄" align="center" prop="studentAge" />
|
||||
<el-table-column label="爱好" align="center" prop="studentHobby">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_student_hobby" :value="scope.row.studentHobby"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="性别" align="center" prop="studentGender">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_user_gender" :value="scope.row.studentGender"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="studentStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_student_status" :value="scope.row.studentStatus"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="生日" align="center" prop="studentBirthday" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.studentBirthday, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['mf:student:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['mf:student:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改学生信息表对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="780px" append-to-body>
|
||||
<el-form ref="studentRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="学生名称" prop="studentName">
|
||||
<el-input v-model="form.studentName" placeholder="请输入学生名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="年龄" prop="studentAge">
|
||||
<el-input v-model="form.studentAge" placeholder="请输入年龄" />
|
||||
</el-form-item>
|
||||
<el-form-item label="爱好" prop="studentHobby">
|
||||
<el-select v-model="form.studentHobby" placeholder="请选择爱好">
|
||||
<el-option
|
||||
v-for="dict in sys_student_hobby"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="性别" prop="studentGender">
|
||||
<el-radio-group v-model="form.studentGender">
|
||||
<el-radio
|
||||
v-for="dict in sys_user_gender"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="studentStatus">
|
||||
<el-select v-model="form.studentStatus" placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="dict in sys_student_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="生日" prop="studentBirthday">
|
||||
<el-date-picker clearable
|
||||
v-model="form.studentBirthday"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择生日">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Student">
|
||||
import { listStudent, getStudent, delStudent, addStudent, updateStudent } from "@/api/mf/student";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_student_status, sys_user_gender, sys_student_hobby } = proxy.useDict('sys_student_status', 'sys_user_gender', 'sys_student_hobby');
|
||||
|
||||
// 表格数据
|
||||
const studentList = ref([]);
|
||||
// 是否显示弹出层
|
||||
const open = ref(false);
|
||||
// 遮罩层
|
||||
const loading = ref(true);
|
||||
// 显示搜索条件
|
||||
const showSearch = ref(true);
|
||||
// 选中数组
|
||||
const ids = ref([]);
|
||||
// 非单个禁用
|
||||
const single = ref(true);
|
||||
// 非多个禁用
|
||||
const multiple = ref(true);
|
||||
// 总条数
|
||||
const total = ref(0);
|
||||
// 弹出层标题
|
||||
const title = ref("");
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
studentName: null,
|
||||
studentStatus: null,
|
||||
},
|
||||
rules: {
|
||||
studentName: [
|
||||
{ required: true, message: "学生名称不能为空", trigger: "blur" }
|
||||
],
|
||||
studentAge: [
|
||||
{ required: true, message: "年龄不能为空", trigger: "blur" }
|
||||
],
|
||||
studentHobby: [
|
||||
{ required: true, message: "爱好不能为空", trigger: "change" }
|
||||
],
|
||||
studentGender: [
|
||||
{ required: true, message: "性别不能为空", trigger: "change" }
|
||||
],
|
||||
studentStatus: [
|
||||
{ required: true, message: "状态不能为空", trigger: "change" }
|
||||
],
|
||||
studentBirthday: [
|
||||
{ required: true, message: "生日不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询学生信息表列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listStudent(queryParams.value).then(response => {
|
||||
studentList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
studentId: null,
|
||||
studentName: null,
|
||||
studentAge: null,
|
||||
studentHobby: null,
|
||||
studentGender: null,
|
||||
studentStatus: null,
|
||||
studentBirthday: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
proxy.resetForm("studentRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.studentId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加学生信息表";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const _studentId = row.studentId || ids.value
|
||||
getStudent(_studentId).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改学生信息表";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["studentRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.studentId != null) {
|
||||
updateStudent(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addStudent(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _studentIds = row.studentId || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除学生信息表编号为"' + _studentIds + '"的数据项?').then(function() {
|
||||
return delStudent(_studentIds);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('mf/student/export', {
|
||||
...queryParams.value
|
||||
}, `student_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
@ -32,6 +32,16 @@
|
||||
<artifactId>ruoyi-common-springdoc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -0,0 +1,116 @@
|
||||
package com.ruoyi.mf.controller;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.ruoyi.common.core.core.domain.R;
|
||||
import com.ruoyi.common.excel.utils.ExcelUtil;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.web.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.web.core.BaseController;
|
||||
import jakarta.annotation.Resource;
|
||||
import com.ruoyi.mf.domain.vo.MfStudentVo;
|
||||
import com.ruoyi.mf.domain.bo.MfStudentBo;
|
||||
import com.ruoyi.mf.service.IMfStudentService;
|
||||
|
||||
import com.ruoyi.common.orm.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 学生信息表Controller
|
||||
*
|
||||
* @author 数据小王子
|
||||
* 2023-11-22
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/mf/student")
|
||||
public class MfStudentController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IMfStudentService mfStudentService;
|
||||
|
||||
/**
|
||||
* 查询学生信息表列表
|
||||
*/
|
||||
@SaCheckPermission("mf:student:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<MfStudentVo> list(MfStudentBo mfStudentBo)
|
||||
{
|
||||
return mfStudentService.selectPage(mfStudentBo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出学生信息表列表
|
||||
*/
|
||||
@SaCheckPermission("mf:student:export")
|
||||
@Log(title = "学生信息表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MfStudentBo mfStudentBo)
|
||||
{
|
||||
List<MfStudentVo> list = mfStudentService.selectList(mfStudentBo);
|
||||
ExcelUtil.exportExcel(list, "学生信息表", MfStudentVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取学生信息表详细信息
|
||||
*/
|
||||
@SaCheckPermission("mf:student:query")
|
||||
@GetMapping(value = "/{studentId}")
|
||||
public R<MfStudentVo> getInfo(@PathVariable Long studentId)
|
||||
{
|
||||
return R.ok(mfStudentService.selectById(studentId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增学生信息表
|
||||
*/
|
||||
@SaCheckPermission("mf:student:add")
|
||||
@Log(title = "学生信息表", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody MfStudentBo mfStudentBo)
|
||||
{
|
||||
boolean inserted = mfStudentService.insert(mfStudentBo);
|
||||
if (!inserted) {
|
||||
return R.fail("新增学生信息表记录失败!");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改学生信息表
|
||||
*/
|
||||
@SaCheckPermission("mf:student:edit")
|
||||
@Log(title = "学生信息表", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody MfStudentBo mfStudentBo)
|
||||
{
|
||||
Boolean updated = mfStudentService.update(mfStudentBo);
|
||||
if (!updated) {
|
||||
R.fail("修改学生信息表记录失败!");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除学生信息表
|
||||
*/
|
||||
@SaCheckPermission("mf:student:remove")
|
||||
@Log(title = "学生信息表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{studentIds}")
|
||||
public R<Void> remove(@PathVariable Long[] studentIds)
|
||||
{
|
||||
boolean deleted = mfStudentService.deleteByIds(studentIds);
|
||||
if (!deleted) {
|
||||
R.fail("删除学生信息表记录失败!");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.ruoyi.mf.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 学生信息表对象 mf_student
|
||||
*
|
||||
* @author 数据小王子
|
||||
* 2023-11-22
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(value = "mf_student")
|
||||
public class MfStudent extends BaseEntity
|
||||
{
|
||||
/** 编号 */
|
||||
@Id
|
||||
private Long studentId;
|
||||
|
||||
/** 学生名称 */
|
||||
private String studentName;
|
||||
|
||||
/** 年龄 */
|
||||
private Long studentAge;
|
||||
|
||||
/** 爱好(0代码 1音乐 2电影) */
|
||||
private String studentHobby;
|
||||
|
||||
/** 性别(1男 2女 3未知) */
|
||||
private String studentGender;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
private String studentStatus;
|
||||
|
||||
/** 生日 */
|
||||
private Date studentBirthday;
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.ruoyi.mf.domain.bo;
|
||||
|
||||
import com.ruoyi.mf.domain.MfStudent;
|
||||
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 学生信息表业务对象 mf_student
|
||||
*
|
||||
* @author 数据小王子
|
||||
* @date 2023-11-22
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = MfStudent.class, reverseConvertGenerate = false)
|
||||
public class MfStudentBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 学生名称
|
||||
*/
|
||||
@NotBlank(message = "学生名称不能为空")
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
@NotNull(message = "年龄不能为空")
|
||||
private Long studentAge;
|
||||
|
||||
/**
|
||||
* 爱好(0代码 1音乐 2电影)
|
||||
*/
|
||||
@NotBlank(message = "爱好(0代码 1音乐 2电影)不能为空")
|
||||
private String studentHobby;
|
||||
|
||||
/**
|
||||
* 性别(1男 2女 3未知)
|
||||
*/
|
||||
@NotBlank(message = "性别(1男 2女 3未知)不能为空")
|
||||
private String studentGender;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
@NotBlank(message = "状态(0正常 1停用)不能为空")
|
||||
private String studentStatus;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
@NotNull(message = "生日不能为空")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date studentBirthday;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.ruoyi.mf.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.mf.domain.MfStudent;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.ruoyi.common.excel.annotation.ExcelDictFormat;
|
||||
import com.ruoyi.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 学生信息表视图对象 mf_student
|
||||
*
|
||||
* @author 数据小王子
|
||||
* @date 2023-11-22
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = MfStudent.class)
|
||||
public class MfStudentVo extends BaseEntity implements Serializable
|
||||
{
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 编号 */
|
||||
@ExcelProperty(value = "编号")
|
||||
private Long studentId;
|
||||
|
||||
/** 学生名称 */
|
||||
@ExcelProperty(value = "学生名称")
|
||||
private String studentName;
|
||||
|
||||
/** 年龄 */
|
||||
@ExcelProperty(value = "年龄")
|
||||
private Long studentAge;
|
||||
|
||||
/** 爱好(0代码 1音乐 2电影) */
|
||||
@ExcelProperty(value = "爱好", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_student_hobby")
|
||||
private String studentHobby;
|
||||
|
||||
/** 性别(1男 2女 3未知) */
|
||||
@ExcelProperty(value = "性别", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_user_gender")
|
||||
private String studentGender;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "sys_student_status")
|
||||
private String studentStatus;
|
||||
|
||||
/** 生日 */
|
||||
@ExcelProperty(value = "生日")
|
||||
private Date studentBirthday;
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.ruoyi.mf.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.ruoyi.mf.domain.MfStudent;
|
||||
|
||||
/**
|
||||
* 学生信息表Mapper接口
|
||||
*
|
||||
* @author 数据小王子
|
||||
* 2023-11-22
|
||||
*/
|
||||
@Mapper
|
||||
public interface MfStudentMapper extends BaseMapper<MfStudent>
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.ruoyi.mf.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.mf.domain.MfStudent;
|
||||
import com.ruoyi.mf.domain.vo.MfStudentVo;
|
||||
import com.ruoyi.mf.domain.bo.MfStudentBo;
|
||||
import com.ruoyi.common.orm.core.service.IBaseService;
|
||||
import com.ruoyi.common.orm.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 学生信息表Service接口
|
||||
*
|
||||
* @author 数据小王子
|
||||
* 2023-11-22
|
||||
*/
|
||||
public interface IMfStudentService extends IBaseService<MfStudent>
|
||||
{
|
||||
/**
|
||||
* 查询学生信息表
|
||||
*
|
||||
* @param studentId 学生信息表主键
|
||||
* @return 学生信息表
|
||||
*/
|
||||
MfStudentVo selectById(Long studentId);
|
||||
|
||||
/**
|
||||
* 查询学生信息表列表
|
||||
*
|
||||
* @param mfStudentBo 学生信息表Bo
|
||||
* @return 学生信息表集合
|
||||
*/
|
||||
List<MfStudentVo> selectList(MfStudentBo mfStudentBo);
|
||||
|
||||
/**
|
||||
* 分页查询学生信息表列表
|
||||
*
|
||||
* @param mfStudentBo 学生信息表Bo
|
||||
* @return 分页学生信息表集合
|
||||
*/
|
||||
TableDataInfo<MfStudentVo> selectPage(MfStudentBo mfStudentBo);
|
||||
|
||||
/**
|
||||
* 新增学生信息表
|
||||
*
|
||||
* @param mfStudentBo 学生信息表Bo
|
||||
* @return 结果:true 操作成功,false 操作失败
|
||||
*/
|
||||
boolean insert(MfStudentBo mfStudentBo);
|
||||
|
||||
/**
|
||||
* 修改学生信息表
|
||||
*
|
||||
* @param mfStudentBo 学生信息表Bo
|
||||
* @return 结果:true 更新成功,false 更新失败
|
||||
*/
|
||||
boolean update(MfStudentBo mfStudentBo);
|
||||
|
||||
/**
|
||||
* 批量删除学生信息表
|
||||
*
|
||||
* @param studentIds 需要删除的学生信息表主键集合
|
||||
* @return 结果:true 删除成功,false 删除失败
|
||||
*/
|
||||
boolean deleteByIds(Long[] studentIds);
|
||||
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
package com.ruoyi.mf.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.ruoyi.common.core.utils.MapstructUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.orm.core.page.PageQuery;
|
||||
import com.ruoyi.common.orm.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.orm.core.service.impl.BaseServiceImpl;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.mf.mapper.MfStudentMapper;
|
||||
import com.ruoyi.mf.domain.MfStudent;
|
||||
import com.ruoyi.mf.domain.bo.MfStudentBo;
|
||||
import com.ruoyi.mf.domain.vo.MfStudentVo;
|
||||
import com.ruoyi.mf.service.IMfStudentService;
|
||||
|
||||
import static com.ruoyi.mf.domain.table.MfStudentTableDef.MF_STUDENT;
|
||||
|
||||
/**
|
||||
* 学生信息表Service业务层处理
|
||||
*
|
||||
* @author 数据小王子
|
||||
* 2023-11-22
|
||||
*/
|
||||
@Service
|
||||
public class MfStudentServiceImpl extends BaseServiceImpl<MfStudentMapper, MfStudent> implements IMfStudentService
|
||||
{
|
||||
@Resource
|
||||
private MfStudentMapper mfStudentMapper;
|
||||
|
||||
@Override
|
||||
public QueryWrapper query() {
|
||||
return super.query().from(MF_STUDENT);
|
||||
}
|
||||
|
||||
private QueryWrapper buildQueryWrapper(MfStudentBo mfStudentBo) {
|
||||
QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
|
||||
|
||||
if (StringUtils.isNotBlank(mfStudentBo.getStudentName())) {
|
||||
queryWrapper.and(MF_STUDENT.STUDENT_NAME.like(mfStudentBo.getStudentName()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(mfStudentBo.getStudentStatus())) {
|
||||
queryWrapper.and(MF_STUDENT.STUDENT_STATUS.eq(mfStudentBo.getStudentStatus()));
|
||||
}
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学生信息表
|
||||
*
|
||||
* @param studentId 学生信息表主键
|
||||
* @return 学生信息表
|
||||
*/
|
||||
@Override
|
||||
public MfStudentVo selectById(Long studentId)
|
||||
{
|
||||
return this.getOneAs(query().where(MF_STUDENT.STUDENT_ID.eq(studentId)), MfStudentVo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学生信息表列表
|
||||
*
|
||||
* @param mfStudentBo 学生信息表Bo
|
||||
* @return 学生信息表集合
|
||||
*/
|
||||
@Override
|
||||
public List<MfStudentVo> selectList(MfStudentBo mfStudentBo)
|
||||
{
|
||||
QueryWrapper queryWrapper = buildQueryWrapper(mfStudentBo);
|
||||
return this.listAs(queryWrapper, MfStudentVo.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询学生信息表列表
|
||||
*
|
||||
* @param mfStudentBo 学生信息表Bo
|
||||
* @return 分页学生信息表集合
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<MfStudentVo> selectPage(MfStudentBo mfStudentBo)
|
||||
{
|
||||
QueryWrapper queryWrapper = buildQueryWrapper(mfStudentBo);
|
||||
Page<MfStudentVo> page = this.pageAs(PageQuery.build(), queryWrapper, MfStudentVo.class);
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增学生信息表
|
||||
*
|
||||
* @param mfStudentBo 学生信息表Bo
|
||||
* @return 结果:true 操作成功,false 操作失败
|
||||
*/
|
||||
@Override
|
||||
public boolean insert(MfStudentBo mfStudentBo)
|
||||
{
|
||||
MfStudent mfStudent = MapstructUtils.convert(mfStudentBo, MfStudent.class);
|
||||
|
||||
return this.save(mfStudent);//使用全局配置的雪花算法主键生成器生成ID值
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改学生信息表
|
||||
*
|
||||
* @param mfStudentBo 学生信息表Bo
|
||||
* @return 结果:true 更新成功,false 更新失败
|
||||
*/
|
||||
@Override
|
||||
public boolean update(MfStudentBo mfStudentBo)
|
||||
{
|
||||
MfStudent mfStudent = MapstructUtils.convert(mfStudentBo, MfStudent.class);
|
||||
boolean updated = this.updateById(mfStudent);
|
||||
|
||||
return updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除学生信息表
|
||||
*
|
||||
* @param studentIds 需要删除的学生信息表主键集合
|
||||
* @return 结果:true 删除成功,false 删除失败
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public boolean deleteByIds(Long[] studentIds)
|
||||
{
|
||||
return this.removeByIds(Arrays.asList(studentIds));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?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.mf.mapper.MfStudentMapper">
|
||||
|
||||
</mapper>
|
@ -1,10 +1,12 @@
|
||||
package com.ruoyi.system.controller.system;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.ruoyi.common.core.core.domain.R;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.orm.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.web.annotation.RepeatSubmit;
|
||||
import com.ruoyi.system.domain.bo.SysNoticeBo;
|
||||
import com.ruoyi.system.domain.vo.SysNoticeVo;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -60,6 +62,7 @@ public class SysNoticeController extends BaseController
|
||||
*/
|
||||
@SaCheckPermission("system:notice:add")
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody SysNoticeBo noticeBo)
|
||||
{
|
||||
|
@ -2,8 +2,6 @@ package com.ruoyi.system.domain.vo;
|
||||
|
||||
import com.ruoyi.common.translation.annotation.Translation;
|
||||
import com.ruoyi.common.translation.constant.TransConstant;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
|
@ -4,8 +4,6 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.ruoyi.common.excel.annotation.ExcelDictFormat;
|
||||
import com.ruoyi.common.excel.convert.ExcelDictConvert;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
|
@ -6,17 +6,13 @@ import java.util.List;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.ruoyi.common.core.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.core.page.TableSupport;
|
||||
import com.ruoyi.common.core.utils.MapstructUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.core.utils.sql.SqlUtil;
|
||||
import com.ruoyi.common.orm.core.page.PageQuery;
|
||||
import com.ruoyi.common.orm.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.orm.core.service.impl.BaseServiceImpl;
|
||||
import com.ruoyi.system.domain.bo.SysNoticeBo;
|
||||
import com.ruoyi.system.domain.vo.SysNoticeVo;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
import com.ruoyi.system.mapper.SysNoticeMapper;
|
||||
|
@ -95,8 +95,6 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
|
||||
queryWrapper.and(SYS_ROLE.CREATE_TIME.between(params.get("beginTime"), params.get("endTime")));
|
||||
}
|
||||
|
||||
//TODO:添加 数据权限 过滤条件
|
||||
|
||||
queryWrapper.orderBy(SYS_ROLE.ROLE_SORT.asc());
|
||||
|
||||
return queryWrapper;
|
||||
|
Loading…
Reference in New Issue
Block a user