Merge branch 'new-1.0' of http://62.234.217.137:3000/Big-Data-Lab/CEES-CMD into new-1.0
This commit is contained in:
commit
f9ae3fd1db
|
@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSON;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
|
@ -14,12 +16,14 @@ import org.jeecg.modules.entity.CeesLocalTeacher;
|
|||
import org.jeecg.modules.enums.MajorEnum;
|
||||
import org.jeecg.modules.service.ICeesLocalTeacherService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.metrics.startup.StartupTimeMetricsListener;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 本校教师表
|
||||
|
@ -34,8 +38,10 @@ import java.util.Arrays;
|
|||
public class CeesLocalTeacherController extends JeecgController<CeesLocalTeacher, ICeesLocalTeacherService> {
|
||||
@Autowired
|
||||
private ICeesLocalTeacherService ceesLocalTeacherService;
|
||||
@Autowired
|
||||
private StartupTimeMetricsListener startupTimeMetrics;
|
||||
|
||||
/**
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param ceesLocalTeacher
|
||||
|
@ -58,6 +64,16 @@ public class CeesLocalTeacherController extends JeecgController<CeesLocalTeacher
|
|||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量分组
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/batchGroup")
|
||||
public Result<?> batchGroup(@RequestBody Map<String, Object> webData){
|
||||
log.info(webData.toString());
|
||||
return ceesLocalTeacherService.batchGroup(webData);
|
||||
|
||||
}
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 外校老师管理
|
||||
|
@ -85,6 +86,17 @@ public class CeesWaiTeacherController extends JeecgController<CeesWaiTeacher, IC
|
|||
return Result.OK(ceesWaiTeacherService.queryPageList(ceesWaiTeacher,pageNo,pageSize,req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量分组
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/batchGroup")
|
||||
public Result<?> batchGroup(@RequestBody Map<String, Object> webData){
|
||||
log.info(webData.toString());
|
||||
return ceesWaiTeacherService.batchGroup(webData);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 研究生表
|
||||
|
@ -114,6 +115,16 @@ public class StudentController extends JeecgController<Student, IStudentService>
|
|||
this.studentService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
/**
|
||||
* 批量分组
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/batchGroup")
|
||||
public Result<?> batchGroup(@RequestBody Map<String, Object> webData){
|
||||
log.info(webData.toString());
|
||||
return studentService.batchGroup(webData);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
|
|
|
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CeesLocalTeacher;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 本校教师表
|
||||
* @Author: jeecg-boot
|
||||
|
@ -14,4 +16,6 @@ import org.jeecg.modules.entity.CeesLocalTeacher;
|
|||
public interface ICeesLocalTeacherService extends IService<CeesLocalTeacher> {
|
||||
|
||||
Result<?> h5Save(CeesLocalTeacher ceesLocalTeacher);
|
||||
|
||||
Result<?> batchGroup(Map<String, Object> webData);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.jeecg.modules.entity.CeesWaiTeacher;
|
|||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 外校老师管理
|
||||
|
@ -31,4 +32,6 @@ public interface ICeesWaiTeacherService extends IService<CeesWaiTeacher> {
|
|||
Result<?> h5Save(CeesWaiTeacher ceesWaiTeacher);
|
||||
|
||||
Result<?> getDormitoryName(String dormitoryId);
|
||||
|
||||
Result<?> batchGroup(Map<String, Object> webData);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.Student;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 研究生表
|
||||
* @Author: jeecg-boot
|
||||
|
@ -13,4 +15,6 @@ import org.jeecg.modules.entity.Student;
|
|||
public interface IStudentService extends IService<Student> {
|
||||
|
||||
Result<?> h5Save(Student student);
|
||||
|
||||
Result<?> batchGroup(Map<String, Object> webData);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.service.impl;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CeesLocalTeacher;
|
||||
|
@ -14,6 +15,9 @@ import org.jeecg.modules.service.ICeesUserService;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 本校教师表
|
||||
|
@ -28,7 +32,8 @@ public class CeesLocalTeacherServiceImpl extends ServiceImpl<CeesLocalTeacherMap
|
|||
CeesUserMapper ceesUserMapper;
|
||||
@Resource
|
||||
ICeesUserService ceesUserService;
|
||||
|
||||
@Resource
|
||||
CeesLocalTeacherMapper ceesLocalTeacherMapper;
|
||||
|
||||
/**
|
||||
* @param ceesLocalTeacher
|
||||
|
@ -52,4 +57,78 @@ public class CeesLocalTeacherServiceImpl extends ServiceImpl<CeesLocalTeacherMap
|
|||
jsonObject.put("router", "/mainPage");
|
||||
return Result.ok(jsonObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> batchGroup(Map<String, Object> webData) {
|
||||
String groupId = webData.get("groupId").toString();
|
||||
Object idsObj = webData.get("ids");
|
||||
List<String> ids = JSONObject.parseArray(idsObj.toString(), String.class);
|
||||
|
||||
// 记录更新结果
|
||||
int totalUpdatedLocal = 0;
|
||||
List<String> failedIdsLocal = new ArrayList<>();
|
||||
//更新具体的用户数据
|
||||
for (String id : ids) {
|
||||
try {
|
||||
LambdaUpdateWrapper<CeesLocalTeacher> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CeesLocalTeacher::getId, id)
|
||||
.set(CeesLocalTeacher::getGroupId, groupId);
|
||||
|
||||
// 执行更新并检查受影响行数
|
||||
int affectedRows = ceesLocalTeacherMapper.update(null, updateWrapper);
|
||||
|
||||
if (affectedRows > 0) {
|
||||
totalUpdatedLocal++;
|
||||
} else {
|
||||
failedIdsLocal.add(id); // 记录未更新的ID(可能用户不存在或groupId未变)
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failedIdsLocal.add(id); // 记录更新失败的ID
|
||||
|
||||
}
|
||||
}
|
||||
// 记录更新结果
|
||||
int totalUpdated = 0;
|
||||
List<String> failedIds = new ArrayList<>();
|
||||
//更新所以表中的用户数据
|
||||
for (String id : ids) {
|
||||
try {
|
||||
LambdaQueryWrapper<CeesLocalTeacher> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CeesLocalTeacher::getId, id);
|
||||
CeesLocalTeacher ceesLocalTeacher = ceesLocalTeacherMapper.selectOne(queryWrapper);
|
||||
String user_id = ceesLocalTeacher.getUserId();
|
||||
LambdaUpdateWrapper<CeesUser> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CeesUser::getUserId, user_id)
|
||||
.set(CeesUser::getGroupId, groupId);
|
||||
// 执行更新并检查受影响行数
|
||||
int affectedRows = ceesUserMapper.update(null, updateWrapper);
|
||||
|
||||
if (affectedRows > 0) {
|
||||
totalUpdated++;
|
||||
} else {
|
||||
failedIds.add(id); // 记录未更新的ID(可能用户不存在或groupId未变)
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failedIds.add(id); // 记录更新失败的ID
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 构建返回结果
|
||||
JSONObject resultJson = new JSONObject();
|
||||
//update-localTeacher
|
||||
JSONObject localTeacherJson = new JSONObject();
|
||||
localTeacherJson.put("totalUpdated", totalUpdatedLocal);
|
||||
localTeacherJson.put("failedIds", failedIdsLocal);
|
||||
localTeacherJson.put("success", failedIdsLocal.isEmpty()); // 是否全部成功
|
||||
//update-User
|
||||
JSONObject userJson = new JSONObject();
|
||||
userJson.put("totalUpdated", totalUpdated);
|
||||
userJson.put("failedIds", failedIds);
|
||||
userJson.put("success", failedIds.isEmpty()); // 是否全部成功
|
||||
|
||||
resultJson.put("localTeacher", localTeacherJson);
|
||||
resultJson.put("user", userJson);
|
||||
return Result.ok(resultJson);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ package org.jeecg.modules.service.impl;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
@ -12,6 +13,7 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.entity.CeesDormitoryInfo;
|
||||
import org.jeecg.modules.entity.CeesLocalTeacher;
|
||||
import org.jeecg.modules.entity.CeesUser;
|
||||
import org.jeecg.modules.entity.CeesWaiTeacher;
|
||||
import org.jeecg.modules.enums.MajorEnum;
|
||||
|
@ -23,7 +25,9 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -159,4 +163,78 @@ public class CeesWaiTeacherServiceImpl extends ServiceImpl<CeesWaiTeacherMapper,
|
|||
public Result<?> getDormitoryName(String dormitoryId) {
|
||||
return Result.ok(ceesDormitoryInfoMapper.selectById(dormitoryId).getDormitory());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> batchGroup(Map<String, Object> webData) {
|
||||
String groupId = webData.get("groupId").toString();
|
||||
Object idsObj = webData.get("ids");
|
||||
List<String> ids = JSONObject.parseArray(idsObj.toString(), String.class);
|
||||
|
||||
// 记录更新结果
|
||||
int totalUpdatedLocal = 0;
|
||||
List<String> failedIdsLocal = new ArrayList<>();
|
||||
//更新具体的用户数据
|
||||
for (String id : ids) {
|
||||
try {
|
||||
LambdaUpdateWrapper<CeesWaiTeacher> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CeesWaiTeacher::getId, id)
|
||||
.set(CeesWaiTeacher::getGroupId, groupId);
|
||||
|
||||
// 执行更新并检查受影响行数
|
||||
int affectedRows = ceesWaiTeacherMapper.update(null, updateWrapper);
|
||||
|
||||
if (affectedRows > 0) {
|
||||
totalUpdatedLocal++;
|
||||
} else {
|
||||
failedIdsLocal.add(id); // 记录未更新的ID(可能用户不存在或groupId未变)
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failedIdsLocal.add(id); // 记录更新失败的ID
|
||||
|
||||
}
|
||||
}
|
||||
// 记录更新结果
|
||||
int totalUpdated = 0;
|
||||
List<String> failedIds = new ArrayList<>();
|
||||
//更新所以表中的用户数据
|
||||
for (String id : ids) {
|
||||
try {
|
||||
LambdaQueryWrapper<CeesWaiTeacher> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CeesWaiTeacher::getId, id);
|
||||
CeesWaiTeacher ceesLocalTeacher = ceesWaiTeacherMapper.selectOne(queryWrapper);
|
||||
String user_id = ceesLocalTeacher.getUserId();
|
||||
LambdaUpdateWrapper<CeesUser> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CeesUser::getUserId, user_id)
|
||||
.set(CeesUser::getGroupId, groupId);
|
||||
// 执行更新并检查受影响行数
|
||||
int affectedRows = ceesUserMapper.update(null, updateWrapper);
|
||||
|
||||
if (affectedRows > 0) {
|
||||
totalUpdated++;
|
||||
} else {
|
||||
failedIds.add(id); // 记录未更新的ID(可能用户不存在或groupId未变)
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failedIds.add(id); // 记录更新失败的ID
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 构建返回结果
|
||||
JSONObject resultJson = new JSONObject();
|
||||
//update-localTeacher
|
||||
JSONObject localTeacherJson = new JSONObject();
|
||||
localTeacherJson.put("totalUpdated", totalUpdatedLocal);
|
||||
localTeacherJson.put("failedIds", failedIdsLocal);
|
||||
localTeacherJson.put("success", failedIdsLocal.isEmpty()); // 是否全部成功
|
||||
//update-User
|
||||
JSONObject userJson = new JSONObject();
|
||||
userJson.put("totalUpdated", totalUpdated);
|
||||
userJson.put("failedIds", failedIds);
|
||||
userJson.put("success", failedIds.isEmpty()); // 是否全部成功
|
||||
|
||||
resultJson.put("localTeacher", localTeacherJson);
|
||||
resultJson.put("user", userJson);
|
||||
return Result.ok(resultJson);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@ package org.jeecg.modules.service.impl;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.CeesUser;
|
||||
import org.jeecg.modules.entity.CeesWaiTeacher;
|
||||
import org.jeecg.modules.entity.Student;
|
||||
import org.jeecg.modules.mapper.CeesUserMapper;
|
||||
import org.jeecg.modules.mapper.StudentMapper;
|
||||
|
@ -14,6 +16,9 @@ import org.jeecg.modules.service.IStudentService;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 研究生表
|
||||
|
@ -27,6 +32,8 @@ public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> impl
|
|||
CeesUserMapper ceesUserMapper;
|
||||
@Resource
|
||||
ICeesUserService ceesUserService;
|
||||
@Resource
|
||||
StudentMapper studentMapper;
|
||||
/**
|
||||
* @param student
|
||||
* @return
|
||||
|
@ -48,4 +55,78 @@ public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> impl
|
|||
jsonObject.put("router", "/mainPage");
|
||||
return Result.ok(jsonObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> batchGroup(Map<String, Object> webData) {
|
||||
String groupId = webData.get("groupId").toString();
|
||||
Object idsObj = webData.get("ids");
|
||||
List<String> ids = JSONObject.parseArray(idsObj.toString(), String.class);
|
||||
|
||||
// 记录更新结果
|
||||
int totalUpdatedLocal = 0;
|
||||
List<String> failedIdsLocal = new ArrayList<>();
|
||||
//更新具体的用户数据
|
||||
for (String id : ids) {
|
||||
try {
|
||||
LambdaUpdateWrapper<Student> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(Student::getId, id)
|
||||
.set(Student::getGroupId, groupId);
|
||||
|
||||
// 执行更新并检查受影响行数
|
||||
int affectedRows = studentMapper.update(null, updateWrapper);
|
||||
|
||||
if (affectedRows > 0) {
|
||||
totalUpdatedLocal++;
|
||||
} else {
|
||||
failedIdsLocal.add(id); // 记录未更新的ID(可能用户不存在或groupId未变)
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failedIdsLocal.add(id); // 记录更新失败的ID
|
||||
|
||||
}
|
||||
}
|
||||
// 记录更新结果
|
||||
int totalUpdated = 0;
|
||||
List<String> failedIds = new ArrayList<>();
|
||||
//更新所以表中的用户数据
|
||||
for (String id : ids) {
|
||||
try {
|
||||
LambdaQueryWrapper<Student> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Student::getId, id);
|
||||
Student Student = studentMapper.selectOne(queryWrapper);
|
||||
String user_id = Student.getUserId();
|
||||
LambdaUpdateWrapper<CeesUser> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CeesUser::getUserId, user_id)
|
||||
.set(CeesUser::getGroupId, groupId);
|
||||
// 执行更新并检查受影响行数
|
||||
int affectedRows = ceesUserMapper.update(null, updateWrapper);
|
||||
|
||||
if (affectedRows > 0) {
|
||||
totalUpdated++;
|
||||
} else {
|
||||
failedIds.add(id); // 记录未更新的ID(可能用户不存在或groupId未变)
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failedIds.add(id); // 记录更新失败的ID
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 构建返回结果
|
||||
JSONObject resultJson = new JSONObject();
|
||||
//update-localTeacher
|
||||
JSONObject localTeacherJson = new JSONObject();
|
||||
localTeacherJson.put("totalUpdated", totalUpdatedLocal);
|
||||
localTeacherJson.put("failedIds", failedIdsLocal);
|
||||
localTeacherJson.put("success", failedIdsLocal.isEmpty()); // 是否全部成功
|
||||
//update-User
|
||||
JSONObject userJson = new JSONObject();
|
||||
userJson.put("totalUpdated", totalUpdated);
|
||||
userJson.put("failedIds", failedIds);
|
||||
userJson.put("success", failedIds.isEmpty()); // 是否全部成功
|
||||
|
||||
resultJson.put("localTeacher", localTeacherJson);
|
||||
resultJson.put("user", userJson);
|
||||
return Result.ok(resultJson);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue