TTrainExaminationManage.xml 6.76 KB
Newer Older
Rensq's avatar
Rensq 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
<?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.testor.module.train.examinationManage.dao.TTrainExaminationManageDao">
    <!-- 开启二级缓存 -->
    <!-- <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/> -->
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.testor.module.train.examinationManage.model.domain.TTrainExaminationManage">
        <id column="id" property="id"/>
        <id column="is_repair" property="isRepair"/>
        <id column="parent_id" property="parentId"/>
        <id column="exam_name" property="examName"/>
        <id column="exam_way" property="examWay"/>
        <id column="exam_type" property="examType"/>
        <id column="exam_start_time" property="examStartTime"/>
        <id column="exam_end_time" property="examEndTime"/>
        <id column="paper_id" property="paperId"/>
        <id column="exam_duration" property="examDuration"/>
        <id column="exam_site" property="examSite"/>
        <id column="should_test_number" property="shouldTestNumber"/>
        <id column="finish_number" property="finishNumber"/>
        <id column="percentage" property="percentage"/>
        <id column="org_name" property="orgName"/>
        <id column="org_id" property="orgId"/>
        <id column="tenant_id" property="tenantId"/>
        <id column="process_id" property="processId"/>
        <id column="process_status" property="processStatus"/>
    </resultMap>

    <select id="getExamAffiliation" parameterType="com.testor.module.train.examinationManage.model.dto.TTrainExaminationManageParam"
            resultType="com.testor.module.train.examinationManage.model.dto.TTrainExaminationManageParam"
            databaseId="mysql">
        select *
        from (select p.exam_name
        , p.id
        , p.exam_way
        , p.exam_type
        , p.should_test_number
        , p.finish_number
--         , my.percentage
        , p.exam_start_time
        , p.exam_end_time
        , p.org_name
        , p.org_id
        , p.qr_code
        , p.create_date
--         , my.person_affiliation
--         , my.company
--         , my.exam_duration
        from t_train_examination_manage p
        left join t_train_my_management my
        on p.id = my.task_id
        where p.status = 0
        <if test="param.examName!=null and param.examName!=''">
            AND p.exam_name LIKE CONCAT('%',#{param.examName},'%')
        </if>
        <if test="param.isRepair!=null and param.isRepair!=''">
            AND p.is_repair = #{param.isRepair}
        </if>
        <if test="param.personAffiliation!=null and param.personAffiliation!=''">
            AND my.person_affiliation =#{param.personAffiliation}
        </if>
        <if test="param.company!=null and param.company!=''">
            AND find_in_set(my.org_id,#{param.company})
        </if>
        <if test="param.StartTime!=null and param.StartTime!=''">
            AND p.exam_start_time =#{param.StartTime}
        </if>
        <if test="param.EndTime!=null and param.EndTime!=''">
            AND p.exam_end_time=#{param.EndTime}
        </if>
            order by p.create_date desc
        ) mm
        where mm.org_id in (select org.org_id
        from t_sys_org org
        where find_in_set(org.org_id, #{parentIds})
        or org.parent_ids like concat('%', #{orgId}, '%')
        or org.org_id = #{orgId}) group by id  order by mm.create_date
    </select>
    <select id="getExamAffiliation" parameterType="com.testor.module.train.examinationManage.model.dto.TTrainExaminationManageParam"
            resultType="com.testor.module.train.examinationManage.model.dto.TTrainExaminationManageParam"
            databaseId="kingbase">
        select p1.exam_name
        , p1.id
        , p1.exam_way
        , p1.exam_type
        , p1.should_test_number
        , p1.finish_number
        , p1.exam_start_time
        , p1.exam_end_time
        , p1.org_name
        , p1.org_id
        , p1.qr_code
        , p1.create_date
        from t_train_examination_manage p1
        where id in (
        select id
        from (select p.exam_name
        , p.id
        , p.exam_way
        , p.exam_type
        , p.should_test_number
        , p.finish_number
        , p.exam_start_time
        , p.exam_end_time
        , p.org_name
        , p.org_id
        , p.qr_code
        , p.create_date
        from t_train_examination_manage p
        left join t_train_my_management my
        on p.id = my.task_id
        where p.status = 0
        <if test="param.examName!=null and param.examName!=''">
            AND p.exam_name LIKE CONCAT('%',#{param.examName},'%')
        </if>
        <if test="param.isRepair!=null and param.isRepair!=''">
            AND p.is_repair = #{param.isRepair}
        </if>
        <if test="param.personAffiliation!=null and param.personAffiliation!=''">
            AND my.person_affiliation =#{param.personAffiliation}
        </if>
        <if test="param.company!=null and param.company!=''">
            AND find_in_set(my.org_id,#{param.company})
        </if>
        <if test="param.StartTime!=null and param.StartTime!=''">
            AND p.exam_start_time =#{param.StartTime}
        </if>
        <if test="param.EndTime!=null and param.EndTime!=''">
            AND p.exam_end_time=#{param.EndTime}
        </if>
        order by p.create_date desc
        ) mm
        where mm.org_id in (select org.org_id
        from t_sys_org org
        where find_in_set(org.org_id, #{parentIds})
        or org.parent_ids like concat('%', #{orgId}, '%')
        or org.org_id = #{orgId}) group by id)  order by p1.create_date
    </select>

    <select id="getExamProjectPerson" resultType="com.testor.module.train.examinationManage.model.dto.TTrainExaminationManageParam">
        select
            p.exam_name
             , p.id
             , p.exam_way
             , p.exam_type
             , p.should_test_number
             , p.finish_number
            , my.percentage
             , p.exam_start_time
             , p.exam_end_time
             , p.org_name
             , p.org_id
             , p.qr_code
             , p.create_date
            , my.person_affiliation
            , my.company
            , my.exam_duration

        from (select
                exam_name
                   , id
                   , exam_way
                   , exam_type
                   , should_test_number
                   , finish_number
                    ,exam_start_time
                    , exam_end_time
                   , org_name
                   , org_id
                   , qr_code
                   , create_date
        from  t_train_examination_manage where id = #{id} ) p
                 join t_train_my_management my on p.id = my.task_id
    </select>
</mapper>