实训案例列表

beetlsql3-dev
maLix
parent eaf5c097cd
commit 7c6933414d

@ -1,7 +1,9 @@
package cn.jlw.util;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.ibeetl.admin.core.entity.CoreOrg;
import com.ibeetl.admin.core.entity.CoreUser;
import com.ibeetl.admin.core.service.CorePlatformService;
import com.ibeetl.admin.core.util.HttpRequestLocal;
import com.ibeetl.admin.core.util.PlatformException;
@ -9,6 +11,8 @@ import com.ibeetl.jlw.entity.Student;
import com.ibeetl.jlw.entity.Teacher;
import com.ibeetl.jlw.entity.UniversitiesColleges;
import java.util.List;
import static com.ibeetl.admin.core.service.CorePlatformService.*;
/**
@ -61,4 +65,22 @@ public final class CacheUserUtil {
throw new PlatformException("会话过期,重新登录");
}
}
/**
*
* @param list
* @param user
*/
public static void checkUserEditPermission(List list, CoreUser user) {
if (!user.isAdmin()) {
Long orgId = user.getOrgId();
// 是否是同一个学校的
boolean isSame = list.stream().allMatch(item -> orgId.equals(ReflectUtil.getFieldValue(item, "orgId")));
// 如果有其他机构ID的数据则抛出异常无法修改其他机构的数据
if (!isSame) {
throw new PlatformException("只能修改本院校的数据");
}
}
}
}

@ -28,4 +28,10 @@ public interface HandsOnDao extends BaseMapper<HandsOn>{
List<HandsOn> getValuesByQueryNotPermission(HandsOnQuery handsOnQuery);
/**
*
* @param handsOnQuery
* @return
*/
PageQuery<HandsOn> queryByConditionMergeOpenCourseHandsOn(PageQuery handsOnQuery);
}

