Commit 3856c8c6 authored by 刘子正's avatar 刘子正

教师BTeacher、学生BStudent、班级BClass、教室BRooms、角色SysRole、用户SysUser 改为物理删除,统一异常编号

parent b4ab840c
...@@ -77,7 +77,7 @@ public class BClassServiceImpl implements BClassService { ...@@ -77,7 +77,7 @@ public class BClassServiceImpl implements BClassService {
@Override @Override
public PersistModel removeBClass(String id) { public PersistModel removeBClass(String id) {
if(brClassStudentRepository.selectStuentNumByClassId(id)>0) { if(brClassStudentRepository.selectStuentNumByClassId(id)>0) {
throw new ServiceException(ResultServiceEnums.CLASS_HAS_STUDENTS); throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
} }
int line = bClassRepository.deleteByPrimaryKey(id); int line = bClassRepository.deleteByPrimaryKey(id);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS); return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
......
...@@ -68,7 +68,7 @@ public class BRoomsController extends FileController<BRooms> { ...@@ -68,7 +68,7 @@ public class BRoomsController extends FileController<BRooms> {
bRooms); bRooms);
} }
@ApiOperation(value="逻辑删除", notes="逻辑删除") @ApiOperation(value="物理删除", notes="物理删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "varchar")}) @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{id:\\w+}") @DeleteMapping("/delete/{id:\\w+}")
public Result delete(@PathVariable String id) { public Result delete(@PathVariable String id) {
......
...@@ -62,7 +62,7 @@ public class BRoomsServiceImpl implements BRoomsService { ...@@ -62,7 +62,7 @@ public class BRoomsServiceImpl implements BRoomsService {
} }
/** /**
* 逻辑删除 * 物理删除
* @param bRooms * @param bRooms
* @return * @return
*/ */
...@@ -71,10 +71,10 @@ public class BRoomsServiceImpl implements BRoomsService { ...@@ -71,10 +71,10 @@ public class BRoomsServiceImpl implements BRoomsService {
public PersistModel remove(BRooms bRooms){ public PersistModel remove(BRooms bRooms){
if(bArrangeRepository.countThisRoomNum(bRooms.getBusinessId()) != 0 if(bArrangeRepository.countThisRoomNum(bRooms.getBusinessId()) != 0
|| bSlScheduleRepository.countThisRoomNum(bRooms.getBusinessId()) != 0){ || bSlScheduleRepository.countThisRoomNum(bRooms.getBusinessId()) != 0){
throw new ServiceException(ResultServiceEnums.ROOM_HAS_USED); throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
}else{ }else{
int line = bRoomsRepository.deleteByPrimaryKey(bRooms.getBusinessId()); int line = bRoomsRepository.deleteByPrimaryKey(bRooms.getBusinessId());
log.info(UserUtil.getUserInfoProp(bRooms.getToken(),UserUtil.USER_USERNAME)+"逻辑删除了ID为"+ log.info(UserUtil.getUserInfoProp(bRooms.getToken(),UserUtil.USER_USERNAME)+"物理删除了ID为"+
bRooms.getBusinessId()+"的信息"); bRooms.getBusinessId()+"的信息");
return new PersistModel(line); return new PersistModel(line);
} }
......
...@@ -122,7 +122,7 @@ public class BStudentController extends PaginationController<BStudent> { ...@@ -122,7 +122,7 @@ public class BStudentController extends PaginationController<BStudent> {
} }
@ApiOperation(value="逻辑删除", notes="根据ID删除一条记录") @ApiOperation(value="物理删除", notes="根据ID删除一条记录")
@ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar") @ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
@PostMapping(value = "/remove") @PostMapping(value = "/remove")
......
...@@ -259,7 +259,7 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -259,7 +259,7 @@ public class BStudentServiceImpl implements BStudentService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel removeBBStudent(String id) { public PersistModel removeBBStudent(String id) {
if(brSlStudentRepository.selectSlNumByStuId(id)>0) { if(brSlStudentRepository.selectSlNumByStuId(id)>0) {
throw new ServiceException(ResultServiceEnums.STUDENT_HAS_SL); throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
} }
BStudent bStudent = new BStudent(); BStudent bStudent = new BStudent();
bStudent.setBusinessId(id); bStudent.setBusinessId(id);
...@@ -268,7 +268,7 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -268,7 +268,7 @@ public class BStudentServiceImpl implements BStudentService {
bStudent.setDeleted(); bStudent.setDeleted();
UserUtil.setCurrentMergeOperation(bStudent); UserUtil.setCurrentMergeOperation(bStudent);
int line = bStudentRepository.logicalDelete(bStudent); int line = bStudentRepository.deleteByPrimaryKey(bStudent);
brClassStudentRepository.deleteCSByStuId(student.getCode()); brClassStudentRepository.deleteCSByStuId(student.getCode());
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS); return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
......
...@@ -63,7 +63,7 @@ public class BTeacherController extends PaginationController<BTeacher> { ...@@ -63,7 +63,7 @@ public class BTeacherController extends PaginationController<BTeacher> {
bTeacher); bTeacher);
} }
@ApiOperation(value="逻辑删除", notes="根据ID删除一条记录") @ApiOperation(value="物理删除", notes="根据ID删除一条记录")
@ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar") @ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
@PostMapping(value = "/remove") @PostMapping(value = "/remove")
......
...@@ -215,15 +215,15 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -215,15 +215,15 @@ public class BTeacherServiceImpl implements BTeacherService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel removeBTeacher(String id) { public PersistModel removeBTeacher(String id) {
if(bSlRepository.selectSlNumByStuent(id)>0) { if(bSlRepository.selectSlNumByStuent(id)>0) {
throw new ServiceException(ResultServiceEnums.TEACHER_HAS_SL); throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
} }
BTeacher bTeacher = new BTeacher(); BTeacher bTeacher = new BTeacher();
bTeacher.setBusinessId(id); bTeacher.setBusinessId(id);
BTeacher teacher = bTeacherRepository.selectOne(bTeacher); BTeacher teacher = bTeacherRepository.selectOne(bTeacher);
UserUtil.setCurrentMergeOperation(bTeacher); UserUtil.setCurrentMergeOperation(bTeacher);
sysUserMapper.deleteByCode(teacher.getCode()); sysUserMapper.deleteByCode(teacher.getCode());
bTeacher.setDeleted(); // bTeacher.setDeleted();
int line = bTeacherRepository.logicalDelete(bTeacher); int line = bTeacherRepository.deleteByPrimaryKey(bTeacher);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS); return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
} }
......
...@@ -68,7 +68,7 @@ public class SysRoleServiceImpl implements SysRoleService { ...@@ -68,7 +68,7 @@ public class SysRoleServiceImpl implements SysRoleService {
int userCount = sysUserMapper.countUserByRole(id); int userCount = sysUserMapper.countUserByRole(id);
//如果仍然有用户(如果用户被逻辑删除,则忽略此角色,但如果用于被停用,则依然被计算)是此角色,则该角色不可删除 //如果仍然有用户(如果用户被逻辑删除,则忽略此角色,但如果用于被停用,则依然被计算)是此角色,则该角色不可删除
if(userCount > 0){ if(userCount > 0){
throw new ServiceException(ResultServiceEnums.ROLE_HAS_USER); throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
}else{ }else{
//删除该角色所有的关联信息 //删除该角色所有的关联信息
sysRoleRepository.deleteRoleMenuByRoleId(id); sysRoleRepository.deleteRoleMenuByRoleId(id);
......
...@@ -81,7 +81,7 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -81,7 +81,7 @@ public class SysUserServiceImpl implements SysUserService {
user.setDeleted(); user.setDeleted();
user.setStop(); user.setStop();
user.setBusinessId(id); user.setBusinessId(id);
return sysUserMapper.logicalDelete(user); return sysUserMapper.deleteByPrimaryKey(user);
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment