feat: 🎸 课程、用户信息、活动、师资力量接口
This commit is contained in:
parent
02d0d55a9d
commit
d9ef0b8fa6
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +1,4 @@
|
||||
{
|
||||
"java.configuration.updateBuildConfiguration": "automatic"
|
||||
"java.configuration.updateBuildConfiguration": "automatic",
|
||||
"java.compile.nullAnalysis.mode": "automatic"
|
||||
}
|
@ -33,6 +33,16 @@ public final class EntityLinkConst {
|
||||
public static final String HOMEWORK = "homework";
|
||||
// 考试(对应考试表)
|
||||
public static final String EXAM = "exam";
|
||||
// 课程
|
||||
public static final String COURSE = "course";
|
||||
}
|
||||
|
||||
/** 资源类型 0:视频,1:图片,2:文档 */
|
||||
public static final class ResourceType {
|
||||
private ResourceType() {}
|
||||
public static final int VIDEO = 0;
|
||||
public static final int IMAGE = 1;
|
||||
public static final int DOCUMENT = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
package org.jeecg.modules.biz.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.config.shiro.IgnoreAuth;
|
||||
import org.jeecg.modules.biz.service.ActivityBizService;
|
||||
import org.jeecg.modules.gen.activity.entity.Activity;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/biz/activity")
|
||||
@Tag(name = "活动")
|
||||
@Slf4j
|
||||
public class ActivityBizController {
|
||||
|
||||
@Autowired
|
||||
private ActivityBizService activityBizService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "查询活动列表")
|
||||
@IgnoreAuth
|
||||
public Result<List<Activity>> list() {
|
||||
return Result.OK(activityBizService.getActivityList());
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.modules.biz.dto.TeacherInfo;
|
||||
import org.jeecg.modules.biz.service.CourseBizService;
|
||||
import org.jeecg.modules.gen.course.entity.Course;
|
||||
import org.jeecg.modules.gen.coursecategory.entity.CourseCategory;
|
||||
@ -110,6 +111,14 @@ public class CourseBizController {
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@GetMapping("/{courseId}/teachers")
|
||||
@Operation(summary = "查询课程的授课教师")
|
||||
@IgnoreAuth
|
||||
public Result<List<TeacherInfo>> queryTeacherList(@PathVariable(value = "courseId") String courseId) {
|
||||
List<TeacherInfo> list = courseBizService.getCourseTeacherList(courseId);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@GetMapping("/test")
|
||||
@IgnoreAuth
|
||||
public Result<String> test() {
|
||||
|
@ -5,10 +5,16 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
@ -16,7 +22,10 @@ import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.config.shiro.IgnoreAuth;
|
||||
import org.jeecg.modules.biz.constant.EntityLinkConst;
|
||||
import org.jeecg.modules.biz.service.EntityLinkBizService;
|
||||
import org.jeecg.modules.biz.service.ResourceBizService;
|
||||
import org.jeecg.modules.gen.resource.entity.Resource;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
@ -29,6 +38,47 @@ public class ResourceBizController {
|
||||
@Autowired
|
||||
private ResourceBizService resourceBizService;
|
||||
|
||||
@Autowired
|
||||
private EntityLinkBizService entityLinkBizService;
|
||||
|
||||
@GetMapping("/feature")
|
||||
@Operation(summary = "查询精品资源")
|
||||
@IgnoreAuth
|
||||
public Result<List<Resource>> queryFeatureResource() {
|
||||
List<Resource> list = resourceBizService.list(new QueryWrapper<Resource>().eq("iz_featured", 1));
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@GetMapping("/video")
|
||||
@Operation(summary = "按课程分类查询视频资源")
|
||||
@IgnoreAuth
|
||||
public Result<List<Resource>> queryVideoResource(@RequestParam("categoryId") String courseCategoryId) {
|
||||
List<String> targetIds = entityLinkBizService.listTargetIds(EntityLinkConst.SourceType.COURSE_CATEGORY, courseCategoryId, EntityLinkConst.TargetType.RESOURCE);
|
||||
List<Resource> list = new ArrayList<>();
|
||||
for (String targetId : targetIds) {
|
||||
Resource resource = resourceBizService.getById(targetId);
|
||||
if (resource.getType() == EntityLinkConst.ResourceType.VIDEO) {
|
||||
list.add(resource);
|
||||
}
|
||||
}
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@GetMapping("/image")
|
||||
@Operation(summary = "按课程分类查询图片资源")
|
||||
@IgnoreAuth
|
||||
public Result<List<Resource>> queryImageResource(@RequestParam("categoryId") String courseCategoryId) {
|
||||
List<String> targetIds = entityLinkBizService.listTargetIds(EntityLinkConst.SourceType.COURSE_CATEGORY, courseCategoryId, EntityLinkConst.TargetType.RESOURCE);
|
||||
List<Resource> list = new ArrayList<>();
|
||||
for (String targetId : targetIds) {
|
||||
Resource resource = resourceBizService.getById(targetId);
|
||||
if (resource.getType() == EntityLinkConst.ResourceType.IMAGE) {
|
||||
list.add(resource);
|
||||
}
|
||||
}
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@PostMapping("/upload")
|
||||
@Operation(summary = "课程视频文件上传", description = "课程视频文件上传,返回m3u8文件地址")
|
||||
@IgnoreAuth
|
||||
|
@ -5,14 +5,19 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.jeecg.modules.biz.dto.TeacherInfo;
|
||||
import org.jeecg.modules.biz.service.UserBizService;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.service.*;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -20,7 +25,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.PasswordUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
|
||||
@ -38,6 +42,8 @@ public class UserBizController {
|
||||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private UserBizService userBizService;
|
||||
|
||||
@PostMapping("/login")
|
||||
@Operation(summary = "用户登录")
|
||||
@ -116,4 +122,12 @@ public class UserBizController {
|
||||
// 10分钟,一分钟为60s
|
||||
redisUtil.set(key, ++val, 600);
|
||||
}
|
||||
|
||||
@GetMapping("/all_teachers")
|
||||
@Operation(summary = "查询师资力量", description = "categoryId为all则查询全部")
|
||||
@IgnoreAuth
|
||||
public Result<List<TeacherInfo>> queryAllTeachers(@RequestParam("categoryId") String categoryId) {
|
||||
List<TeacherInfo> list = userBizService.queryAllTeachers(categoryId);
|
||||
return Result.OK(list);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
package org.jeecg.modules.biz.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TeacherInfo {
|
||||
private String id;
|
||||
private String name;
|
||||
private String avatar;
|
||||
private String title;
|
||||
private String tag;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package org.jeecg.modules.biz.service;
|
||||
|
||||
import org.jeecg.modules.gen.activity.entity.Activity;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface ActivityBizService extends IService<Activity> {
|
||||
/**
|
||||
* 查询活动列表
|
||||
* @return
|
||||
*/
|
||||
List<Activity> getActivityList();
|
||||
}
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.jeecg.modules.biz.dto.TeacherInfo;
|
||||
import org.jeecg.modules.gen.course.entity.Course;
|
||||
import org.jeecg.modules.gen.coursecategory.entity.CourseCategory;
|
||||
import org.jeecg.modules.gen.coursesection.entity.CourseSection;
|
||||
@ -55,6 +56,13 @@ public interface CourseBizService extends IService<Course> {
|
||||
* @return 指定类型的列表
|
||||
*/
|
||||
<T> List<T> getCourseSectionDetail(Integer type, String sectionId, Class<T> clazz);
|
||||
|
||||
/**
|
||||
* 查询课程的授课教师
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
List<TeacherInfo> getCourseTeacherList(String courseId);
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
package org.jeecg.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.biz.dto.TeacherInfo;
|
||||
import org.jeecg.modules.gen.userinfo.entity.UserInfo;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface UserBizService extends IService<UserInfo> {
|
||||
/**
|
||||
* 师资力量
|
||||
* @return
|
||||
*/
|
||||
List<TeacherInfo> queryAllTeachers(String categoryId);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package org.jeecg.modules.biz.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.biz.service.ActivityBizService;
|
||||
import org.jeecg.modules.gen.activity.entity.Activity;
|
||||
import org.jeecg.modules.gen.activity.mapper.ActivityMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
@Service
|
||||
public class ActivityBizServiceImpl extends ServiceImpl<ActivityMapper, Activity> implements ActivityBizService {
|
||||
|
||||
@Override
|
||||
public List<Activity> getActivityList() {
|
||||
return baseMapper.selectList(null);
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ import org.jeecg.common.util.MinioUtil;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.oss.OssBootUtil;
|
||||
import org.jeecg.modules.biz.constant.EntityLinkConst;
|
||||
import org.jeecg.modules.biz.dto.TeacherInfo;
|
||||
import org.jeecg.modules.biz.service.CourseBizService;
|
||||
import org.jeecg.modules.biz.service.EntityLinkBizService;
|
||||
import org.jeecg.modules.gen.course.entity.Course;
|
||||
@ -14,7 +15,13 @@ import org.jeecg.modules.gen.coursecategory.entity.CourseCategory;
|
||||
import org.jeecg.modules.gen.coursecategory.mapper.CourseCategoryMapper;
|
||||
import org.jeecg.modules.gen.coursesection.entity.CourseSection;
|
||||
import org.jeecg.modules.gen.coursesection.mapper.CourseSectionMapper;
|
||||
import org.jeecg.modules.gen.courseteacher.entity.CourseTeacher;
|
||||
import org.jeecg.modules.gen.courseteacher.mapper.CourseTeacherMapper;
|
||||
import org.jeecg.modules.gen.resource.mapper.ResourceMapper;
|
||||
import org.jeecg.modules.gen.userinfo.entity.UserInfo;
|
||||
import org.jeecg.modules.gen.userinfo.mapper.UserInfoMapper;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.mapper.SysUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@ -51,6 +58,15 @@ public class CourseBizServiceImpl extends ServiceImpl<CourseMapper, Course> impl
|
||||
@Autowired
|
||||
private ResourceMapper resourceMapper;
|
||||
|
||||
@Autowired
|
||||
private CourseTeacherMapper courseTeacherMapper;
|
||||
|
||||
@Autowired
|
||||
private UserInfoMapper userInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Override
|
||||
public <T> List<T> getCourseSectionDetail(Integer type, String sectionId, Class<T> clazz) {
|
||||
// 1. 查询章节是否存在
|
||||
@ -223,6 +239,26 @@ public class CourseBizServiceImpl extends ServiceImpl<CourseMapper, Course> impl
|
||||
file.delete();
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TeacherInfo> getCourseTeacherList(String courseId) {
|
||||
List<CourseTeacher> list = courseTeacherMapper.selectList(new QueryWrapper<CourseTeacher>().eq("course_id", courseId));
|
||||
|
||||
List<TeacherInfo> result = new ArrayList<>();
|
||||
for (CourseTeacher item : list) {
|
||||
UserInfo userInfo = userInfoMapper.selectOne(new QueryWrapper<UserInfo>().eq("user_id", item.getTeacherId()));
|
||||
SysUser sysUser = sysUserMapper.selectById(item.getTeacherId());
|
||||
|
||||
TeacherInfo teacherInfo = new TeacherInfo();
|
||||
teacherInfo.setId(item.getTeacherId());
|
||||
teacherInfo.setName(sysUser.getRealname());
|
||||
teacherInfo.setAvatar(sysUser.getAvatar());
|
||||
teacherInfo.setTitle(userInfo.getTitle());
|
||||
teacherInfo.setTag(userInfo.getTag());
|
||||
result.add(teacherInfo);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,92 @@
|
||||
package org.jeecg.modules.biz.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.jeecg.modules.biz.constant.EntityLinkConst;
|
||||
import org.jeecg.modules.biz.dto.TeacherInfo;
|
||||
import org.jeecg.modules.biz.service.EntityLinkBizService;
|
||||
import org.jeecg.modules.biz.service.UserBizService;
|
||||
import org.jeecg.modules.gen.course.entity.Course;
|
||||
import org.jeecg.modules.gen.course.mapper.CourseMapper;
|
||||
import org.jeecg.modules.gen.courseteacher.entity.CourseTeacher;
|
||||
import org.jeecg.modules.gen.courseteacher.mapper.CourseTeacherMapper;
|
||||
import org.jeecg.modules.gen.entitylink.mapper.EntityLinkMapper;
|
||||
import org.jeecg.modules.gen.userinfo.entity.UserInfo;
|
||||
import org.jeecg.modules.gen.userinfo.mapper.UserInfoMapper;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.mapper.SysUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class UserBizServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements UserBizService {
|
||||
|
||||
@Autowired
|
||||
private CourseMapper courseMapper;
|
||||
@Autowired
|
||||
private EntityLinkMapper entityLinkMapper;
|
||||
@Autowired
|
||||
private EntityLinkBizService entityLinkBizService;
|
||||
@Autowired
|
||||
private CourseTeacherMapper courseTeacherMapper;
|
||||
@Autowired
|
||||
private UserInfoMapper userInfoMapper;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Override
|
||||
public List<TeacherInfo> queryAllTeachers(String categoryId) {
|
||||
// categoryId为all则查询全部
|
||||
// TODO 存入redis缓存
|
||||
|
||||
// 1 根据课程分类,查询该分类下的课程; all 则查询全部课程
|
||||
// 2 遍历课程,根据课程id查询该课程的授课教师
|
||||
// 3 将授课教师信息封装成TeacherInfo对象
|
||||
// 4 返回授课教师列表(去重)
|
||||
|
||||
// 1 根据课程分类,查询该分类下的课程
|
||||
List<String> courseIds;
|
||||
if ("all".equals(categoryId)) {
|
||||
// 查询全部课程
|
||||
List<Course> courseList = courseMapper.selectList(null);
|
||||
courseIds = courseList.stream().map(Course::getId).collect(Collectors.toList());
|
||||
} else {
|
||||
courseIds = entityLinkBizService.listTargetIds(EntityLinkConst.SourceType.COURSE_CATEGORY, categoryId, EntityLinkConst.TargetType.COURSE);
|
||||
}
|
||||
Set<String> teacherIds = new HashSet<>();
|
||||
List<TeacherInfo> result = new ArrayList<>();
|
||||
for (String courseId : courseIds) {
|
||||
// 2 根据课程id查询该课程的授课教师
|
||||
List<CourseTeacher> courseTeachers = courseTeacherMapper.selectList(new LambdaQueryWrapper<CourseTeacher>().eq(CourseTeacher::getCourseId, courseId));
|
||||
// 3 将授课教师信息封装成TeacherInfo对象
|
||||
for (CourseTeacher courseTeacher : courseTeachers) {
|
||||
// 4 将授课教师信息封装成TeacherInfo对象,去重
|
||||
UserInfo userInfo = userInfoMapper.selectOne(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserId, courseTeacher.getTeacherId()));
|
||||
SysUser sysUser = sysUserMapper.selectById(courseTeacher.getTeacherId());
|
||||
TeacherInfo teacherInfo = new TeacherInfo();
|
||||
teacherInfo.setId(courseTeacher.getTeacherId());
|
||||
teacherInfo.setName(sysUser.getRealname());
|
||||
teacherInfo.setAvatar(sysUser.getAvatar());
|
||||
teacherInfo.setTitle(userInfo.getTitle());
|
||||
teacherInfo.setTag(userInfo.getTag());
|
||||
if (!teacherIds.contains(courseTeacher.getTeacherId())) {
|
||||
result.add(teacherInfo);
|
||||
teacherIds.add(courseTeacher.getTeacherId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
package org.jeecg.modules.gen.activity.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.gen.activity.entity.Activity;
|
||||
import org.jeecg.modules.gen.activity.service.IActivityService;
|
||||
|
||||
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-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="活动")
|
||||
@RestController
|
||||
@RequestMapping("/gen/activity/activity")
|
||||
@Slf4j
|
||||
public class ActivityController extends JeecgController<Activity, IActivityService> {
|
||||
@Autowired
|
||||
private IActivityService activityService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param activity
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "活动-分页列表查询")
|
||||
@Operation(summary="活动-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Activity>> queryPageList(Activity activity,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<Activity> queryWrapper = QueryGenerator.initQueryWrapper(activity, req.getParameterMap());
|
||||
Page<Activity> page = new Page<Activity>(pageNo, pageSize);
|
||||
IPage<Activity> pageList = activityService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param activity
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "活动-添加")
|
||||
@Operation(summary="活动-添加")
|
||||
@RequiresPermissions("gen.activity:activity:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Activity activity) {
|
||||
activityService.save(activity);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param activity
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "活动-编辑")
|
||||
@Operation(summary="活动-编辑")
|
||||
@RequiresPermissions("gen.activity:activity:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Activity activity) {
|
||||
activityService.updateById(activity);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "活动-通过id删除")
|
||||
@Operation(summary="活动-通过id删除")
|
||||
@RequiresPermissions("gen.activity:activity:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
activityService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "活动-批量删除")
|
||||
@Operation(summary="活动-批量删除")
|
||||
@RequiresPermissions("gen.activity:activity:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.activityService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "活动-通过id查询")
|
||||
@Operation(summary="活动-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Activity> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Activity activity = activityService.getById(id);
|
||||
if(activity==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(activity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param activity
|
||||
*/
|
||||
@RequiresPermissions("gen.activity:activity:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Activity activity) {
|
||||
return super.exportXls(request, activity, Activity.class, "活动");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("gen.activity:activity:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, Activity.class);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package org.jeecg.modules.gen.activity.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-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("activity")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="活动")
|
||||
public class Activity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**标题*/
|
||||
@Excel(name = "标题", width = 15)
|
||||
@Schema(description = "标题")
|
||||
private java.lang.String title;
|
||||
/**介绍*/
|
||||
@Excel(name = "介绍", width = 15)
|
||||
@Schema(description = "介绍")
|
||||
private java.lang.String introduction;
|
||||
/**说明图片*/
|
||||
@Excel(name = "说明图片", width = 15)
|
||||
@Schema(description = "说明图片")
|
||||
private java.lang.String imgs;
|
||||
/**头图*/
|
||||
@Excel(name = "头图", width = 15)
|
||||
@Schema(description = "头图")
|
||||
private java.lang.String banner;
|
||||
/**介绍视频*/
|
||||
@Excel(name = "介绍视频", width = 15)
|
||||
@Schema(description = "介绍视频")
|
||||
private java.lang.String video;
|
||||
/**报名人数上限*/
|
||||
@Excel(name = "报名人数上限", width = 15)
|
||||
@Schema(description = "报名人数上限")
|
||||
private java.lang.Integer maxNum;
|
||||
/**开始时间*/
|
||||
@Excel(name = "开始时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@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 startTime;
|
||||
/**结束时间*/
|
||||
@Excel(name = "结束时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@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 endTime;
|
||||
/**扩展字段*/
|
||||
@Excel(name = "扩展字段", width = 15)
|
||||
@Schema(description = "扩展字段")
|
||||
private java.lang.String extra;
|
||||
/**附件*/
|
||||
@Excel(name = "附件", width = 15)
|
||||
@Schema(description = "附件")
|
||||
private java.lang.String attachment;
|
||||
/**状态*/
|
||||
@Excel(name = "状态", width = 15, dicCode = "course_status")
|
||||
@Dict(dicCode = "course_status")
|
||||
@Schema(description = "状态")
|
||||
private java.lang.String status;
|
||||
/**创建人*/
|
||||
@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;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.gen.activity.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.gen.activity.entity.Activity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 活动
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-08-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ActivityMapper extends BaseMapper<Activity> {
|
||||
|
||||
}
|
@ -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.gen.activity.mapper.ActivityMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.gen.activity.service;
|
||||
|
||||
import org.jeecg.modules.gen.activity.entity.Activity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 活动
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-08-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IActivityService extends IService<Activity> {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.gen.activity.service.impl;
|
||||
|
||||
import org.jeecg.modules.gen.activity.entity.Activity;
|
||||
import org.jeecg.modules.gen.activity.mapper.ActivityMapper;
|
||||
import org.jeecg.modules.gen.activity.service.IActivityService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 活动
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-08-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> implements IActivityService {
|
||||
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
package org.jeecg.modules.gen.courseteacher.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.gen.courseteacher.entity.CourseTeacher;
|
||||
import org.jeecg.modules.gen.courseteacher.service.ICourseTeacherService;
|
||||
|
||||
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-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="授课教师")
|
||||
@RestController
|
||||
@RequestMapping("/gen/courseteacher/courseTeacher")
|
||||
@Slf4j
|
||||
public class CourseTeacherController extends JeecgController<CourseTeacher, ICourseTeacherService> {
|
||||
@Autowired
|
||||
private ICourseTeacherService courseTeacherService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param courseTeacher
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "授课教师-分页列表查询")
|
||||
@Operation(summary="授课教师-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<CourseTeacher>> queryPageList(CourseTeacher courseTeacher,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<CourseTeacher> queryWrapper = QueryGenerator.initQueryWrapper(courseTeacher, req.getParameterMap());
|
||||
Page<CourseTeacher> page = new Page<CourseTeacher>(pageNo, pageSize);
|
||||
IPage<CourseTeacher> pageList = courseTeacherService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param courseTeacher
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "授课教师-添加")
|
||||
@Operation(summary="授课教师-添加")
|
||||
@RequiresPermissions("gen.courseteacher:course_teacher:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody CourseTeacher courseTeacher) {
|
||||
courseTeacherService.save(courseTeacher);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param courseTeacher
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "授课教师-编辑")
|
||||
@Operation(summary="授课教师-编辑")
|
||||
@RequiresPermissions("gen.courseteacher:course_teacher:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody CourseTeacher courseTeacher) {
|
||||
courseTeacherService.updateById(courseTeacher);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "授课教师-通过id删除")
|
||||
@Operation(summary="授课教师-通过id删除")
|
||||
@RequiresPermissions("gen.courseteacher:course_teacher:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
courseTeacherService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "授课教师-批量删除")
|
||||
@Operation(summary="授课教师-批量删除")
|
||||
@RequiresPermissions("gen.courseteacher:course_teacher:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.courseTeacherService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "授课教师-通过id查询")
|
||||
@Operation(summary="授课教师-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<CourseTeacher> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
CourseTeacher courseTeacher = courseTeacherService.getById(id);
|
||||
if(courseTeacher==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(courseTeacher);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param courseTeacher
|
||||
*/
|
||||
@RequiresPermissions("gen.courseteacher:course_teacher:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, CourseTeacher courseTeacher) {
|
||||
return super.exportXls(request, courseTeacher, CourseTeacher.class, "授课教师");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("gen.courseteacher:course_teacher:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, CourseTeacher.class);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package org.jeecg.modules.gen.courseteacher.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-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("course_teacher")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="授课教师")
|
||||
public class CourseTeacher implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**课程id*/
|
||||
@Excel(name = "课程id", width = 15)
|
||||
@Schema(description = "课程id")
|
||||
private java.lang.String courseId;
|
||||
/**教师id*/
|
||||
@Excel(name = "教师id", width = 15)
|
||||
@Schema(description = "教师id")
|
||||
private java.lang.String teacherId;
|
||||
/**授课角色*/
|
||||
@Excel(name = "授课角色", width = 15, dicCode = "course_role")
|
||||
@Dict(dicCode = "course_role")
|
||||
@Schema(description = "授课角色")
|
||||
private java.lang.String role;
|
||||
/**显示顺序*/
|
||||
@Excel(name = "显示顺序", width = 15)
|
||||
@Schema(description = "显示顺序")
|
||||
private java.lang.Integer sortOrder;
|
||||
/**创建人*/
|
||||
@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;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.gen.courseteacher.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.gen.courseteacher.entity.CourseTeacher;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 授课教师
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-08-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface CourseTeacherMapper extends BaseMapper<CourseTeacher> {
|
||||
|
||||
}
|
@ -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.gen.courseteacher.mapper.CourseTeacherMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.gen.courseteacher.service;
|
||||
|
||||
import org.jeecg.modules.gen.courseteacher.entity.CourseTeacher;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 授课教师
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-08-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICourseTeacherService extends IService<CourseTeacher> {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.gen.courseteacher.service.impl;
|
||||
|
||||
import org.jeecg.modules.gen.courseteacher.entity.CourseTeacher;
|
||||
import org.jeecg.modules.gen.courseteacher.mapper.CourseTeacherMapper;
|
||||
import org.jeecg.modules.gen.courseteacher.service.ICourseTeacherService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 授课教师
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-08-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class CourseTeacherServiceImpl extends ServiceImpl<CourseTeacherMapper, CourseTeacher> implements ICourseTeacherService {
|
||||
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
package org.jeecg.modules.gen.userinfo.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.gen.userinfo.entity.UserInfo;
|
||||
import org.jeecg.modules.gen.userinfo.service.IUserInfoService;
|
||||
|
||||
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-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="用户信息")
|
||||
@RestController
|
||||
@RequestMapping("/gen/userinfo/userInfo")
|
||||
@Slf4j
|
||||
public class UserInfoController extends JeecgController<UserInfo, IUserInfoService> {
|
||||
@Autowired
|
||||
private IUserInfoService userInfoService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param userInfo
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "用户信息-分页列表查询")
|
||||
@Operation(summary="用户信息-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<UserInfo>> queryPageList(UserInfo userInfo,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<UserInfo> queryWrapper = QueryGenerator.initQueryWrapper(userInfo, req.getParameterMap());
|
||||
Page<UserInfo> page = new Page<UserInfo>(pageNo, pageSize);
|
||||
IPage<UserInfo> pageList = userInfoService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param userInfo
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "用户信息-添加")
|
||||
@Operation(summary="用户信息-添加")
|
||||
@RequiresPermissions("gen.userinfo:user_info:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody UserInfo userInfo) {
|
||||
userInfoService.save(userInfo);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param userInfo
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "用户信息-编辑")
|
||||
@Operation(summary="用户信息-编辑")
|
||||
@RequiresPermissions("gen.userinfo:user_info:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody UserInfo userInfo) {
|
||||
userInfoService.updateById(userInfo);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "用户信息-通过id删除")
|
||||
@Operation(summary="用户信息-通过id删除")
|
||||
@RequiresPermissions("gen.userinfo:user_info:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
userInfoService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "用户信息-批量删除")
|
||||
@Operation(summary="用户信息-批量删除")
|
||||
@RequiresPermissions("gen.userinfo:user_info:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.userInfoService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "用户信息-通过id查询")
|
||||
@Operation(summary="用户信息-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<UserInfo> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
UserInfo userInfo = userInfoService.getById(id);
|
||||
if(userInfo==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(userInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param userInfo
|
||||
*/
|
||||
@RequiresPermissions("gen.userinfo:user_info:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, UserInfo userInfo) {
|
||||
return super.exportXls(request, userInfo, UserInfo.class, "用户信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("gen.userinfo:user_info:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, UserInfo.class);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package org.jeecg.modules.gen.userinfo.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-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("user_info")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="用户信息")
|
||||
public class UserInfo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**用户id*/
|
||||
@Excel(name = "用户id", width = 15)
|
||||
@Schema(description = "用户id")
|
||||
private java.lang.String userId;
|
||||
/**专业*/
|
||||
@Excel(name = "专业", width = 15)
|
||||
@Schema(description = "专业")
|
||||
private java.lang.String major;
|
||||
/**学院*/
|
||||
@Excel(name = "学院", width = 15)
|
||||
@Schema(description = "学院")
|
||||
private java.lang.String college;
|
||||
/**学历*/
|
||||
@Excel(name = "学历", width = 15)
|
||||
@Schema(description = "学历")
|
||||
private java.lang.String education;
|
||||
/**职称*/
|
||||
@Excel(name = "职称", width = 15)
|
||||
@Schema(description = "职称")
|
||||
private java.lang.String title;
|
||||
/**标签*/
|
||||
@Excel(name = "标签", width = 15)
|
||||
@Schema(description = "标签")
|
||||
private java.lang.String tag;
|
||||
/**显示顺序*/
|
||||
@Excel(name = "显示顺序", width = 15)
|
||||
@Schema(description = "显示顺序")
|
||||
private java.lang.Integer sortOrder;
|
||||
/**创建人*/
|
||||
@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;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.gen.userinfo.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.gen.userinfo.entity.UserInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 用户信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-08-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface UserInfoMapper extends BaseMapper<UserInfo> {
|
||||
|
||||
}
|
@ -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.gen.userinfo.mapper.UserInfoMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.gen.userinfo.service;
|
||||
|
||||
import org.jeecg.modules.gen.userinfo.entity.UserInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 用户信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-08-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IUserInfoService extends IService<UserInfo> {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.gen.userinfo.service.impl;
|
||||
|
||||
import org.jeecg.modules.gen.userinfo.entity.UserInfo;
|
||||
import org.jeecg.modules.gen.userinfo.mapper.UserInfoMapper;
|
||||
import org.jeecg.modules.gen.userinfo.service.IUserInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 用户信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-08-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements IUserInfoService {
|
||||
|
||||
}
|
64
jeecgboot-vue3/src/views/gen/activity/Activity.api.ts
Normal file
64
jeecgboot-vue3/src/views/gen/activity/Activity.api.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/gen/activity/activity/list',
|
||||
save='/gen/activity/activity/add',
|
||||
edit='/gen/activity/activity/edit',
|
||||
deleteOne = '/gen/activity/activity/delete',
|
||||
deleteBatch = '/gen/activity/activity/deleteBatch',
|
||||
importExcel = '/gen/activity/activity/importExcel',
|
||||
exportXls = '/gen/activity/activity/exportXls',
|
||||
}
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) =>
|
||||
defHttp.get({url: Api.list, params});
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({url: url, params});
|
||||
}
|
179
jeecgboot-vue3/src/views/gen/activity/Activity.data.ts
Normal file
179
jeecgboot-vue3/src/views/gen/activity/Activity.data.ts
Normal file
@ -0,0 +1,179 @@
|
||||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { getWeekMonthQuarterYear } from '/@/utils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '标题',
|
||||
align:"center",
|
||||
dataIndex: 'title'
|
||||
},
|
||||
{
|
||||
title: '介绍',
|
||||
align:"center",
|
||||
dataIndex: 'introduction',
|
||||
},
|
||||
{
|
||||
title: '说明图片',
|
||||
align:"center",
|
||||
dataIndex: 'imgs',
|
||||
customRender:render.renderImage,
|
||||
},
|
||||
{
|
||||
title: '头图',
|
||||
align:"center",
|
||||
dataIndex: 'banner',
|
||||
customRender:render.renderImage,
|
||||
},
|
||||
{
|
||||
title: '介绍视频',
|
||||
align:"center",
|
||||
dataIndex: 'video',
|
||||
},
|
||||
{
|
||||
title: '报名人数上限',
|
||||
align:"center",
|
||||
dataIndex: 'maxNum'
|
||||
},
|
||||
{
|
||||
title: '开始时间',
|
||||
align:"center",
|
||||
dataIndex: 'startTime'
|
||||
},
|
||||
{
|
||||
title: '结束时间',
|
||||
align:"center",
|
||||
dataIndex: 'endTime'
|
||||
},
|
||||
{
|
||||
title: '扩展字段',
|
||||
align:"center",
|
||||
dataIndex: 'extra'
|
||||
},
|
||||
{
|
||||
title: '附件',
|
||||
align:"center",
|
||||
dataIndex: 'attachment',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
align:"center",
|
||||
dataIndex: 'status_dictText'
|
||||
},
|
||||
];
|
||||
//查询数据
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
];
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '标题',
|
||||
field: 'title',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '介绍',
|
||||
field: 'introduction',
|
||||
component: 'JEditor',
|
||||
},
|
||||
{
|
||||
label: '说明图片',
|
||||
field: 'imgs',
|
||||
component: 'JImageUpload',
|
||||
componentProps:{
|
||||
fileMax: 0
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '头图',
|
||||
field: 'banner',
|
||||
component: 'JImageUpload',
|
||||
componentProps:{
|
||||
fileMax: 0
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '介绍视频',
|
||||
field: 'video',
|
||||
component: 'JUpload',
|
||||
componentProps:{
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '报名人数上限',
|
||||
field: 'maxNum',
|
||||
component: 'InputNumber',
|
||||
},
|
||||
{
|
||||
label: '开始时间',
|
||||
field: 'startTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '结束时间',
|
||||
field: 'endTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '扩展字段',
|
||||
field: 'extra',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '附件',
|
||||
field: 'attachment',
|
||||
component: 'JUpload',
|
||||
componentProps:{
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
field: 'status',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps:{
|
||||
dictCode:"course_status",
|
||||
type: "radio"
|
||||
},
|
||||
},
|
||||
// TODO 主键隐藏字段,目前写死为ID
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false
|
||||
},
|
||||
];
|
||||
|
||||
// 高级查询数据
|
||||
export const superQuerySchema = {
|
||||
title: {title: '标题',order: 0,view: 'text', type: 'string',},
|
||||
introduction: {title: '介绍',order: 1,view: 'umeditor', type: 'string',},
|
||||
imgs: {title: '说明图片',order: 2,view: 'image', type: 'string',},
|
||||
banner: {title: '头图',order: 3,view: 'image', type: 'string',},
|
||||
video: {title: '介绍视频',order: 4,view: 'file', type: 'string',},
|
||||
maxNum: {title: '报名人数上限',order: 5,view: 'number', type: 'number',},
|
||||
startTime: {title: '开始时间',order: 6,view: 'datetime', type: 'string',},
|
||||
endTime: {title: '结束时间',order: 7,view: 'datetime', type: 'string',},
|
||||
extra: {title: '扩展字段',order: 8,view: 'text', type: 'string',},
|
||||
attachment: {title: '附件',order: 9,view: 'file', type: 'string',},
|
||||
status: {title: '状态',order: 10,view: 'radio', type: 'string',dictCode: 'course_status',},
|
||||
};
|
||||
|
||||
/**
|
||||
* 流程表单调用这个方法获取formSchema
|
||||
* @param param
|
||||
*/
|
||||
export function getBpmFormSchema(_formData): FormSchema[]{
|
||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
||||
return formSchema;
|
||||
}
|
220
jeecgboot-vue3/src/views/gen/activity/ActivityList.vue
Normal file
220
jeecgboot-vue3/src/views/gen/activity/ActivityList.vue
Normal file
@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'gen.activity:activity:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
<a-button type="primary" v-auth="'gen.activity:activity:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||
<j-upload-button type="primary" v-auth="'gen.activity:activity:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
||||
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button v-auth="'gen.activity:activity:deleteBatch'">批量操作
|
||||
<Icon icon="mdi:chevron-down"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
<!-- 高级查询 -->
|
||||
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
|
||||
</template>
|
||||
<!--字段回显插槽-->
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
<template v-if="column.dataIndex==='introduction'">
|
||||
<!--富文本件字段回显插槽-->
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<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==='attachment'">
|
||||
<!--文件字段回显插槽-->
|
||||
<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>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<ActivityModal @register="registerModal" @success="handleSuccess"></ActivityModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="gen.activity-activity" 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 ActivityModal from './components/ActivityModal.vue'
|
||||
import {columns, searchFormSchema, superQuerySchema} from './Activity.data';
|
||||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './Activity.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
//日期个性化选择
|
||||
const fieldPickers = reactive({
|
||||
});
|
||||
const queryParam = reactive<any>({});
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
const userStore = useUserStore();
|
||||
const { createMessage } = useMessage();
|
||||
//注册model
|
||||
const [registerModal, {openModal}] = useModal();
|
||||
//注册table数据
|
||||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
|
||||
tableProps:{
|
||||
title: '活动',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:true,
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter:true,
|
||||
showAdvancedButton:true,
|
||||
fieldMapToNumber: [
|
||||
],
|
||||
fieldMapToTime: [
|
||||
],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed:'right'
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
if (params && fieldPickers) {
|
||||
for (let key in fieldPickers) {
|
||||
if (params[key]) {
|
||||
params[key] = getDateByPicker(params[key], fieldPickers[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name:"活动",
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
},
|
||||
})
|
||||
|
||||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
||||
|
||||
// 高级查询配置
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
/**
|
||||
* 高级查询事件
|
||||
*/
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).map((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
reload();
|
||||
}
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({id: record.id}, handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record){
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
auth: 'gen.activity:activity:edit'
|
||||
}
|
||||
]
|
||||
}
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record){
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
auth: 'gen.activity:activity:delete'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-picker),:deep(.ant-input-number){
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<div style="min-height: 400px">
|
||||
<BasicForm @register="registerForm"></BasicForm>
|
||||
<div style="width: 100%;text-align: center" v-if="!formDisabled">
|
||||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
||||
import {computed, defineComponent} from 'vue';
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
import {getBpmFormSchema} from '../Activity.data';
|
||||
import {saveOrUpdate} from '../Activity.api';
|
||||
|
||||
export default defineComponent({
|
||||
name: "ActivityForm",
|
||||
components:{
|
||||
BasicForm
|
||||
},
|
||||
props:{
|
||||
formData: propTypes.object.def({}),
|
||||
formBpm: propTypes.bool.def(true),
|
||||
},
|
||||
setup(props){
|
||||
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
|
||||
labelWidth: 150,
|
||||
schemas: getBpmFormSchema(props.formData),
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: 24}
|
||||
});
|
||||
|
||||
const formDisabled = computed(()=>{
|
||||
if(props.formData.disabled === false){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
let formData = {};
|
||||
const queryByIdUrl = '/gen/activity/activity/queryById';
|
||||
async function initFormData(){
|
||||
let params = {id: props.formData.dataId};
|
||||
const data = await defHttp.get({url: queryByIdUrl, params});
|
||||
formData = {...data}
|
||||
//设置表单的值
|
||||
await setFieldsValue(formData);
|
||||
//默认是禁用
|
||||
await setProps({disabled: formDisabled.value})
|
||||
}
|
||||
|
||||
async function submitForm() {
|
||||
let data = getFieldsValue();
|
||||
let params = Object.assign({}, formData, data);
|
||||
console.log('表单数据', params)
|
||||
await saveOrUpdate(params, true)
|
||||
}
|
||||
|
||||
initFormData();
|
||||
|
||||
return {
|
||||
registerForm,
|
||||
formDisabled,
|
||||
submitForm,
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" name="ActivityForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref, computed, unref, reactive} from 'vue';
|
||||
import {BasicModal, useModalInner} from '/@/components/Modal';
|
||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
||||
import {formSchema} from '../Activity.data';
|
||||
import {saveOrUpdate} from '../Activity.api';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
const { createMessage } = useMessage();
|
||||
// Emits声明
|
||||
const emit = defineEmits(['register','success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
//表单配置
|
||||
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({
|
||||
labelWidth: 150,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: 24}
|
||||
});
|
||||
//表单赋值
|
||||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
||||
//重置表单
|
||||
await resetFields();
|
||||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !!data?.showFooter;
|
||||
if (unref(isUpdate)) {
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
}
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !data?.showFooter })
|
||||
});
|
||||
//日期个性化选择
|
||||
const fieldPickers = reactive({
|
||||
});
|
||||
//设置标题
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
|
||||
//表单提交事件
|
||||
async function handleSubmit(v) {
|
||||
try {
|
||||
let values = await validate();
|
||||
// 预处理日期数据
|
||||
changeDateValue(values);
|
||||
setModalProps({confirmLoading: true});
|
||||
//提交表单
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
//关闭弹窗
|
||||
closeModal();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} catch ({ errorFields }) {
|
||||
if (errorFields) {
|
||||
const firstField = errorFields[0];
|
||||
if (firstField) {
|
||||
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
return Promise.reject(errorFields);
|
||||
} finally {
|
||||
setModalProps({confirmLoading: false});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理日期值
|
||||
* @param formData 表单数据
|
||||
*/
|
||||
const changeDateValue = (formData) => {
|
||||
if (formData && fieldPickers) {
|
||||
for (let key in fieldPickers) {
|
||||
if (formData[key]) {
|
||||
formData[key] = getDateByPicker(formData[key], fieldPickers[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/** 时间和数字输入框样式 */
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.ant-calendar-picker) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
64
jeecgboot-vue3/src/views/gen/userinfo/UserInfo.api.ts
Normal file
64
jeecgboot-vue3/src/views/gen/userinfo/UserInfo.api.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/gen/userinfo/userInfo/list',
|
||||
save='/gen/userinfo/userInfo/add',
|
||||
edit='/gen/userinfo/userInfo/edit',
|
||||
deleteOne = '/gen/userinfo/userInfo/delete',
|
||||
deleteBatch = '/gen/userinfo/userInfo/deleteBatch',
|
||||
importExcel = '/gen/userinfo/userInfo/importExcel',
|
||||
exportXls = '/gen/userinfo/userInfo/exportXls',
|
||||
}
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) =>
|
||||
defHttp.get({url: Api.list, params});
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({url: url, params});
|
||||
}
|
111
jeecgboot-vue3/src/views/gen/userinfo/UserInfo.data.ts
Normal file
111
jeecgboot-vue3/src/views/gen/userinfo/UserInfo.data.ts
Normal file
@ -0,0 +1,111 @@
|
||||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { getWeekMonthQuarterYear } from '/@/utils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '用户id',
|
||||
align:"center",
|
||||
dataIndex: 'userId'
|
||||
},
|
||||
{
|
||||
title: '专业',
|
||||
align:"center",
|
||||
dataIndex: 'major'
|
||||
},
|
||||
{
|
||||
title: '学院',
|
||||
align:"center",
|
||||
dataIndex: 'college'
|
||||
},
|
||||
{
|
||||
title: '学历',
|
||||
align:"center",
|
||||
dataIndex: 'education'
|
||||
},
|
||||
{
|
||||
title: '职称',
|
||||
align:"center",
|
||||
dataIndex: 'title'
|
||||
},
|
||||
{
|
||||
title: '标签',
|
||||
align:"center",
|
||||
dataIndex: 'tag'
|
||||
},
|
||||
{
|
||||
title: '显示顺序',
|
||||
align:"center",
|
||||
dataIndex: 'sortOrder'
|
||||
},
|
||||
];
|
||||
//查询数据
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
];
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '用户id',
|
||||
field: 'userId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '专业',
|
||||
field: 'major',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '学院',
|
||||
field: 'college',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '学历',
|
||||
field: 'education',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '职称',
|
||||
field: 'title',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '标签',
|
||||
field: 'tag',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '显示顺序',
|
||||
field: 'sortOrder',
|
||||
component: 'InputNumber',
|
||||
},
|
||||
// TODO 主键隐藏字段,目前写死为ID
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false
|
||||
},
|
||||
];
|
||||
|
||||
// 高级查询数据
|
||||
export const superQuerySchema = {
|
||||
userId: {title: '用户id',order: 0,view: 'text', type: 'string',},
|
||||
major: {title: '专业',order: 1,view: 'text', type: 'string',},
|
||||
college: {title: '学院',order: 2,view: 'text', type: 'string',},
|
||||
education: {title: '学历',order: 3,view: 'text', type: 'string',},
|
||||
title: {title: '职称',order: 4,view: 'text', type: 'string',},
|
||||
tag: {title: '标签',order: 5,view: 'text', type: 'string',},
|
||||
sortOrder: {title: '显示顺序',order: 6,view: 'number', type: 'number',},
|
||||
};
|
||||
|
||||
/**
|
||||
* 流程表单调用这个方法获取formSchema
|
||||
* @param param
|
||||
*/
|
||||
export function getBpmFormSchema(_formData): FormSchema[]{
|
||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
||||
return formSchema;
|
||||
}
|
206
jeecgboot-vue3/src/views/gen/userinfo/UserInfoList.vue
Normal file
206
jeecgboot-vue3/src/views/gen/userinfo/UserInfoList.vue
Normal file
@ -0,0 +1,206 @@
|
||||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'gen.userinfo:user_info:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
<a-button type="primary" v-auth="'gen.userinfo:user_info:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||
<j-upload-button type="primary" v-auth="'gen.userinfo:user_info:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
||||
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button v-auth="'gen.userinfo:user_info:deleteBatch'">批量操作
|
||||
<Icon icon="mdi:chevron-down"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
<!-- 高级查询 -->
|
||||
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
|
||||
</template>
|
||||
<!--字段回显插槽-->
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<UserInfoModal @register="registerModal" @success="handleSuccess"></UserInfoModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="gen.userinfo-userInfo" 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 UserInfoModal from './components/UserInfoModal.vue'
|
||||
import {columns, searchFormSchema, superQuerySchema} from './UserInfo.data';
|
||||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './UserInfo.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
//日期个性化选择
|
||||
const fieldPickers = reactive({
|
||||
});
|
||||
const queryParam = reactive<any>({});
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
const userStore = useUserStore();
|
||||
const { createMessage } = useMessage();
|
||||
//注册model
|
||||
const [registerModal, {openModal}] = useModal();
|
||||
//注册table数据
|
||||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
|
||||
tableProps:{
|
||||
title: '用户信息',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:true,
|
||||
formConfig: {
|
||||
//labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter:true,
|
||||
showAdvancedButton:true,
|
||||
fieldMapToNumber: [
|
||||
],
|
||||
fieldMapToTime: [
|
||||
],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed:'right'
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
if (params && fieldPickers) {
|
||||
for (let key in fieldPickers) {
|
||||
if (params[key]) {
|
||||
params[key] = getDateByPicker(params[key], fieldPickers[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name:"用户信息",
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
},
|
||||
})
|
||||
|
||||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
||||
|
||||
// 高级查询配置
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
/**
|
||||
* 高级查询事件
|
||||
*/
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).map((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
reload();
|
||||
}
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({id: record.id}, handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record){
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
auth: 'gen.userinfo:user_info:edit'
|
||||
}
|
||||
]
|
||||
}
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record){
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
auth: 'gen.userinfo:user_info:delete'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-picker),:deep(.ant-input-number){
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<div style="min-height: 400px">
|
||||
<BasicForm @register="registerForm"></BasicForm>
|
||||
<div style="width: 100%;text-align: center" v-if="!formDisabled">
|
||||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
||||
import {computed, defineComponent} from 'vue';
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { propTypes } from '/@/utils/propTypes';
|
||||
import {getBpmFormSchema} from '../UserInfo.data';
|
||||
import {saveOrUpdate} from '../UserInfo.api';
|
||||
|
||||
export default defineComponent({
|
||||
name: "UserInfoForm",
|
||||
components:{
|
||||
BasicForm
|
||||
},
|
||||
props:{
|
||||
formData: propTypes.object.def({}),
|
||||
formBpm: propTypes.bool.def(true),
|
||||
},
|
||||
setup(props){
|
||||
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
|
||||
labelWidth: 150,
|
||||
schemas: getBpmFormSchema(props.formData),
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: 24}
|
||||
});
|
||||
|
||||
const formDisabled = computed(()=>{
|
||||
if(props.formData.disabled === false){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
let formData = {};
|
||||
const queryByIdUrl = '/gen/userinfo/userInfo/queryById';
|
||||
async function initFormData(){
|
||||
let params = {id: props.formData.dataId};
|
||||
const data = await defHttp.get({url: queryByIdUrl, params});
|
||||
formData = {...data}
|
||||
//设置表单的值
|
||||
await setFieldsValue(formData);
|
||||
//默认是禁用
|
||||
await setProps({disabled: formDisabled.value})
|
||||
}
|
||||
|
||||
async function submitForm() {
|
||||
let data = getFieldsValue();
|
||||
let params = Object.assign({}, formData, data);
|
||||
console.log('表单数据', params)
|
||||
await saveOrUpdate(params, true)
|
||||
}
|
||||
|
||||
initFormData();
|
||||
|
||||
return {
|
||||
registerForm,
|
||||
formDisabled,
|
||||
submitForm,
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" name="UserInfoForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref, computed, unref, reactive} from 'vue';
|
||||
import {BasicModal, useModalInner} from '/@/components/Modal';
|
||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
||||
import {formSchema} from '../UserInfo.data';
|
||||
import {saveOrUpdate} from '../UserInfo.api';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getDateByPicker } from '/@/utils';
|
||||
const { createMessage } = useMessage();
|
||||
// Emits声明
|
||||
const emit = defineEmits(['register','success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
//表单配置
|
||||
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({
|
||||
labelWidth: 150,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: 24}
|
||||
});
|
||||
//表单赋值
|
||||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
||||
//重置表单
|
||||
await resetFields();
|
||||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !!data?.showFooter;
|
||||
if (unref(isUpdate)) {
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
}
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !data?.showFooter })
|
||||
});
|
||||
//日期个性化选择
|
||||
const fieldPickers = reactive({
|
||||
});
|
||||
//设置标题
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
|
||||
//表单提交事件
|
||||
async function handleSubmit(v) {
|
||||
try {
|
||||
let values = await validate();
|
||||
// 预处理日期数据
|
||||
changeDateValue(values);
|
||||
setModalProps({confirmLoading: true});
|
||||
//提交表单
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
//关闭弹窗
|
||||
closeModal();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} catch ({ errorFields }) {
|
||||
if (errorFields) {
|
||||
const firstField = errorFields[0];
|
||||
if (firstField) {
|
||||
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
return Promise.reject(errorFields);
|
||||
} finally {
|
||||
setModalProps({confirmLoading: false});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理日期值
|
||||
* @param formData 表单数据
|
||||
*/
|
||||
const changeDateValue = (formData) => {
|
||||
if (formData && fieldPickers) {
|
||||
for (let key in fieldPickers) {
|
||||
if (formData[key]) {
|
||||
formData[key] = getDateByPicker(formData[key], fieldPickers[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/** 时间和数字输入框样式 */
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.ant-calendar-picker) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user