@ -29,6 +29,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static cn.jlw.util.CacheUserUtil.checkUserEditPermission;
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
/**
* HandsOn Service
* ID使insert(*,true)
@ -46,6 +49,11 @@ public class HandsOnService extends CoreBaseService<HandsOn>{
queryListAfter(ret.getList());
return ret;
}
public PageQuery queryByConditionMergeOpenCourseHandsOn(PageQuery query) {
PageQuery ret = handsOnDao.queryByConditionMergeOpenCourseHandsOn(query);
queryListAfter(ret.getList());
return ret;
}
public PageQuery<HandsOn>queryByConditionQuery(PageQuery query){
PageQuery ret = handsOnDao.queryByConditionQuery(query);
@ -112,6 +120,13 @@ public class HandsOnService extends CoreBaseService<HandsOn>{
String msg = "";
String handsOnIdPlural = handsOnQuery.getHandsOnIdPlural();
if (StrUtil.isNotBlank(handsOnIdPlural)) {
HandsOnQuery query = new HandsOnQuery();
query.setHandsOnIdPlural(handsOnIdPlural);
List<HandsOn> findList = this.getValuesByQueryNotPermission(query);
checkUserEditPermission(findList, getUser());
for (String handsOnId : handsOnIdPlural.split(",")) {
HandsOn pojo = handsOnQuery.pojo();
pojo.setHandsOnId(Long.valueOf(handsOnId));

@ -165,7 +165,8 @@ public class HandsOnController{
universitiesCollegesJurisdictionCurriculumResourcesService.getResourcesCourseInfoAuthDetails(coreUser.getOrgId());
Serializable ifNullCourseInfoIds = defaultIfNull(courseInfoIds, listJoin(resourcesCourseInfoAuthDetails.getTheoryCourseList(), CourseInfo::getCourseInfoId));
String ids = Arrays.stream(ifNullCourseInfoIds.toString().split(",")).map(item -> "_" + item + "_").collect(Collectors.joining("|"));
String ids = Arrays.stream(ifNullCourseInfoIds.toString().split(",")).filter(item -> !item.equals(""))
.map(item -> "_" + item + "_").collect(Collectors.joining("|"));
// 如果为空字符串,那么代表这个学校,还没有授权的课程,所以是不会显示任何东西的。
condition.setCourseInfoFullIdStr(StrUtil.blankToDefault(ids, "未授权应用"));
@ -175,7 +176,7 @@ public class HandsOnController{
condition.setHandsOnStatus(2);
}
PageQuery page = condition.getPageQuery();
handsOnService.queryByCondition(page);
handsOnService.queryByConditionMergeOpenCourseHandsOn(page);
return JsonResult.success(page);
}

@ -45,6 +45,7 @@ public class HandsOnQuery extends PageParam {
private String orgIdPlural;
private String CourseInfoFullIdStr;
private String handsOnFrom;
public Long getCourseInfoId_0() {
return courseInfoId_0;
@ -201,4 +202,12 @@ public class HandsOnQuery extends PageParam {
public void setCourseInfoFullIdStr(String courseInfoFullIdStr) {
CourseInfoFullIdStr = courseInfoFullIdStr;
}
public String getHandsOnFrom() {
return handsOnFrom;
}
public void setHandsOnFrom(String handsOnFrom) {
this.handsOnFrom = handsOnFrom;
}
}

@ -55,37 +55,105 @@ queryByCondition
queryByConditionMergeOpenCourseHandsOn
===
* 查询开课实训和系统级别的实训
* 查询开课实训和系统级别的实训案例
select
t.`hands_on_id`,
t.`course_info_id`,
t.`course_child_node`,
t.`hands_on_name`,
t.`add_time`,
t.`org_id`,
t.`user_id`,
a.course_info_id,
a.course_info_full_id,
'ADMIN_ADD' as data_type
from hands_on t
LEFT JOIN course_info a on t.course_info_id = a.course_info_id
union all
select
SELECT
@pageTag(){
t.teacher_open_course_id,
IFNULL(zb.teacher_open_course_title, '系统内置课程') as teacher_open_course_title,
t.`hands_on_id`,
t.`course_info_id`,
t.`course_child_node`,
(select course_info_name from course_info zc where zc.course_info_id = t.course_child_node and zc.course_info_status = 1 limit 1) as system_course_child_node_text,
t.`hands_on_name`,
t.`add_time`,
t.`org_id`,
za.`name` AS org_id_text ,
t.`user_id`,
a.course_info_id,
t.course_info_id as system_course_info_id,
(select course_info_name from course_info zc where zc.course_info_id = t.course_info_id and zc.course_info_status = 1 limit 1) as system_course_info_id_text,
t.course_info_full_id,
t.data_type
@}
FROM
(
SELECT
IFNULL(c.teacher_open_course_id, '-1') as teacher_open_course_id,
c.`hands_on_id`,
c.course_info_id,
c.`course_child_node`,
c.`hands_on_name`,
c.`add_time`,
c.`org_id`,
c.`user_id`,
a.course_info_id as system_course_info_id,
a.course_info_full_id,
'FACULTY_ADD' as data_type
from teacher_open_course_hands_on t
LEFT JOIN course_info a on t.course_info_id = a.course_info_id
LEFT JOIN teacher_open_course_merge_course_info b on b.system_course_info_id = a.course_info_id
'ADMIN_ADD' AS data_type
FROM
hands_on c
LEFT JOIN course_info a ON c.course_child_node = a.course_info_id UNION ALL
SELECT
c.teacher_open_course_id,
c.`hands_on_id`,
c.course_info_id,
c.`course_child_node`,
c.`hands_on_name`,
c.`add_time`,
c.`org_id`,
c.`user_id`,
a.course_info_id as system_course_info_id,
a.course_info_full_id,-- 判断关联课程是系统内置,还是院校添加的
CASE WHEN a.course_info_id IS NOT NULL THEN
'ADMIN_ADD' ELSE 'FACULTY_ADD'
END AS data_type
FROM
teacher_open_course_hands_on c
LEFT JOIN course_info a ON c.course_child_node = a.course_info_id
LEFT JOIN teacher_open_course_merge_course_info b ON b.source_from_id = a.course_info_id
) t
LEFT JOIN core_org za ON za.id = t.org_id
LEFT JOIN teacher_open_course zb ON zb.teacher_open_course_id = t.teacher_open_course_id
WHERE 1 = 1
@if(!isEmpty(handsOnId)){
and t.hands_on_id =#handsOnId#
@}
@if(!isEmpty(teacherOpenCourseId)){
and t.teacher_open_course_id =#teacherOpenCourseId#
@}
@if(!isEmpty(courseInfoId)){
and t.course_info_id =#courseInfoId#
@}
@if(!isEmpty(courseChildNode)){
and t.course_child_node =#courseChildNode#
@}
@if(!isEmpty(handsOnName)){
and t.hands_on_name like #'%' + handsOnName + '%'#
@}
@if(!isEmpty(handsOnRecommend)){
and t.hands_on_recommend =#handsOnRecommend#
@}
@if(!isEmpty(handsOnStatus)){
and t.hands_on_status =#handsOnStatus#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(courseInfoIds)){
and find_in_set(t.course_info_id,#courseInfoIds#)
@}
@if(!isEmpty(courseInfoId_0)){
and t.course_info_id =#courseInfoId_0#
@}
@if(!isEmpty(orgIdPlural)){
and find_in_set(t.org_id,#orgIdPlural#)
@}
@if(!isEmpty(handsOnFrom)){
and t.data_type = #handsOnFrom#
@}
@if(!isEmpty(courseInfoFullIdStr)){
and t.course_info_full_id regexp #courseInfoFullIdStr#
@// 未授权任何应用的话,这里直接返回空数据
@}

@ -47,16 +47,27 @@ layui.define(['form', 'laydate', 'table'], function (exports) {
hideField: false,
hide: $.isEmpty(sx_['handsOnName']) ? false : sx_['handsOnName'],
}, {
field: 'courseInfoIdText',
field: 'systemCourseInfoIdText',
title: '归属课程', align: "center"
},
{
field: 'courseChildNodeText',
field: 'systemCourseChildNodeText',
title: '归属章节', align: "center"
},
{
field: 'orgIdText',
title: '归属院校', align: "center"
}, {
field: 'addTime',
title: '导入时间',
align: "center",
}, {
field: 'dataType',
title: '案例来源',
align: "center",
templet: function (d) {
return d.dataType == 'FACULTY_ADD' ? '院校添加' : (d.dataType == 'ADMIN_ADD' ? '系统内置': '')
}
}, {
field: 'handsOnStatus', width: 80,
title: '状态', align: "center", templet: function (d) {

@ -55,16 +55,16 @@
id="handsOnStatu" name="handsOnStatus"/>
</div>
</div>
<!-- <div class="layui-inline">-->
<!-- <label class="layui-form-label">案例来源:</label>-->
<!-- <div class="layui-input-block">-->
<!-- <select name="handsOnFrom" lay-filter="selectHandsOnFrom">-->
<!-- <option value="">请选择</option>-->
<!-- <option value="ADMIN_ADD">系统内置</option>-->
<!-- <option value="FACULTY_ADD">院校添加</option>-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<div class="layui-inline">
<label class="layui-form-label">案例来源:</label>
<div class="layui-input-block">
<select name="handsOnFrom" lay-filter="selectHandsOnFrom">
<option value="">请选择</option>
<option value="ADMIN_ADD">系统内置</option>
<option value="FACULTY_ADD">院校添加</option>
</select>
</div>
</div>
</layui:searchForm>
<div class="layui-btn-group">
<!--#if(user.get().isAdmin){ -->

Loading…
Cancel
Save