123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.zhongzheng.modules.course.mapper.CourseSubjectMapper">
- <resultMap type="com.zhongzheng.modules.course.domain.CourseSubject" id="CourseSubjectResult">
- <result property="id" column="id"/>
- <result property="encoder" column="encoder"/>
- <result property="remark" column="remark"/>
- <result property="status" column="status"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="subjectName" column="subject_name"/>
- <result property="sort" column="sort"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.course.vo.CourseProjectTypeVo" id="CourseProjectTypeVoResult">
- <result property="id" column="id"/>
- <result property="projectName" column="project_name"/>
- <result property="encoder" column="encoder"/>
- <result property="remark" column="remark"/>
- <result property="educationId" column="education_id"/>
- <result property="educationName" column="education_name"/>
- <result property="status" column="status"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.course.vo.CourseSubjectVo" id="CourseSubjectVoResult">
- <result property="id" column="id"/>
- <result property="encoder" column="encoder"/>
- <result property="remark" column="remark"/>
- <result property="status" column="status"/>
- <result property="subjectName" column="subject_name"/>
- <result property="sort" column="sort"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.course.vo.CourseProjectTypeVo" id="CourseProjectTypeVoTwoResult">
- <result property="id" column="pid"/>
- <result property="projectName" column="pproject_name"/>
- <result property="encoder" column="pencoder"/>
- <result property="remark" column="premark"/>
- <result property="educationId" column="peducation_id"/>
- <result property="educationName" column="peducation_name"/>
- <result property="status" column="pstatus"/>
- </resultMap>
- <select id="selectProject" parameterType="com.zhongzheng.modules.course.bo.CourseProjectTypeQueryBo" resultMap="CourseProjectTypeVoResult">
- SELECT
- p.*,
- e.education_name
- FROM
- course_subject_project j
- LEFT JOIN course_project_type p on p.id=j.project_id
- LEFT JOIN course_education_type e ON p.education_id = e.id
- where 1=1
- <if test="status != null and status.size()!=0 ">
- AND p.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="id != null and id!=0 ">
- AND j.subject_id = #{id}
- </if>
- </select>
- <select id="queryList" parameterType="com.zhongzheng.modules.course.bo.CourseSubjectQueryBo" resultMap="CourseSubjectVoResult">
- SELECT
- s.*
- FROM
- course_subject s
- WHERE
- 1 =1
- <if test="status != null and status.size()!=0 ">
- AND s.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="educationId != null and educationId!=0 ">
- and (SELECT COUNT(p.id) FROM course_subject_project t LEFT JOIN course_project_type p on t.project_id = p.id where p.education_id = #{educationId} AND t.subject_id = s.id ) > 0
- </if>
- <if test="projectId != null and projectId!=0 ">
- and (SELECT COUNT(t.id) FROM course_subject_project t where t.project_id = #{projectId} AND t.subject_id = s.id) > 0
- </if>
- <if test="businessId != null and businessId!=0 ">
- and (SELECT COUNT(t.id) FROM course_subject_project t LEFT JOIN course_business cb on cb.project_id = t.project_id where cb.id = #{businessId} AND t.subject_id = s.id) > 0
- </if>
- <if test="subjectName != null and subjectName!='' ">
- AND s.subject_name like concat('%', #{subjectName}, '%')
- </if>
- <if test="wrong != null and wrong!=0 ">
- and (select COUNT(v.id) FROM course_subject_project v where s.id=v.subject_id) = 0
- </if>
- <if test="id != null and id!='' ">
- and s.id = #{id}
- </if>
- order by s.sort
- </select>
- <select id="queryProject" parameterType="map" resultMap="CourseProjectTypeVoResult">
- SELECT
- p.*,
- (SELECT e.education_name FROM course_education_type e where p.education_id = e.id) as education_name,
- (SELECT e.id FROM course_education_type e where p.education_id = e.id) as education_id
- FROM
- course_project_type p
- LEFT JOIN course_subject_project j ON p.id = j.project_id
- WHERE
- j.subject_id=#{id}
- </select>
- <select id="countNum" parameterType="com.zhongzheng.modules.course.bo.CourseSubjectQueryBo" resultType="Integer">
- SELECT
- count(*)
- FROM
- course_subject cs
- LEFT JOIN course_subject_project csp ON cs.id = csp.subject_id
- WHERE
- cs.`status` != -1 and
- cs.subject_name = #{subjectName}
- <if test="courseSubjectProjects != null and courseSubjectProjects.length!=0 ">
- AND csp.project_id in
- <foreach collection="courseSubjectProjects" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="id != null and id!='' ">
- and cs.id != #{id}
- </if>
- </select>
- <select id="getSubjectByTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.CourseSubject">
- select * from course_subject where encoder = #{encoder} and tenant_id = #{newTenantId}
- </select>
- <select id="getIdsByTenant" parameterType="java.lang.String" resultType="java.lang.Long">
- select id from course_subject cs where cs.`status` = 1
- AND (SELECT COUNT(*) FROM sys_old_org sog WHERE sog.tenant_id = cs.tenant_id AND sog.share_class = 1) > 0
- <if test="subNames != null and subNames.size()!=0 ">
- AND cs.subject_name in
- <foreach collection="subNames" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="listByIdsTenant" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeListBo" resultType="com.zhongzheng.modules.course.domain.CourseSubject">
- select * from course_subject where `status` = 1
- <if test="subIds != null and subIds.size()!=0 ">
- AND id in
- <foreach collection="subIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="getListByIDs" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.course.domain.CourseSubject">
- select * from course_subject where `status` = 1
- <if test="ids != null and ids.size()!=0 ">
- AND id in
- <foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- </select>
- </mapper>
|