|
|
@@ -40,16 +40,8 @@
|
|
|
from sys_learning_materials
|
|
|
</sql>
|
|
|
|
|
|
- <sql id="pageRequest">
|
|
|
- <if test="request.knowledgeId != null">
|
|
|
- and m.knowledge_id = #{request.knowledgeId}
|
|
|
- </if>
|
|
|
- <if test="request.title != null ">
|
|
|
- and m.title = #{request.title}
|
|
|
- </if>
|
|
|
- </sql>
|
|
|
-
|
|
|
- <select id="selectSysLearningMaterialsList" parameterType="com.xunmei.common.core.domain.edu.domain.SysLearningMaterials"
|
|
|
+ <select id="selectSysLearningMaterialsList"
|
|
|
+ parameterType="com.xunmei.common.core.domain.edu.domain.SysLearningMaterials"
|
|
|
resultMap="SysLearningMaterialsResult">
|
|
|
<include refid="selectSysLearningMaterialsVo"/>
|
|
|
<where>
|
|
|
@@ -91,6 +83,14 @@
|
|
|
<include refid="selectSysLearningMaterialsVo"/>
|
|
|
where id = #{id}
|
|
|
</select>
|
|
|
+ <sql id="pageRequest">
|
|
|
+ <if test="request.knowledgeId != null">
|
|
|
+ and m.knowledge_id = #{request.knowledgeId}
|
|
|
+ </if>
|
|
|
+ <if test="request.title != null ">
|
|
|
+ and m.title = #{request.title}
|
|
|
+ </if>
|
|
|
+ </sql>
|
|
|
<select id="selectPageData" resultType="com.xunmei.common.core.domain.edu.vo.SysLearningMaterialsPageVo">
|
|
|
select m.id,
|
|
|
title,
|
|
|
@@ -108,31 +108,49 @@
|
|
|
where m.deleted = 0
|
|
|
and k.deleted = 0
|
|
|
<choose>
|
|
|
- <when test="request.checkSub==false">
|
|
|
+ <!-- 查询公开的,需要判断是否关联上级机构,类型与标题 -->
|
|
|
+ <when test="request.isOpen != null and request.isOpen ==1">
|
|
|
+ <include refid="pageRequest"/>
|
|
|
+ <if test="request.checkSub==false">
|
|
|
+ and m.org_id = #{request.orgId}
|
|
|
+ </if>
|
|
|
+ <if test="request.checkSub==true">
|
|
|
+ or ( m.org_id in
|
|
|
+ <foreach collection="request.orgIdList" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ and m.is_open = 1
|
|
|
+ <include refid="pageRequest"/>)
|
|
|
+ </if>
|
|
|
+ </when>
|
|
|
+ <!-- 查询未公开的,需要判断类型与标题 且查询当前机构自己创建的, -->
|
|
|
+ <when test="request.isOpen != null">
|
|
|
+ <include refid="pageRequest"/>
|
|
|
and m.org_id = #{request.orgId}
|
|
|
+ and m.create_by = #{request.userId}
|
|
|
+ and m.is_open = 0
|
|
|
</when>
|
|
|
+ <!-- 公开条件等于null时,需要判断类型与标题 且查询当前机构自己创建的, -->
|
|
|
<otherwise>
|
|
|
- and m.org_path like concat((select path from sys_org where id=#{request.orgId}), '%')
|
|
|
+ <include refid="pageRequest"/>
|
|
|
+ <if test="request.checkSub==false">
|
|
|
+ and m.org_id = #{request.orgId}
|
|
|
+ </if>
|
|
|
+ <if test="request.checkSub==true">
|
|
|
+ or ( m.org_id in
|
|
|
+ <foreach collection="request.orgIdList" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ and m.is_open = 1
|
|
|
+ <include refid="pageRequest"/>)
|
|
|
+ </if>
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
- <include refid="pageRequest"/>
|
|
|
- <if test="request.isOpen != null ">
|
|
|
- and m.is_open = #{request.isOpen}
|
|
|
- </if>
|
|
|
- <if test="request.orgIdList != null and request.orgIdList.size()>0">
|
|
|
- or (
|
|
|
- m.org_id in
|
|
|
- <foreach collection="request.orgIdList" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- and m.is_open = 1
|
|
|
- <include refid="pageRequest"/>
|
|
|
- )
|
|
|
- </if>
|
|
|
order by m.org_id, m.create_time desc
|
|
|
</select>
|
|
|
|
|
|
- <insert id="insertSysLearningMaterials" parameterType="com.xunmei.common.core.domain.edu.domain.SysLearningMaterials">
|
|
|
+ <insert id="insertSysLearningMaterials"
|
|
|
+ parameterType="com.xunmei.common.core.domain.edu.domain.SysLearningMaterials">
|
|
|
insert into sys_learning_materials
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<if test="id != null">id,
|
|
|
@@ -200,7 +218,8 @@
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
- <update id="updateSysLearningMaterials" parameterType="com.xunmei.common.core.domain.edu.domain.SysLearningMaterials">
|
|
|
+ <update id="updateSysLearningMaterials"
|
|
|
+ parameterType="com.xunmei.common.core.domain.edu.domain.SysLearningMaterials">
|
|
|
update sys_learning_materials
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
<if test="title != null">title =
|