123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <?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="cn.cslg.pas.mapper.TaskMapper">
- <select id="getPageList" parameterType="cn.cslg.pas.common.model.vo.TaskVO" resultType="cn.cslg.pas.domain.Task">
- select a.id, a.type, a.uid as create_by, a.ctime as start_time, a.tid as project_id,
- a.mfields as field_num, a.mun as total, a.endtime as end_time, a.status, a.filename as file_name,
- a.filesize as file_size, a.downexcel as url, c.name as project_name, a.old_name
- from os_task a
- left join os_thematic c on c.id = a.tid
- <where>
- <if test="params.status != null">
- and a.status = #{params.status}
- </if>
- <if test="params.type != null">
- and a.type = #{params.type}
- </if>
- <if test="params.projectId != null">
- and a.tid = #{params.projectId}
- </if>
- <if test="params.productId != null">
- and a.product_id = #{params.productId}
- </if>
- <if test="params.projectName != '' and params.projectName != null">
- and c.name like concat('%', #{params.projectName}, '%')
- </if>
- <if test="params.createPersonIds != null and params.createPersonIds.size > 0">
- and a.uid in
- <foreach collection="params.createPersonIds" item="n" separator="," open="(" close=")">
- #{n}
- </foreach>
- </if>
- </where>
- order by a.ctime ${params.order}
- </select>
- <!--根据条件查询任务列表-->
- <!--List<QueryTaskVO> queryTasks(QueryTaskDTO queryTaskDTO);-->
- <select id="queryTasks" resultMap="queryTasksMap">
- select tas.id tas_id, tas.type tas_type, tas.uid tas_uid, tas.ctime tas_ctime, tas.tid tas_tid,
- tas.report_id tas_report_id, tas.product_id tas_product_id, tas.mfields tas_mfields, tas.mun tas_mun, tas.onmun
- tas_onmun, tas.endtime
- tas_endtime,
- tas.status tas_status, tas.filename tas_filename, tas.filesize tas_filesize, tas.loadtime tas_loadtime, tas.main
- tas_main,
- tas.islook tas_islook, tas.downexcel tas_downexcel, tas.old_name tas_old_name, tas.product_id tas_product_id,
- tas.success_num tas_success_num,
- tas.true_success_num tas_true_success_num, tas.default_num tas_default_num, tas.pram_json tas_pram_json,
- tas.task_condition_id tas_task_condition_id, tas.create_time tas_create_time,
- tas.task_type tas_task_type, tas.downexcel tas_downexcel, tas.system_file_id tas_system_file_id,
- con.id, con.task_id, con.task_type, con.task_type2, con.conditions,
- con.crons, con.config_cells, con.config_id, con.task_name, con.total,
- con.orderby, con.orderby_type, con.db_type, con.start_number, con.end_number,
- con.isadd_patentnos, con.isdelete_patentnos, con.isadd_type
- from os_task tas
- left join os_task tas2 on tas.task_condition_id = tas2.task_condition_id and tas.ctime < tas2.ctime
- left join task_condition con on tas.task_condition_id = con.id
- <where>
- <if test="projectId != null and projectId != 0">
- and tas.tid = #{projectId}
- </if>
- <if test="reportId != null and reportId != 0">
- and tas.report_id = #{reportId}
- </if>
- <if test="productId != null and productId != 0">
- and tas.product_id = #{productId}
- </if>
- <if test="projectId == 0 and reportId == null and productId == null">
- and tas.tid != 0
- </if>
- <if test="reportId == 0 and projectId == null and productId == null">
- and tas.report_id is not null
- </if>
- <if test="productId == 0 and projectId == null and reportId == null">
- and tas.product_id is not null
- </if>
- <if test="projectId == null and reportId == null">
- and tas.uid = #{createId}
- </if>
- <if test="personIds != null and personIds.size > 0">
- and tas.uid in
- <foreach collection="personIds" item="n" separator="," open="(" close=")">
- #{n}
- </foreach>
- </if>
- <if test="taskType != null">
- and tas.task_type = #{taskType}
- </if>
- <if test="taskType2 != null">
- and tas.type = #{taskType2}
- </if>
- <if test="taskStatus != null and taskStatus.size > 0">
- and tas.status in
- <foreach collection="taskStatus" item="n" separator="," open="(" close=")">
- #{n}
- </foreach>
- </if>
- <if test="true">
- and tas2.id is null
- </if>
- </where>
- order by
- <choose>
- <when test="orderBy != null">
- tas.${orderBy} ${orderType}
- </when>
- <otherwise>
- tas.id
- </otherwise>
- </choose>
- </select>
- <resultMap id="queryTasksMap" type="cn.cslg.pas.common.model.vo.QueryTaskVO">
- <id column="tas_id" property="id"/>
- <result column="tas_type" property="type"/>
- <result column="tas_uid" property="createBy"/>
- <result column="tas_ctime" property="startTime"/>
- <result column="tas_tid" property="projectId"/>
- <result column="tas_report_id" property="reportId"/>
- <result column="tas_product_id" property="productId"/>
- <result column="tas_mun" property="total"/>
- <result column="tas_endtime" property="endTime"/>
- <result column="tas_status" property="status"/>
- <result column="tas_filename" property="fileName"/>
- <result column="tas_filesize" property="fileSize"/>
- <result column="tas_success_num" property="successNum"/>
- <result column="tas_true_success_num" property="trueSuccessNum"/>
- <result column="tas_default_num" property="defaultNum"/>
- <result column="tas_old_name" property="oldName"/>
- <result column="tas_create_time" property="createTime"/>
- <result column="tas_task_condition_id" property="taskConditionId"/>
- <result column="tas_old_name" property="taskName"/>
- <result column="tas_task_type" property="taskType"/>
- <result column="tas_endtime" property="modifiedTime"/>
- <result column="tas_downexcel" property="url"/>
- <result column="tas_system_file_id" property="fileId"/>
- <result column="conditions" property="conditions"/>
- <result column="crons" property="crons"/>
- <result column="config_cells" property="configCells"/>
- <result column="orderby" property="orderBy"/>
- <result column="orderby_type" property="orderByType"/>
- <result column="db_type" property="DBType"/>
- <result column="start_number" property="startNumber"/>
- <result column="end_number" property="endNumber"/>
- <result column="isadd_patentnos" property="isAddPatentNos"/>
- <result column="isdelete_patentnos" property="isDeletePatentNos"/>
- <result column="isadd_type" property="isAddType"/>
- </resultMap>
- <select id="queryTask" resultMap="queryTasksMap">
- select tas.*
- from os_task tas
- left join task_condition ass on tas.task_condition_id = ass.id
- <where>
- (tas.task_condition_id is null
- or tas.id in (
- select a1
- .id from os_task a1 left join os_task a2 on a1.task_condition_id =a2.task_condition_id and
- a1.create_time <= a2.create_time group by a1.task_condition_id having count(*)=1)
- )
- </where>
- </select>
- </mapper>
|