Compare commits

..

2 Commits

Author SHA1 Message Date
GoCo
e5e0823e7a feat: 🎸 测试表 2025-08-08 20:14:27 +08:00
GoCo
865d3f8f22 tmp 2025-08-08 20:12:01 +08:00
14 changed files with 360 additions and 60 deletions

View File

@ -10,8 +10,6 @@ import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.shiro.IgnoreAuth;
import org.jeecg.modules.learn.gen.entity.Course;
import org.jeecg.modules.learn.gen.service.ICourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -25,7 +23,7 @@ import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("/business/course")
@Slf4j
public class CourseBusinessController extends JeecgController<Course, ICourseService> {
public class CourseBusinessController {
@GetMapping("/test")
@Operation(summary="测试")

View File

@ -0,0 +1,182 @@
package org.jeecg.modules.learn.test.controller;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.learn.test.entity.TestTable;
import org.jeecg.modules.learn.test.service.ITestTableService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/**
* @Description: 测试表
* @Author: jeecg-boot
* @Date: 2025-08-08
* @Version: V1.0
*/
@Tag(name="测试表")
@RestController
@RequestMapping("/test/testTable")
@Slf4j
public class TestTableController extends JeecgController<TestTable, ITestTableService> {
@Autowired
private ITestTableService testTableService;
/**
* 分页列表查询
*
* @param testTable
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "测试表-分页列表查询")
@Operation(summary="测试表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<TestTable>> queryPageList(TestTable testTable,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<TestTable> queryWrapper = QueryGenerator.initQueryWrapper(testTable, req.getParameterMap());
Page<TestTable> page = new Page<TestTable>(pageNo, pageSize);
IPage<TestTable> pageList = testTableService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param testTable
* @return
*/
@AutoLog(value = "测试表-添加")
@Operation(summary="测试表-添加")
@RequiresPermissions("test:test_table:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody TestTable testTable) {
testTableService.save(testTable);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param testTable
* @return
*/
@AutoLog(value = "测试表-编辑")
@Operation(summary="测试表-编辑")
@RequiresPermissions("test:test_table:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody TestTable testTable) {
testTableService.updateById(testTable);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "测试表-通过id删除")
@Operation(summary="测试表-通过id删除")
@RequiresPermissions("test:test_table:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
testTableService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "测试表-批量删除")
@Operation(summary="测试表-批量删除")
@RequiresPermissions("test:test_table:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.testTableService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "测试表-通过id查询")
@Operation(summary="测试表-通过id查询")
@GetMapping(value = "/queryById")
public Result<TestTable> queryById(@RequestParam(name="id",required=true) String id) {
TestTable testTable = testTableService.getById(id);
if(testTable==null) {
return Result.error("未找到对应数据");
}
return Result.OK(testTable);
}
/**
* 导出excel
*
* @param request
* @param testTable
*/
@RequiresPermissions("test:test_table:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, TestTable testTable) {
return super.exportXls(request, testTable, TestTable.class, "测试表");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequiresPermissions("test:test_table:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, TestTable.class);
}
}

View File

@ -0,0 +1,63 @@
package org.jeecg.modules.learn.test.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 测试表
* @Author: jeecg-boot
* @Date: 2025-08-08
* @Version: V1.0
*/
@Data
@TableName("test_table")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description="测试表")
public class TestTable implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private java.lang.String id;
/**创建人*/
@Schema(description = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建日期")
private java.util.Date createTime;
/**更新人*/
@Schema(description = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@Schema(description = "所属部门")
private java.lang.String sysOrgCode;
/**名称*/
@Excel(name = "名称", width = 15)
@Schema(description = "名称")
private java.lang.String name;
}

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.learn.test.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.learn.test.entity.TestTable;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 测试表
* @Author: jeecg-boot
* @Date: 2025-08-08
* @Version: V1.0
*/
public interface TestTableMapper extends BaseMapper<TestTable> {
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.learn.test.mapper.TestTableMapper">
</mapper>

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.learn.test.service;
import org.jeecg.modules.learn.test.entity.TestTable;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 测试表
* @Author: jeecg-boot
* @Date: 2025-08-08
* @Version: V1.0
*/
public interface ITestTableService extends IService<TestTable> {
}

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.learn.test.service.impl;
import org.jeecg.modules.learn.test.entity.TestTable;
import org.jeecg.modules.learn.test.mapper.TestTableMapper;
import org.jeecg.modules.learn.test.service.ITestTableService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 测试表
* @Author: jeecg-boot
* @Date: 2025-08-08
* @Version: V1.0
*/
@Service
public class TestTableServiceImpl extends ServiceImpl<TestTableMapper, TestTable> implements ITestTableService {
}

View File

@ -151,9 +151,10 @@ spring:
slow-sql-millis: 5000
datasource:
master:
url: jdbc:mysql://127.0.0.1:33061/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
# url: jdbc:mysql://127.0.0.1:33061/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
url: jdbc:mysql://110.42.96.65:55616/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: 123456
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
# 多数据源配置
#multi-datasource1:

View File

@ -4,13 +4,13 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/gen/course/list',
save='/gen/course/add',
edit='/gen/course/edit',
deleteOne = '/gen/course/delete',
deleteBatch = '/gen/course/deleteBatch',
importExcel = '/gen/course/importExcel',
exportXls = '/gen/course/exportXls',
list = '/test/testTable/list',
save='/test/testTable/add',
edit='/test/testTable/edit',
deleteOne = '/test/testTable/delete',
deleteBatch = '/test/testTable/deleteBatch',
importExcel = '/test/testTable/importExcel',
exportXls = '/test/testTable/exportXls',
}
/**
* 导出api

View File

@ -6,7 +6,7 @@ import { getWeekMonthQuarterYear } from '/@/utils';
//
export const columns: BasicColumn[] = [
{
title: '课程名',
title: '',
align:"center",
dataIndex: 'name'
},
@ -17,7 +17,7 @@ export const searchFormSchema: FormSchema[] = [
//
export const formSchema: FormSchema[] = [
{
label: '课程名',
label: '',
field: 'name',
component: 'Input',
},
@ -32,7 +32,7 @@ export const formSchema: FormSchema[] = [
//
export const superQuerySchema = {
name: {title: '课程名',order: 0,view: 'text', type: 'string',},
name: {title: '',order: 0,view: 'text', type: 'string',},
};
/**

View File

@ -4,9 +4,9 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'gen:course:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'gen:course:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'gen:course:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-button type="primary" v-auth="'test:test_table:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'test:test_table:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'test:test_table:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
@ -17,7 +17,7 @@
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'gen:course:deleteBatch'">批量操作
<a-button v-auth="'test:test_table:deleteBatch'">批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
@ -30,35 +30,24 @@
</template>
<!--字段回显插槽-->
<template v-slot:bodyCell="{ column, record, index, text }">
<template v-if="column.dataIndex==='video'">
<!--文件字段回显插槽-->
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
<template v-if="column.dataIndex==='question'">
<!--富文本件字段回显插槽-->
<div v-html="text"></div>
</template>
</template>
</BasicTable>
<!-- 表单区域 -->
<CourseModal @register="registerModal" @success="handleSuccess"></CourseModal>
<TestTableModal @register="registerModal" @success="handleSuccess"></TestTableModal>
</div>
</template>
<script lang="ts" name="gen-course" setup>
<script lang="ts" name="test-testTable" setup>
import {ref, reactive, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import CourseModal from './components/CourseModal.vue'
import {columns, searchFormSchema, superQuerySchema} from './Course.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './Course.api';
import TestTableModal from './components/TestTableModal.vue'
import {columns, searchFormSchema, superQuerySchema} from './TestTable.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './TestTable.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
import { useMessage } from '/@/hooks/web/useMessage';
import {getPopDictByCode} from "@/utils/dict";
import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil";
import { getDateByPicker } from '/@/utils';
//
const fieldPickers = reactive({
@ -72,7 +61,7 @@
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '课程表',
title: '测试表',
api: list,
columns,
canResize:true,
@ -100,10 +89,9 @@
}
return Object.assign(params, queryParam);
},
afterFetch: afterFetch
},
exportConfig: {
name:"课程表",
name:"测试表",
url: getExportUrl,
params: queryParam,
},
@ -182,7 +170,7 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'gen:course:edit'
auth: 'test:test_table:edit'
}
]
}
@ -201,7 +189,7 @@
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'gen:course:delete'
auth: 'test:test_table:delete'
}
]
}
@ -209,19 +197,6 @@
/**
* 翻译Popup字典配置
*/
async function afterFetch(records){
const statusKeys = [...new Set(records.map((item) => item['status']).flatMap((item) => item && item.split(',')))];
if(statusKeys && statusKeys.length){
const dictOptions = await getPopDictByCode(statusKeys.join(','), ',status,');
records.forEach((item) => {
item['status_dictText'] = filterMultiDictText(dictOptions, item['status']);
});
}
return records;
}
</script>
<style lang="less" scoped>

View File

@ -0,0 +1,26 @@
-- 注意该页面对应的前台目录为views/test文件夹下
-- 如果你想更改到其他目录请修改sql中component字段对应的值
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external)
VALUES ('2025080808129710360', NULL, '测试表', '/test/testTableList', 'test/TestTableList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-08-08 20:12:36', NULL, NULL, 0);
-- 权限控制sql
-- 新增
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2025080808129710361', '2025080808129710360', '添加测试表', NULL, NULL, 0, NULL, NULL, 2, 'test:test_table:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-08 20:12:36', NULL, NULL, 0, 0, '1', 0);
-- 编辑
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2025080808129710362', '2025080808129710360', '编辑测试表', NULL, NULL, 0, NULL, NULL, 2, 'test:test_table:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-08 20:12:36', NULL, NULL, 0, 0, '1', 0);
-- 删除
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2025080808129710363', '2025080808129710360', '删除测试表', NULL, NULL, 0, NULL, NULL, 2, 'test:test_table:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-08 20:12:36', NULL, NULL, 0, 0, '1', 0);
-- 批量删除
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2025080808129710364', '2025080808129710360', '批量删除测试表', NULL, NULL, 0, NULL, NULL, 2, 'test:test_table:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-08 20:12:36', NULL, NULL, 0, 0, '1', 0);
-- 导出excel
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2025080808129710365', '2025080808129710360', '导出excel_测试表', NULL, NULL, 0, NULL, NULL, 2, 'test:test_table:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-08 20:12:36', NULL, NULL, 0, 0, '1', 0);
-- 导入excel
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2025080808129710366', '2025080808129710360', '导入excel_测试表', NULL, NULL, 0, NULL, NULL, 2, 'test:test_table:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-08-08 20:12:36', NULL, NULL, 0, 0, '1', 0);

View File

@ -12,11 +12,11 @@
import {computed, defineComponent} from 'vue';
import {defHttp} from '/@/utils/http/axios';
import { propTypes } from '/@/utils/propTypes';
import {getBpmFormSchema} from '../Course.data';
import {saveOrUpdate} from '../Course.api';
import {getBpmFormSchema} from '../TestTable.data';
import {saveOrUpdate} from '../TestTable.api';
export default defineComponent({
name: "CourseForm",
name: "TestTableForm",
components:{
BasicForm
},
@ -40,7 +40,7 @@
});
let formData = {};
const queryByIdUrl = '/gen/course/queryById';
const queryByIdUrl = '/test/testTable/queryById';
async function initFormData(){
let params = {id: props.formData.dataId};
const data = await defHttp.get({url: queryByIdUrl, params});

View File

@ -1,6 +1,6 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
<BasicForm @register="registerForm" name="CourseForm" />
<BasicForm @register="registerForm" name="TestTableForm" />
</BasicModal>
</template>
@ -8,8 +8,8 @@
import {ref, computed, unref, reactive} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../Course.data';
import {saveOrUpdate} from '../Course.api';
import {formSchema} from '../TestTable.data';
import {saveOrUpdate} from '../TestTable.api';
import { useMessage } from '/@/hooks/web/useMessage';
import { getDateByPicker } from '/@/utils';
const { createMessage } = useMessage();