Blame view

ProjectScheduleRecordDAO.xml 2.48 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
<?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.zhongzhi.dao.ProjectScheduleRecordDAO">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zhongzhi.model.ProjectScheduleRecordDO">
        <id column="id" property="id"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="delete_time" property="deleteTime"/>
        <result column="proposer_id" property="proposerId"/>
        <result column="project_id" property="projectId"/>
        <result column="match_id" property="matchId"/>
        <result column="college" property="college"/>
        <result column="project_type" property="projectType"/>
        <result column="project_schedule" property="projectSchedule"/>
        <result column="project_status" property="projectStatus"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_time,
        update_time,
        delete_time,
        id, proposer_id, project_id, match_id, project_type, project_schedule, college, project_status
    </sql>

    <select id="getProjectScheduleRecord" resultType="com.zhongzhi.vo.scheduleRecord.ProjectScheduleRecordVO">
        select
        p.id,
        s.college as collegeName
        from project p
        left join student s on s.id = p.proposer_id
        <where>
            <if test="name != null and name != ''">
                and p.project_name like concat('%', #{name}, '%')
            </if>
            and p.match_id = #{matchId}
            and p.delete_time is null
            and s.delete_time is null
        </where>
        group by s.college
    </select>

    <select id="getList" resultType="com.zhongzhi.model.ProjectScheduleRecordDO">
        select
        ps.*
        from project_schedule_record ps
        left join project p on p.id = ps.project_id
        <where>
            <if test="matchId != null and matchId != ''">
                and ps.match_id = #{matchId}
            </if>
            <if test="college != null and college != ''">
                and ps.college = #{college}
            </if>
            <if test="projectGroup != null and projectGroup != ''">
                and p.project_group = #{projectGroup}
            </if>
            and ps.delete_time is null
            and p.delete_time is null
        </where>
    </select>

</mapper>