| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <?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.MajorMapper">
- <resultMap type="com.zhongzheng.modules.course.domain.Major" id="MajorResult">
- <result property="id" column="id"/>
- <result property="remark" column="remark"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="categoryName" column="category_name"/>
- <result property="majorReferral" column="major_referral"/>
- <result property="labelId" column="label_id"/>
- <result property="status" column="status"/>
- <result property="encoder" column="encoder"/>
- <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>
- <select id="selectProject" parameterType="com.zhongzheng.modules.course.bo.CourseProjectTypeQueryBo" resultMap="CourseProjectTypeVoResult">
- SELECT
- p.*,
- e.education_name
- FROM
- major_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.major_id = #{id}
- </if>
- order by j.update_time desc
- </select>
- <select id="queryList" parameterType="com.zhongzheng.modules.course.bo.MajorQueryBo" resultMap="MajorResult">
- SELECT
- m.*
- FROM
- major m
- LEFT JOIN major_project p ON p.major_id = m.id
- LEFT JOIN course_business b on b.project_id =p.project_id
- LEFT JOIN course_project_type t on p.project_id=t.id
- LEFT JOIN course_education_type e on t.education_id = e.id
- WHERE
- 1 =1
- <if test="status != null and status.size()!=0 ">
- AND m.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="id != null and id!=0 ">
- AND m.id = #{id}
- </if>
- <if test="educationId != null and educationId!=0 ">
- AND e.id = #{educationId}
- </if>
- <if test="projectId != null and projectId!=0 ">
- AND t.id = #{projectId}
- </if>
- <if test="categoryName != null and categoryName!='' ">
- AND m.category_name like concat('%', #{categoryName}, '%')
- </if>
- <if test="businessId != null and businessId!=0 ">
- AND b.id = #{businessId}
- </if>
- group by m.id
- order by m.sort
- </select>
- <select id="countNum" parameterType="com.zhongzheng.modules.course.bo.MajorQueryBo" resultType="Integer">
- SELECT
- count(*)
- FROM
- major m
- LEFT JOIN major_project mp ON m.id = mp.major_id
- WHERE
- m.`status` != -1 and
- m.category_name = #{categoryName}
- <if test="majorProjects != null and majorProjects.length!=0 ">
- AND mp.project_id in
- <foreach collection="majorProjects" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="id != null and id!='' ">
- and m.id != #{id}
- </if>
- </select>
- <select id="getMajorByTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.Major">
- SELECT * FROM major where encoder = #{encoder} and tenant_id = #{newTenantId}
- </select>
- <select id="getMajorByIdNoTenant" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.course.domain.Major">
- SELECT * FROM major where id = #{majorId}
- </select>
- <select id="getOnebyName" resultType="com.zhongzheng.modules.course.domain.Major">
- SELECT
- cs.*
- FROM
- major cs
- LEFT JOIN major_project csp ON cs.id = csp.major_id
- WHERE
- csp.project_id = #{projectId}
- AND cs.category_name = #{name}
- AND cs.`status` = 1
- LIMIT 1
- </select>
- </mapper>
|