yonge 3 years ago
parent
commit
e72cf99aad

+ 1 - 1
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/core/filter/UsernameAuthenticationFilter.java

@@ -81,7 +81,7 @@ public class UsernameAuthenticationFilter extends AbstractAuthenticationProcessi
 			clientId = "SYSTEM";
 		}
 		if (!userInfo.getSysUser().getUserType().contains(clientId)) {
-			throw new LockedException("用户不存在,请联系教务老师");
+			throw new LockedException("用户不存在");
 		}
 
 		UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(SecurityConstants.USERNAME_PRINCIPAL_PREFIX + username,

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/SubjectDao.java

@@ -31,7 +31,7 @@ public interface SubjectDao extends BaseDAO<Long, Subject> {
      * @updateTime 2022/4/6 11:40
      * @return: java.util.List<com.yonge.cooleshow.biz.dal.entity.Subject>
      */
-    List<Subject> findByParentId(@Param("parentId") Long parentId, @Param("delFlag") Boolean delFlag);
+    List<Subject> findByParentId(@Param("parentId") Long parentId);
 
     /***
      * 通过id删除

+ 5 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/SubjectServiceImpl.java

@@ -48,6 +48,10 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
 
     @Override
 	public int deleteById(Long id) {
+    	List<Subject> subjectList = subjectDao.findByParentId(id);
+    	if(subjectList != null && subjectList.size() > 0){
+			throw new BizException("该分类下已创建下级,无法删除");
+    	}
 		return subjectDao.deleteById(id);
 	}
 
@@ -113,7 +117,7 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
     private Subject getTree(Subject sub, Boolean delFlag) {
         //得到根节点对象
         //获取子节点list
-        List<Subject> subjects = subjectDao.findByParentId(sub.getId(), delFlag);
+        List<Subject> subjects = subjectDao.findByParentId(sub.getId());
         //如果存在子节点
         if (subjects != null && subjects.size() > 0) {
             //将子节点list放入父节点对象

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -70,7 +70,7 @@
 	</update>
 
     <delete id="deleteById">
-		update subject set del_flag_ = 1 where id_ = #{id} or parent_subject_id_ = #{id}
+		update subject set del_flag_ = 1 where id_ = #{id}
 	</delete>
 
     <!-- 分页查询 -->