|
@@ -7,7 +7,6 @@ import javax.persistence.EntityManager;
|
|
|
import javax.persistence.PersistenceContext;
|
|
|
import javax.persistence.Query;
|
|
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -39,7 +38,7 @@ public class PrivilegeServiceImpl extends BaseQueryService<Privilege> implements
|
|
|
|
|
|
// @Autowired
|
|
|
// private SystemAuthService authService;
|
|
|
-
|
|
|
+ //
|
|
|
// @Autowired
|
|
|
// private SystemCache authCache;
|
|
|
|
|
@@ -83,20 +82,22 @@ public class PrivilegeServiceImpl extends BaseQueryService<Privilege> implements
|
|
|
// if (systemAuth != null &&
|
|
|
// SystemAuthType.ONLINE.equals(systemAuth.getType()) &&
|
|
|
// authCache.isAuth()) {
|
|
|
- disablePrivilege(schoolId, new String[] { "user_list-help_video", "exam_mark-group-help_video",
|
|
|
- "exam_inspected_info-list-help_video" });
|
|
|
+ // disablePrivilege(schoolId, new String[] { "user_list-help_video",
|
|
|
+ // "exam_mark-group-help_video",
|
|
|
+ // "exam_inspected_info-list-help_video" });
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
- private void disablePrivilege(Integer schoolId, String[] codes) {
|
|
|
- StringBuilder sql = new StringBuilder();
|
|
|
- sql.append("update b_role_privilege ");
|
|
|
- sql.append(" set enable=0 ");
|
|
|
- sql.append(" where privilege_code in('" + StringUtils.join(codes, "','") + "')");
|
|
|
- sql.append(" and school_id=" + schoolId);
|
|
|
- Query query = entityManager.createNativeQuery(sql.toString());
|
|
|
- query.executeUpdate();
|
|
|
- }
|
|
|
+ // private void disablePrivilege(Integer schoolId, String[] codes) {
|
|
|
+ // StringBuilder sql = new StringBuilder();
|
|
|
+ // sql.append("update b_role_privilege ");
|
|
|
+ // sql.append(" set enable=0 ");
|
|
|
+ // sql.append(" where privilege_code in('" + StringUtils.join(codes, "','")
|
|
|
+ // + "')");
|
|
|
+ // sql.append(" and school_id=" + schoolId);
|
|
|
+ // Query query = entityManager.createNativeQuery(sql.toString());
|
|
|
+ // query.executeUpdate();
|
|
|
+ // }
|
|
|
|
|
|
private void initSchoolAdminPrivilege(Integer schoolId) {
|
|
|
Role role = Role.SCHOOL_ADMIN;
|
|
@@ -125,8 +126,7 @@ public class PrivilegeServiceImpl extends BaseQueryService<Privilege> implements
|
|
|
sql.append(
|
|
|
" ,'exam_score','exam_score-export','exam_report_subject','exam_report_subject-total','exam_report_subject-range','exam_report_subject-college',"
|
|
|
+ "'exam_report_subject-teacher','exam_report_subject-class'"
|
|
|
- + ",'exam_report_subject-objective_question','exam_report_subject-subjective_question','exam_report_subject-group'"
|
|
|
- + ",'exam_mark-group-help_video','exam_inspected_info-list-help_video')");
|
|
|
+ + ",'exam_report_subject-objective_question','exam_report_subject-subjective_question','exam_report_subject-group')");
|
|
|
sql.append(" and s.id=" + schoolId);
|
|
|
Query query = entityManager.createNativeQuery(sql.toString());
|
|
|
query.executeUpdate();
|
|
@@ -158,8 +158,7 @@ public class PrivilegeServiceImpl extends BaseQueryService<Privilege> implements
|
|
|
sql.append(
|
|
|
" ,'exam_score','exam_score-export','exam_report_subject','exam_report_subject-total','exam_report_subject-range','exam_report_subject-college',"
|
|
|
+ "'exam_report_subject-teacher','exam_report_subject-class'"
|
|
|
- + ",'exam_report_subject-objective_question','exam_report_subject-subjective_question','exam_report_subject-group'"
|
|
|
- + ",'exam_mark-group-help_video','exam_inspected_info-list-help_video')");
|
|
|
+ + ",'exam_report_subject-objective_question','exam_report_subject-subjective_question','exam_report_subject-group')");
|
|
|
sql.append(" and s.id=" + schoolId);
|
|
|
Query query = entityManager.createNativeQuery(sql.toString());
|
|
|
query.executeUpdate();
|
|
@@ -179,8 +178,8 @@ public class PrivilegeServiceImpl extends BaseQueryService<Privilege> implements
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
sql.append(" INSERT INTO b_role_privilege (`school_id`, `role_code`, `privilege_code`,`enable`)");
|
|
|
sql.append(" SELECT s.id,'" + role.name() + "',p.`code`,1 from b_privilege p join b_school s ");
|
|
|
- sql.append(" where p.`code` in('exam_inspected_info','exam_inspected_info-info','exam_inspected_info-list'"
|
|
|
- + ",'exam_inspected_info-list-help_video','exam_inspected_info-next_round')");
|
|
|
+ sql.append(
|
|
|
+ " where p.`code` in('exam_inspected_info','exam_inspected_info-info','exam_inspected_info-list','exam_inspected_info-next_round')");
|
|
|
sql.append(" and s.id=" + schoolId);
|
|
|
Query query = entityManager.createNativeQuery(sql.toString());
|
|
|
query.executeUpdate();
|