| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196 |
- <?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.platform.dao.mapper.check.CheckJobMapper">
- <!-- 首先定义 resultMap -->
- <resultMap id="CheckJobVOMap" type="com.platform.dao.vo.query.check.CheckJobVO">
- <id column="id" property="id"/>
- <!-- 基础字段映射 -->
- <result column="name" property="name"/>
- <result column="type" property="type"/>
- <result column="hours" property="hours"/>
- <result column="miles" property="miles"/>
- <result column="plan_id" property="planId"/>
- <result column="sb_id" property="sbId"/>
- <result column="part_id" property="partId"/>
- <result column="standard_id" property="standardId"/>
- <result column="start_time" property="startTime"/>
- <result column="end_time" property="endTime"/>
- <result column="actual_start_time" property="actualStartTime"/>
- <result column="actual_end_time" property="actualEndTime"/>
- <result column="requirement" property="requirement"/>
- <result column="remark" property="remark"/>
- <result column="feedback" property="feedback"/>
- <result column="status" property="status"/>
- <result column="sb_status" property="sbStatus"/>
- <result column="check_user_id" property="checkUserId"/>
- <result column="check_dept_id" property="checkDeptId"/>
- <result column="created_user_id" property="createdUserId"/>
- <result column="update_user_id" property="updateUserId"/>
- <result column="created_user_name" property="createdUserName"/>
- <result column="update_user_name" property="updateUserName"/>
- <result column="created_time" property="createdTime"/>
- <result column="update_time" property="updateTime"/>
- <result column="standard_hours" property="standardHours"/>
- <result column="real_hours" property="realHours"/>
- <result column="actual_user" property="actualUser"/>
- <result column="receive_overtime" property="receiveOvertime"/>
- <result column="con_task" property="conTask"/>
- <!-- 关联字段映射 -->
- <result column="checkUserName" property="checkUserName"/>
- <result column="sbName" property="sbName"/>
- <result column="sbNo" property="sbNo"/>
- <result column="sbLevel" property="sbLevel"/>
- <result column="partName" property="partName"/>
- <result column="standardNo" property="standardNo"/>
- <result column="standardName" property="standardName"/>
- <result column="standardLevel" property="standardLevel"/>
- <result column="period" property="period"/>
- <result column="periodType" property="periodType"/>
- <result column="positionId" property="positionId"/>
- <result column="positionName" property="positionName"/>
- <result column="checkDeptName" property="checkDeptName"/>
- <collection property="requirementList" ofType="com.platform.dao.entity.check.CheckRequirement">
- <id column="requirement_id" property="id" />
- <result column="std_name" property="stdName" />
- <result column="scope" property="scope" />
- <result column="requirement_type" property="type" />
- <result column="requirement_remark" property="remark" />
- <result column="requirement_created_user_name" property="createdUserName" />
- <result column="requirement_created_time" property="createdTime" />
- <result column="requirement_update_user_name" property="updateUserName" />
- <result column="requirement_update_time" property="updateTime" />
- <result column="requirement_status" property="status" />
- <result column="requirement_method" property="method" />
- <result column="requirement_sb_type" property="sbType" />
- <result column="requirement_check_level" property="checkLevel" />
- <result column="requirement_manage_item" property="manageItem" />
- <result column="requirement_check_item" property="checkItem" />
- <result column="requirement_content" property="content" />
- <result column="requirement_period" property="period" />
- <result column="requirement_sb_type_name" property="sbTypeName" />
- </collection>
- </resultMap>
- <sql id="Base_Column_List">
- checkjob.id,
- checkjob.plan_id,
- checkstandard.standard_hours,
- checkstandard.real_hours,
- checkjob.start_time,
- checkjob.end_time,
- checkjob.actual_user,
- checkjob.type,
- checkjob.actual_start_time,
- checkjob.actual_end_time,
- checkjob.status,
- checkjob.sb_status,
- checkjob.receive_overtime,
- checkjob.check_user_id,
- checkjob.check_dept_id,
- checkjob.created_user_id,
- checkjob.update_user_id,
- checkjob.created_user_name,
- checkjob.update_user_name,checkjob.remark,
- checkjob.created_time,
- checkjob.update_time
- </sql>
- <sql id="Ref_Column_List">
- checkjob.plan_id,
- checkjob.actual_user,
- checkstandard.standard_hours,
- checkstandard.real_hours,
- checkjob.start_time,
- checkjob.type,
- checkjob.check_user_id,
- checkjob.check_dept_id,
- checkjob.end_time,
- checkjob.actual_start_time,
- checkjob.actual_end_time,
- checkjob.checked_num,
- checkjob.abnormal_num,
- checkjob.check_num,checkjob.remark,
- checkjob.status,
- checkjob.receive_overtime,
- checkjob.sb_status
- </sql>
- <sql id="List_Condition">
- <if test="id != null and id != ''">
- and checkjob.id = #{id}
- </if>
- <if test="receiveOvertime != null">
- and checkjob.receive_overtime = #{receiveOvertime}
- </if>
- <if test="planId != null and planId != ''">
- and checkjob.plan_id = #{planId}
- </if>
- <if test="sbId != null and sbId != ''">
- and checkjob.sb_id = #{sbId}
- </if>
- <if test="partId != null and partId != ''">
- and checkjob.part_id = #{partId}
- </if>
- <if test="standardId != null and standardId != ''">
- and checkjob.standard_id = #{standardId}
- </if>
- <if test="requirement != null and requirement != ''">
- and checkjob.requirement = #{requirement}
- </if>
- <if test="remark != null and remark != ''">
- and checkjob.remark = #{remark}
- </if>
- <if test="feedback != null and feedback != ''">
- and checkjob.feedback = #{feedback}
- </if>
- <if test="status ==null and startTimeStart != null ">
- and checkjob.start_time <![CDATA[>=]]>#{startTimeStart}
- </if>
- <if test="status ==null and startTimeEnd != null">
- and checkjob.start_time <![CDATA[<=]]> #{startTimeEnd}
- </if>
- <if test="startTime != null">
- and checkjob.start_time = #{startTime}
- </if>
- <if test="endTimeStart != null">
- and checkjob.end_time <![CDATA[>=]]>; #{endTimeStart}
- </if>
- <if test="endTimeEnd != null">
- and checkjob.end_time <![CDATA[<=]]> #{endTimeEnd}
- </if>
- <if test="endTime != null">
- and checkjob.end_time = #{endTime}
- </if>
- <if test="actualStartTimeStart != null">
- and checkjob.actual_start_time <![CDATA[>=]]>; #{actualStartTimeStart}
- </if>
- <if test="actualStartTimeEnd != null">
- and checkjob.actual_start_time <![CDATA[<=]]> #{actualStartTimeEnd}
- </if>
- <if test="actualStartTime != null">
- and checkjob.actual_start_time = #{actualStartTime}
- </if>
- <if test="actualEndTimeStart != null">
- and checkjob.actual_end_time <![CDATA[>=]]> #{actualEndTimeStart}
- </if>
- <if test="actualEndTimeEnd != null">
- and checkjob.actual_end_time <![CDATA[<=]]> #{actualEndTimeEnd}
- </if>
- <if test="actualEndTime != null">
- and checkjob.actual_end_time = #{actualEndTime}
- </if>
- <if test="status != null">
- and checkjob.status = #{status}
- </if>
- <if test="sbStatus != null">
- and checkjob.sb_status = #{sbStatus}
- </if>
- <if test="createdUserId != null and createdUserId != ''">
- and checkjob.created_user_id = #{createdUserId}
- </if>
- <if test="updateUserId != null and updateUserId != ''">
- and checkjob.update_user_id = #{updateUserId}
- </if>
- <if test="createdUserName != null and createdUserName != ''">
- and checkjob.created_user_name = #{createdUserName}
- </if>
- <if test="updateUserName != null and updateUserName != ''">
- and checkjob.update_user_name = #{updateUserName}
- </if>
- <if test="createdTimeStart != null">
- and checkjob.created_time <![CDATA[>=]]> #{createdTimeStart}
- </if>
- <if test="createdTimeEnd != null">
- and checkjob.created_time <![CDATA[<=]]> #{createdTimeEnd}
- </if>
- <if test="createdTime != null">
- and checkjob.created_time = #{createdTime}
- </if>
- <if test="updateTimeStart != null">
- and checkjob.update_time <![CDATA[>=]]> #{updateTimeStart}
- </if>
- <if test="updateTimeEnd != null">
- and checkjob.update_time <![CDATA[<=]]> #{updateTimeEnd}
- </if>
- <if test="updateTime != null">
- and checkjob.update_time = #{updateTime}
- </if>
- <if test="keyword != null and keyword != ''">
- and (
- standard.no like concat('%',#{keyword},'%') or
- sbinfo.name like concat('%',#{keyword},'%') or
- sbinfo.no like concat('%',#{keyword},'%') )
- </if>
- <if test="zbh != null and zbh != ''">
- and sbinfo.zbh = #{zbh}
- </if>
- <if test="sbLevel != null and sbLevel != ''">
- and sbinfo.level = #{sbLevel}
- </if>
- <if test="typeId != null and typeId != ''">
- and sbinfo.type_id = #{typeId}
- </if>
- <if test="periodType != null and periodType != ''">
- and standard.period_type = #{periodType}
- </if>
- <if test="standardLevel != null and standardLevel != ''">
- and standard.level = #{standardLevel}
- </if>
- <if test="standardLevelList != null and standardLevelList.size > 0">
- AND standard.level in
- <foreach item="item" index="index" collection="standardLevelList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="checkUserId != null and checkUserId != ''">
- and (
- checkjob.check_user_id = #{checkUserId}
- <if test="checkDeptIds != null and checkDeptIds.size() > 0">
- OR (checkjob.check_dept_id IS NOT NULL AND checkjob.check_dept_id IN
- <foreach item="deptId" collection="checkDeptIds" open="(" close=")" separator=",">
- #{deptId}
- </foreach>)
- </if>
- )
- </if>
- <if test="checkDeptId != null and checkDeptId != ''">
- and checkjob.check_dept_id = #{checkDeptId}
- </if>
- <if test="type != null and type != ''">
- and checkjob.type = #{type}
- </if>
- <if test="searchStartTime != null and ( status==null or status==1 or status==2)">
- and checkjob.start_time <![CDATA[ >= ]]> date_format(#{searchStartTime},'%Y-%m-%d')
- </if>
- <if test="searchEndTime != null and (status==null or status==1 or status==2)">
- and checkjob.start_time <![CDATA[ <= ]]> #{searchEndTime}
- </if>
- <if test="searchStartTime != null and status!=null and status==3">
- and checkjob.actual_start_time <![CDATA[ >= ]]> #{searchStartTime}
- </if>
- <if test="searchEndTime != null and status!=null and status==3">
- and checkjob.actual_start_time <![CDATA[ <= ]]> #{searchEndTime}
- </if>
- <if test="statusList != null and statusList.size > 0">
- AND checkjob.status in
- <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="checkUserName != null and checkUserName != ''">
- and (
- u.real_name like concat('%',#{checkUserName},'%')
- OR (
- checkjob.check_dept_id IS NOT NULL
- AND EXISTS (
- SELECT 1
- FROM t_sys_user su
- INNER JOIN t_sys_user_dept sud ON sud.user_id = su.user_id
- INNER JOIN t_sys_dept_relation dr ON dr.descendant = sud.dept_id
- WHERE su.real_name like concat('%',#{checkUserName},'%')
- AND dr.ancestor = checkjob.check_dept_id
- )
- )
- )
- </if>
- <if test="actualUser != null and actualUser != ''">
- and checkjob.actual_user like concat('%',#{actualUser},'%')
- </if>
- <if test="positionId!=null and positionId!=''">
- and sbinfo.position_id = #{positionId}
- </if>
- <if test="periodTypeList != null and periodTypeList.size > 0">
- AND standard.period_type in
- <foreach item="item" index="index" collection="periodTypeList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="sbLevelList != null and sbLevelList.size > 0">
- AND sbinfo.level in
- <foreach item="item" index="index" collection="sbLevelList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="sbNotStatus!=null">
- and sbinfo.status !=#{sbNotStatus}
- </if>
- </sql>
-
- <!-- 子查询专用的条件片段,使用 checkjob_inner 等别名 -->
- <sql id="List_Condition_Inner">
- <if test="id != null and id != ''">
- and checkjob_inner.id = #{id}
- </if>
- <if test="receiveOvertime != null">
- and checkjob_inner.receive_overtime = #{receiveOvertime}
- </if>
- <if test="planId != null and planId != ''">
- and checkjob_inner.plan_id = #{planId}
- </if>
- <if test="sbId != null and sbId != ''">
- and checkjob_inner.sb_id = #{sbId}
- </if>
- <if test="partId != null and partId != ''">
- and checkjob_inner.part_id = #{partId}
- </if>
- <if test="standardId != null and standardId != ''">
- and checkjob_inner.standard_id = #{standardId}
- </if>
- <if test="requirement != null and requirement != ''">
- and checkjob_inner.requirement = #{requirement}
- </if>
- <if test="remark != null and remark != ''">
- and checkjob_inner.remark = #{remark}
- </if>
- <if test="feedback != null and feedback != ''">
- and checkjob_inner.feedback = #{feedback}
- </if>
- <if test="status ==null and startTimeStart != null ">
- and checkjob_inner.start_time <![CDATA[>=]]>#{startTimeStart}
- </if>
- <if test="status ==null and startTimeEnd != null">
- and checkjob_inner.start_time <![CDATA[<=]]> #{startTimeEnd}
- </if>
- <if test="startTime != null">
- and checkjob_inner.start_time = #{startTime}
- </if>
- <if test="endTimeStart != null">
- and checkjob_inner.end_time <![CDATA[>=]]>; #{endTimeStart}
- </if>
- <if test="endTimeEnd != null">
- and checkjob_inner.end_time <![CDATA[<=]]> #{endTimeEnd}
- </if>
- <if test="endTime != null">
- and checkjob_inner.end_time = #{endTime}
- </if>
- <if test="actualStartTimeStart != null">
- and checkjob_inner.actual_start_time <![CDATA[>=]]>; #{actualStartTimeStart}
- </if>
- <if test="actualStartTimeEnd != null">
- and checkjob_inner.actual_start_time <![CDATA[<=]]> #{actualStartTimeEnd}
- </if>
- <if test="actualStartTime != null">
- and checkjob_inner.actual_start_time = #{actualStartTime}
- </if>
- <if test="actualEndTimeStart != null">
- and checkjob_inner.actual_end_time <![CDATA[>=]]> #{actualEndTimeStart}
- </if>
- <if test="actualEndTimeEnd != null">
- and checkjob_inner.actual_end_time <![CDATA[<=]]> #{actualEndTimeEnd}
- </if>
- <if test="actualEndTime != null">
- and checkjob_inner.actual_end_time = #{actualEndTime}
- </if>
- <if test="status != null">
- and checkjob_inner.status = #{status}
- </if>
- <if test="sbStatus != null">
- and checkjob_inner.sb_status = #{sbStatus}
- </if>
- <if test="createdUserId != null and createdUserId != ''">
- and checkjob_inner.created_user_id = #{createdUserId}
- </if>
- <if test="updateUserId != null and updateUserId != ''">
- and checkjob_inner.update_user_id = #{updateUserId}
- </if>
- <if test="createdUserName != null and createdUserName != ''">
- and checkjob_inner.created_user_name = #{createdUserName}
- </if>
- <if test="updateUserName != null and updateUserName != ''">
- and checkjob_inner.update_user_name = #{updateUserName}
- </if>
- <if test="createdTimeStart != null">
- and checkjob_inner.created_time <![CDATA[>=]]> #{createdTimeStart}
- </if>
- <if test="createdTimeEnd != null">
- and checkjob_inner.created_time <![CDATA[<=]]> #{createdTimeEnd}
- </if>
- <if test="createdTime != null">
- and checkjob_inner.created_time = #{createdTime}
- </if>
- <if test="updateTimeStart != null">
- and checkjob_inner.update_time <![CDATA[>=]]> #{updateTimeStart}
- </if>
- <if test="updateTimeEnd != null">
- and checkjob_inner.update_time <![CDATA[<=]]> #{updateTimeEnd}
- </if>
- <if test="updateTime != null">
- and checkjob_inner.update_time = #{updateTime}
- </if>
- <if test="keyword != null and keyword != ''">
- and (
- standard_inner.no like concat('%',#{keyword},'%') or
- sbinfo_inner.name like concat('%',#{keyword},'%') or
- sbinfo_inner.no like concat('%',#{keyword},'%') )
- </if>
- <if test="zbh != null and zbh != ''">
- and sbinfo_inner.zbh = #{zbh}
- </if>
- <if test="sbLevel != null and sbLevel != ''">
- and sbinfo_inner.level = #{sbLevel}
- </if>
- <if test="typeId != null and typeId != ''">
- and sbinfo_inner.type_id = #{typeId}
- </if>
- <if test="periodType != null and periodType != ''">
- and standard_inner.period_type = #{periodType}
- </if>
- <if test="standardLevel != null and standardLevel != ''">
- and standard_inner.level = #{standardLevel}
- </if>
- <if test="standardLevelList != null and standardLevelList.size > 0">
- AND standard_inner.level in
- <foreach item="item" index="index" collection="standardLevelList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="checkUserId != null and checkUserId != ''">
- and (
- checkjob_inner.check_user_id = #{checkUserId}
- <if test="checkDeptIds != null and checkDeptIds.size() > 0">
- OR (checkjob_inner.check_dept_id IS NOT NULL AND checkjob_inner.check_dept_id IN
- <foreach item="deptId" collection="checkDeptIds" open="(" close=")" separator=",">
- #{deptId}
- </foreach>)
- </if>
- )
- </if>
- <if test="checkDeptId != null and checkDeptId != ''">
- and checkjob_inner.check_dept_id = #{checkDeptId}
- </if>
- <if test="type != null and type != ''">
- and checkjob_inner.type = #{type}
- </if>
- <if test="searchStartTime != null and ( status==null or status==1 or status==2)">
- and checkjob_inner.start_time <![CDATA[ >= ]]> date_format(#{searchStartTime},'%Y-%m-%d')
- </if>
- <if test="searchEndTime != null and (status==null or status==1 or status==2)">
- and checkjob_inner.start_time <![CDATA[ <= ]]> #{searchEndTime}
- </if>
- <if test="searchStartTime != null and status!=null and status==3">
- and checkjob_inner.actual_start_time <![CDATA[ >= ]]> #{searchStartTime}
- </if>
- <if test="searchEndTime != null and status!=null and status==3">
- and checkjob_inner.actual_start_time <![CDATA[ <= ]]> #{searchEndTime}
- </if>
- <if test="statusList != null and statusList.size > 0">
- AND checkjob_inner.status in
- <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="checkUserName != null and checkUserName != ''">
- and (
- u.real_name like concat('%',#{checkUserName},'%')
- OR (
- checkjob_inner.check_dept_id IS NOT NULL
- AND EXISTS (
- SELECT 1
- FROM t_sys_user su
- INNER JOIN t_sys_user_dept sud ON sud.user_id = su.user_id
- INNER JOIN t_sys_dept_relation dr ON dr.descendant = sud.dept_id
- WHERE su.real_name like concat('%',#{checkUserName},'%')
- AND dr.ancestor = checkjob_inner.check_dept_id
- )
- )
- )
- </if>
- <if test="actualUser != null and actualUser != ''">
- and checkjob_inner.actual_user like concat('%',#{actualUser},'%')
- </if>
- <if test="positionId!=null and positionId!=''">
- and sbinfo_inner.position_id = #{positionId}
- </if>
- <if test="periodTypeList != null and periodTypeList.size > 0">
- AND standard_inner.period_type in
- <foreach item="item" index="index" collection="periodTypeList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="sbLevelList != null and sbLevelList.size > 0">
- AND sbinfo_inner.level in
- <foreach item="item" index="index" collection="sbLevelList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="sbNotStatus!=null">
- and sbinfo_inner.status !=#{sbNotStatus}
- </if>
- </sql>
- <select id="selectList" parameterType="com.platform.dao.dto.check.CheckJobDTO"
- resultMap="CheckJobVOMap">
- select
- checkjob.id as id,
- checkjob.plan_id as plan_id,
- checkjob.name as name,
- checkjob.type as type,
- checkjob.hours as hours,
- checkjob.miles as miles,
- checkjob.sb_id as sb_id,
- checkjob.part_id as part_id,
- checkjob.standard_id as standard_id,
- checkjob.start_time as start_time,
- checkjob.end_time as end_time,
- checkjob.actual_start_time as actual_start_time,
- checkjob.actual_end_time as actual_end_time,
- checkjob.requirement as requirement,
- checkjob.remark as remark,
- checkjob.feedback as feedback,
- checkjob.status as status,
- checkjob.sb_status as sb_status,
- checkjob.check_user_id as check_user_id,
- checkjob.check_dept_id as check_dept_id,
- checkjob.created_user_id as created_user_id,
- checkjob.update_user_id as update_user_id,
- checkjob.created_user_name as created_user_name,
- checkjob.update_user_name as update_user_name,
- checkjob.created_time as created_time,
- checkjob.update_time as update_time,
- checkjob.standard_hours as standard_hours,
- checkjob.real_hours as real_hours,
- checkjob.actual_user as actual_user,
- checkjob.receive_overtime as receive_overtime,
- checkjob.con_task as con_task,
- u.real_name as checkUserName,
- dept.name as checkDeptName,
- sbinfo.name as sbName,
- sbinfo.no as sbNo,
- sbinfo.level as sbLevel,
- sbinfo.id as sbInfoId,
- partinfo.name as partName,
- standard.no as standardNo,
- standard.name as standardName,
- standard.level as standardLevel,
- standard.period as period,
- standard.period_type as periodType,
- position.id as positionId,
- position.name as positionName,
- cr.id as requirement_id,
- cr.std_name as std_name,
- cr.scope as scope,
- cr.type as requirement_type,
- cr.method as requirement_method,
- cr.sb_type as requirement_sb_type,
- cr.check_level as requirement_check_level,
- cr.manage_item as requirement_manage_item,
- cr.check_item as requirement_check_item,
- cr.content as requirement_content,
- cr.period as requirement_period,
- sbtype.name as requirement_sb_type_name,
- cr.remark as requirement_remark,
- cr.created_user_name as requirement_created_user_name,
- cr.created_time as requirement_created_time,
- cr.update_user_name as requirement_update_user_name,
- cr.update_time as requirement_update_time,
- cr.status as requirement_status
- from t_check_job as checkjob
- left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
- left join t_part_info partinfo on partinfo.id = checkjob.part_id
- left join t_check_standard standard on standard.id = checkjob.standard_id
- left join t_sys_user u on checkjob.check_user_id = u.user_id
- left join t_sys_dept dept on checkjob.check_dept_id = dept.dept_id
- left join t_sb_position position on position.id = sbinfo.position_id
- left join t_check_standard_requirement csr on csr.standard_id = standard.id
- left join t_check_requirement cr on cr.id = csr.requirement_id
- left join t_sb_type sbtype on sbtype.id = cr.sb_type
- WHERE checkjob.id IN (
- SELECT job_id FROM (
- SELECT checkjob_inner.id as job_id
- FROM t_check_job checkjob_inner
- LEFT JOIN t_sb_info sbinfo_inner ON sbinfo_inner.id = checkjob_inner.sb_id
- LEFT JOIN t_check_standard standard_inner ON standard_inner.id = checkjob_inner.standard_id
- LEFT JOIN t_sys_user u ON checkjob_inner.check_user_id = u.user_id
- <where>
- <include refid="List_Condition_Inner"/>
- </where>
- ORDER BY
- checkjob_inner.status asc,
- <if test="status==null or status==1 or status==2">
- checkjob_inner.start_time asc,
- </if>
- sbinfo_inner.level asc,
- sbinfo_inner.no asc,
- standard_inner.period_type asc,
- standard_inner.period asc
- ) as tmp
- )
- Order By
- checkjob.status asc,
- <if test="status==null or status==1 or status==2">
- checkjob.start_time asc,
- </if>
- sbinfo.level asc,
- sbinfo.no asc,
- standard.period_type asc,
- standard.period asc
- </select>
- <select id="selectList2" parameterType="com.platform.dao.dto.check.CheckJobDTO"
- resultMap="CheckJobVOMap">
- select
- checkjob.id as id,
- checkjob.plan_id as plan_id,
- checkjob.name as name,
- checkjob.type as type,
- checkjob.hours as hours,
- checkjob.miles as miles,
- checkjob.sb_id as sb_id,
- checkjob.part_id as part_id,
- checkjob.standard_id as standard_id,
- checkjob.start_time as start_time,
- checkjob.end_time as end_time,
- checkjob.actual_start_time as actual_start_time,
- checkjob.actual_end_time as actual_end_time,
- checkjob.requirement as requirement,
- checkjob.remark as remark,
- checkjob.feedback as feedback,
- checkjob.status as status,
- checkjob.sb_status as sb_status,
- checkjob.check_user_id as check_user_id,
- checkjob.check_dept_id as check_dept_id,
- checkjob.created_user_id as created_user_id,
- checkjob.update_user_id as update_user_id,
- checkjob.created_user_name as created_user_name,
- checkjob.update_user_name as update_user_name,
- checkjob.created_time as created_time,
- checkjob.update_time as update_time,
- checkjob.standard_hours as standard_hours,
- checkjob.real_hours as real_hours,
- checkjob.actual_user as actual_user,
- checkjob.receive_overtime as receive_overtime,
- checkjob.con_task as con_task,
- u.real_name as checkUserName,
- dept.name as checkDeptName,
- sbinfo.name as sbName,
- sbinfo.no as sbNo,
- sbinfo.level as sbLevel,
- sbinfo.id as sbInfoId,
- partinfo.name as partName,
- standard.no as standardNo,
- standard.name as standardName,
- standard.level as standardLevel,
- standard.period as period,
- standard.period_type as periodType,
- position.id as positionId,
- position.name as positionName,
- <!-- 保养要求相关字段 -->
- cr.id as requirement_id,
- cr.std_name as std_name,
- cr.scope as scope,
- cr.type as requirement_type,
- cr.method as requirement_method,
- cr.sb_type as requirement_sb_type,
- cr.check_level as requirement_check_level,
- cr.manage_item as requirement_manage_item,
- cr.check_item as requirement_check_item,
- cr.content as requirement_content,
- cr.period as requirement_period,
- sbtype.name as requirement_sb_type_name,
- cr.remark as requirement_remark,
- cr.created_user_name as requirement_created_user_name,
- cr.created_time as requirement_created_time,
- cr.update_user_name as requirement_update_user_name,
- cr.update_time as requirement_update_time,
- cr.status as requirement_status
- from t_check_job as checkjob
- left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
- left join t_part_info partinfo on partinfo.id = checkjob.part_id
- left join t_check_standard standard on standard.id = checkjob.standard_id
- left join t_sys_user u on checkjob.check_user_id = u.user_id
- left join t_sys_dept dept on checkjob.check_dept_id = dept.dept_id
- left join t_sb_position position on position.id = sbinfo.position_id
- <!-- 关联保养要求表 -->
- left join t_check_standard_requirement csr on csr.standard_id = standard.id
- left join t_check_requirement cr on cr.id = csr.requirement_id and cr.status = 1
- left join t_sb_type sbtype on sbtype.id = cr.sb_type
- <where>
- <include refid="List_Condition"/>
- </where>
- </select>
- <select id="getScreenCountByTime" parameterType="com.platform.dao.dto.check.CheckJobDTO"
- resultType="com.platform.dao.vo.query.check.CheckJobVO">
- select count(checkjob.id) as countNum
- from t_check_job as checkjob
- <where>
- <if test="searchStartTime != null">
- and checkjob.start_time <![CDATA[ >= ]]> #{searchStartTime}
- </if>
- <if test="searchEndTime != null">
- and checkjob.start_time <![CDATA[ <= ]]> #{searchEndTime}
- </if>
- <if test="status != null">
- and checkjob.status = #{status}
- </if>
- </where>
- </select>
- <select id="countByCondition" parameterType="com.platform.dao.dto.check.CheckJobDTO"
- resultType="long">
- select count(DISTINCT checkjob.id)
- from t_check_job checkjob
- LEFT JOIN t_sb_info sbinfo ON sbinfo.id = checkjob.sb_id
- LEFT JOIN t_check_standard standard ON standard.id = checkjob.standard_id
- LEFT JOIN t_sys_user u ON checkjob.check_user_id = u.user_id
- <where>
- <include refid="List_Condition"/>
- </where>
- </select>
- <select id="selectDetail" resultType="com.platform.dao.vo.query.check.CheckJobVO">
- select checkjob.id as id,
- checkjob.plan_id as plan_id,
- checkjob.name as name,
- checkjob.type as type,
- checkjob.hours as hours,
- checkjob.miles as miles,
- checkjob.sb_id as sb_id,
- checkjob.part_id as part_id,
- checkjob.standard_id as standard_id,
- checkjob.start_time as start_time,
- checkjob.end_time as end_time,
- checkjob.actual_start_time as actual_start_time,
- checkjob.actual_end_time as actual_end_time,
- checkjob.requirement as requirement,
- checkjob.remark as remark,
- checkjob.feedback as feedback,
- checkjob.status as status,
- checkjob.sb_status as sb_status,
- checkjob.check_user_id as check_user_id,
- checkjob.check_dept_id as check_dept_id,
- checkjob.created_user_id as created_user_id,
- checkjob.update_user_id as update_user_id,
- checkjob.created_user_name as created_user_name,
- checkjob.update_user_name as update_user_name,
- checkjob.created_time as created_time,
- checkjob.update_time as update_time,
- checkjob.standard_hours as standard_hours,
- checkjob.real_hours as real_hours,
- checkjob.actual_user as actual_user,
- checkjob.receive_overtime as receive_overtime,
- checkjob.con_task as con_task,
- u.real_name as checkUserName,
- dept.name as checkDeptName,
- sbinfo.name sbName,
- sbinfo.no sbNo,
- sbinfo.level sbLevel,
- partinfo.name partName,
- standard.no standardNo,
- standard.name standardName,
- standard.level standardLevel,
- standard.period period,
- standard.next_date as nextDate,
- standard.period_type periodType
- from t_check_job as checkjob
- left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
- left join t_part_info partinfo on partinfo.id = checkjob.part_id
- left join t_check_standard standard on standard.id = checkjob.standard_id
- left join t_sys_user u on checkjob.check_user_id = u.user_id
- left join t_sys_dept dept on checkjob.check_dept_id = dept.dept_id
- where checkjob.id = #{id}
- </select>
- <select id="getNotFinishNumByDTO" resultType="java.lang.Integer">
- select count(checkjob.id)
- from t_check_job as checkjob
- left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
- left join t_part_info partinfo on partinfo.id = checkjob.part_id
- left join t_check_standard standard on standard.id = checkjob.standard_id
- left join t_sys_user u on checkjob.check_user_id = u.user_id
- <where>
- <include refid="List_Condition"/>
- </where>
- </select>
- <select id="selectLastJob" parameterType="com.platform.dao.dto.check.CheckJobDTO"
- resultType="com.platform.dao.vo.query.check.CheckJobVO">
- select checkjob.id as id,
- checkjob.plan_id as plan_id,
- checkjob.name as name,
- checkjob.type as type,
- checkjob.hours as hours,
- checkjob.miles as miles,
- checkjob.sb_id as sb_id,
- checkjob.part_id as part_id,
- checkjob.standard_id as standard_id,
- checkjob.start_time as start_time,
- checkjob.end_time as end_time,
- checkjob.actual_start_time as actual_start_time,
- checkjob.actual_end_time as actual_end_time,
- checkjob.requirement as requirement,
- checkjob.remark as remark,
- checkjob.feedback as feedback,
- checkjob.status as status,
- checkjob.sb_status as sb_status,
- checkjob.check_user_id as check_user_id,
- checkjob.check_dept_id as check_dept_id,
- checkjob.created_user_id as created_user_id,
- checkjob.update_user_id as update_user_id,
- checkjob.created_user_name as created_user_name,
- checkjob.update_user_name as update_user_name,
- checkjob.created_time as created_time,
- checkjob.update_time as update_time,
- checkjob.standard_hours as standard_hours,
- checkjob.real_hours as real_hours,
- checkjob.actual_user as actual_user,
- checkjob.receive_overtime as receive_overtime,
- checkjob.con_task as con_task
- from t_check_job as checkjob
- where checkjob.sb_id = #{sbId}
- and checkjob.standard_id = #{standardId}
- order by checkjob.created_time desc limit 1
- </select>
- <update id="updateBatch" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update t_check_job
- <set>
- <if test="item.receiveOvertime != null">
- receive_overtime = #{item.receiveOvertime}
- </if>
- <if test="item.startTime != null">
- start_time = #{item.startTime}
- </if>
- </set>
- where id = #{item.id}
- </foreach>
- </update>
- <update id="updateBatchByDelStandard" parameterType="com.platform.dao.entity.check.CheckJob">
- update t_check_job
- <set>
- status = 3,
- remark = #{remark}
- </set>
- where standard_id = #{standardId}
- and status != 3
- </update>
- <select id="selectListByDate" parameterType="com.platform.dao.dto.check.CheckJobDTO"
- resultType="com.platform.dao.vo.query.check.CheckJobVO">
- select checkjob.id as id,
- checkjob.plan_id as plan_id,
- checkjob.name as name,
- checkjob.type as type,
- checkjob.hours as hours,
- checkjob.miles as miles,
- checkjob.sb_id as sb_id,
- checkjob.part_id as part_id,
- checkjob.standard_id as standard_id,
- checkjob.start_time as start_time,
- checkjob.end_time as end_time,
- checkjob.actual_start_time as actual_start_time,
- checkjob.actual_end_time as actual_end_time,
- checkjob.requirement as requirement,
- checkjob.remark as remark,
- checkjob.feedback as feedback,
- checkjob.status as status,
- checkjob.sb_status as sb_status,
- checkjob.check_user_id as check_user_id,
- checkjob.check_dept_id as check_dept_id,
- checkjob.created_user_id as created_user_id,
- checkjob.update_user_id as update_user_id,
- checkjob.created_user_name as created_user_name,
- checkjob.update_user_name as update_user_name,
- checkjob.created_time as created_time,
- checkjob.update_time as update_time,
- checkjob.standard_hours as standard_hours,
- checkjob.real_hours as real_hours,
- checkjob.actual_user as actual_user,
- checkjob.receive_overtime as receive_overtime,
- checkjob.con_task as con_task
- from t_check_job as checkjob
- <where>
- <if test="status != null">
- and checkjob.status = #{status}
- </if>
- <if test="startTimeEnd != null">
- and checkjob.start_time <![CDATA[ <= ]]> #{startTimeEnd}
- </if>
- </where>
- </select>
- <!-- 分页查询任务ID列表 -->
- <select id="selectJobIdPage" parameterType="com.platform.dao.dto.check.CheckJobDTO"
- resultType="java.lang.String">
- SELECT checkjob_inner.id
- FROM t_check_job checkjob_inner
- LEFT JOIN t_sb_info sbinfo_inner ON sbinfo_inner.id = checkjob_inner.sb_id
- LEFT JOIN t_check_standard standard_inner ON standard_inner.id = checkjob_inner.standard_id
- LEFT JOIN t_sys_user u ON checkjob_inner.check_user_id = u.user_id
- <where>
- <include refid="List_Condition_Inner"/>
- </where>
- </select>
- <!-- 根据ID列表查询完整数据 -->
- <select id="selectListByIds" parameterType="com.platform.dao.dto.check.CheckJobDTO"
- resultMap="CheckJobVOMap">
- select
- checkjob.id as id,
- checkjob.plan_id as plan_id,
- checkjob.name as name,
- checkjob.type as type,
- checkjob.hours as hours,
- checkjob.miles as miles,
- checkjob.sb_id as sb_id,
- checkjob.part_id as part_id,
- checkjob.standard_id as standard_id,
- checkjob.start_time as start_time,
- checkjob.end_time as end_time,
- checkjob.actual_start_time as actual_start_time,
- checkjob.actual_end_time as actual_end_time,
- checkjob.requirement as requirement,
- checkjob.remark as remark,
- checkjob.feedback as feedback,
- checkjob.status as status,
- checkjob.sb_status as sb_status,
- checkjob.check_user_id as check_user_id,
- checkjob.check_dept_id as check_dept_id,
- checkjob.created_user_id as created_user_id,
- checkjob.update_user_id as update_user_id,
- checkjob.created_user_name as created_user_name,
- checkjob.update_user_name as update_user_name,
- checkjob.created_time as created_time,
- checkjob.update_time as update_time,
- checkjob.standard_hours as standard_hours,
- checkjob.real_hours as real_hours,
- checkjob.actual_user as actual_user,
- checkjob.receive_overtime as receive_overtime,
- checkjob.con_task as con_task,
- u.real_name as checkUserName,
- dept.name as checkDeptName,
- sbinfo.name as sbName,
- sbinfo.no as sbNo,
- sbinfo.level as sbLevel,
- sbinfo.id as sbInfoId,
- partinfo.name as partName,
- standard.no as standardNo,
- standard.name as standardName,
- standard.level as standardLevel,
- standard.period as period,
- standard.period_type as periodType,
- position.id as positionId,
- position.name as positionName,
- cr.id as requirement_id,
- cr.std_name as std_name,
- cr.scope as scope,
- cr.type as requirement_type,
- cr.method as requirement_method,
- cr.sb_type as requirement_sb_type,
- cr.check_level as requirement_check_level,
- cr.manage_item as requirement_manage_item,
- cr.check_item as requirement_check_item,
- cr.content as requirement_content,
- cr.period as requirement_period,
- sbtype.name as requirement_sb_type_name,
- cr.remark as requirement_remark,
- cr.created_user_name as requirement_created_user_name,
- cr.created_time as requirement_created_time,
- cr.update_user_name as requirement_update_user_name,
- cr.update_time as requirement_update_time,
- cr.status as requirement_status
- from t_check_job as checkjob
- left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
- left join t_part_info partinfo on partinfo.id = checkjob.part_id
- left join t_check_standard standard on standard.id = checkjob.standard_id
- left join t_sys_user u on checkjob.check_user_id = u.user_id
- left join t_sys_dept dept on checkjob.check_dept_id = dept.dept_id
- left join t_sb_position position on position.id = sbinfo.position_id
- left join t_check_standard_requirement csr on csr.standard_id = standard.id
- left join t_check_requirement cr on cr.id = csr.requirement_id
- left join t_sb_type sbtype on sbtype.id = cr.sb_type
- WHERE checkjob.id IN
- <foreach item="item" index="index" collection="jobIdList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- Order By
- checkjob.status asc,
- <if test="status==null or status==1 or status==2">
- checkjob.start_time asc,
- </if>
- sbinfo.level asc,
- sbinfo.no asc,
- standard.period_type asc,
- standard.period asc
- </select>
- <!-- 根据ID列表查询完整数据2(record=1) -->
- <select id="selectList2ByIds" parameterType="com.platform.dao.dto.check.CheckJobDTO"
- resultMap="CheckJobVOMap">
- select
- checkjob.id as id,
- checkjob.plan_id as plan_id,
- checkjob.name as name,
- checkjob.type as type,
- checkjob.hours as hours,
- checkjob.miles as miles,
- checkjob.sb_id as sb_id,
- checkjob.part_id as part_id,
- checkjob.standard_id as standard_id,
- checkjob.start_time as start_time,
- checkjob.end_time as end_time,
- checkjob.actual_start_time as actual_start_time,
- checkjob.actual_end_time as actual_end_time,
- checkjob.requirement as requirement,
- checkjob.remark as remark,
- checkjob.feedback as feedback,
- checkjob.status as status,
- checkjob.sb_status as sb_status,
- checkjob.check_user_id as check_user_id,
- checkjob.check_dept_id as check_dept_id,
- checkjob.created_user_id as created_user_id,
- checkjob.update_user_id as update_user_id,
- checkjob.created_user_name as created_user_name,
- checkjob.update_user_name as update_user_name,
- checkjob.created_time as created_time,
- checkjob.update_time as update_time,
- checkjob.standard_hours as standard_hours,
- checkjob.real_hours as real_hours,
- checkjob.actual_user as actual_user,
- checkjob.receive_overtime as receive_overtime,
- checkjob.con_task as con_task,
- u.real_name as checkUserName,
- dept.name as checkDeptName,
- sbinfo.name as sbName,
- sbinfo.no as sbNo,
- sbinfo.level as sbLevel,
- sbinfo.id as sbInfoId,
- partinfo.name as partName,
- standard.no as standardNo,
- standard.name as standardName,
- standard.level as standardLevel,
- standard.period as period,
- standard.period_type as periodType,
- position.id as positionId,
- position.name as positionName,
- cr.id as requirement_id,
- cr.std_name as std_name,
- cr.scope as scope,
- cr.type as requirement_type,
- cr.method as requirement_method,
- cr.sb_type as requirement_sb_type,
- cr.check_level as requirement_check_level,
- cr.manage_item as requirement_manage_item,
- cr.check_item as requirement_check_item,
- cr.content as requirement_content,
- cr.period as requirement_period,
- sbtype.name as requirement_sb_type_name,
- cr.remark as requirement_remark,
- cr.created_user_name as requirement_created_user_name,
- cr.created_time as requirement_created_time,
- cr.update_user_name as requirement_update_user_name,
- cr.update_time as requirement_update_time,
- cr.status as requirement_status
- from t_check_job as checkjob
- left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
- left join t_part_info partinfo on partinfo.id = checkjob.part_id
- left join t_check_standard standard on standard.id = checkjob.standard_id
- left join t_sys_user u on checkjob.check_user_id = u.user_id
- left join t_sys_dept dept on checkjob.check_dept_id = dept.dept_id
- left join t_sb_position position on position.id = sbinfo.position_id
- left join t_check_standard_requirement csr on csr.standard_id = standard.id
- left join t_check_requirement cr on cr.id = csr.requirement_id and cr.status = 1
- left join t_sb_type sbtype on sbtype.id = cr.sb_type
- WHERE checkjob.id IN
- <foreach item="item" index="index" collection="jobIdList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <!-- 查询执行方式为班组且未完成的保养任务,用于每日定时提醒班长 -->
- <select id="selectUnfinishedTeamJobs" resultType="com.platform.dao.vo.query.check.CheckJobVO">
- select
- checkjob.id as id,
- checkjob.name as name,
- checkjob.sb_id as sbId,
- checkjob.standard_id as standardId,
- checkjob.status as status,
- checkjob.check_dept_id as checkDeptId,
- checkjob.start_time as startTime,
- checkjob.end_time as endTime,
- sbinfo.name as sbName,
- sbinfo.no as sbNo,
- dept.name as checkDeptName
- from t_check_job as checkjob
- inner join t_check_standard standard on standard.id = checkjob.standard_id
- left join t_sb_info sbinfo on sbinfo.id = checkjob.sb_id
- left join t_sys_dept dept on checkjob.check_dept_id = dept.dept_id
- where checkjob.type = 2
- and standard.check_user_type = 4
- and checkjob.check_dept_id is not null
- and checkjob.status != 3
- order by checkjob.check_dept_id asc, sbinfo.no asc
- </select>
- <!-- 显式更新指定标准下某状态任务的执行人字段,允许将 check_user_id / check_dept_id 置空,
- 用于执行人方式在“班组”与“具体人”之间切换时彻底移交任务归属 -->
- <update id="updateJobExecutor">
- update t_check_job
- set check_user_id = #{checkUserId},
- check_dept_id = #{checkDeptId}
- where standard_id = #{standardId}
- and status = #{status}
- </update>
- <!-- 年度保养计划表:以“保养标准(t_check_standard)”为行来源,排除按天(period_type=1)的保养,
- 即使该标准尚未执行任何任务也会显示一行(月份不打勾);
- 当年某设备每月只要有已完成(status=3)的保养任务则该月打勾√ -->
- <select id="selectAnnualPlan" parameterType="com.platform.dao.dto.check.CheckJobDTO"
- resultType="com.platform.dao.vo.query.check.CheckJobAnnualPlanVO">
- select
- sbtype.name as category,
- sbinfo.name as sbName,
- <!-- 保养负责人与任务生成逻辑保持一致:
- 1-使用人取设备保管人(save_user),2-维修人取设备第一维修人(repair_user),
- 3-指定取标准上已绑定的人(保存时=维修人),4-班组取部门 -->
- case standard.check_user_type
- when 1 then su_save.real_name
- when 2 then su_repair.real_name
- when 3 then coalesce(su.real_name, su_repair.real_name)
- when 4 then sdept.name
- else coalesce(su.real_name, sdept.name)
- end as owner,
- count(distinct sbinfo.id) as sbNum,
- max(case when month(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = 1 then '√' else '' end) as month1,
- max(case when month(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = 2 then '√' else '' end) as month2,
- max(case when month(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = 3 then '√' else '' end) as month3,
- max(case when month(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = 4 then '√' else '' end) as month4,
- max(case when month(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = 5 then '√' else '' end) as month5,
- max(case when month(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = 6 then '√' else '' end) as month6,
- max(case when month(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = 7 then '√' else '' end) as month7,
- max(case when month(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = 8 then '√' else '' end) as month8,
- max(case when month(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = 9 then '√' else '' end) as month9,
- max(case when month(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = 10 then '√' else '' end) as month10,
- max(case when month(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = 11 then '√' else '' end) as month11,
- max(case when month(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = 12 then '√' else '' end) as month12
- from t_check_standard standard
- inner join t_sb_info sbinfo on sbinfo.id = standard.sb_id
- left join t_sb_type sbtype on sbtype.id = sbinfo.type_id
- left join t_sys_user su on standard.check_user_id = su.user_id
- left join t_sys_dept sdept on standard.check_dept_id = sdept.dept_id
- left join t_sys_user su_save on sbinfo.save_user = su_save.user_id
- left join t_sys_user su_repair on sbinfo.repair_user = su_repair.user_id
- left join t_check_job job on job.standard_id = standard.id
- and job.status = 3
- <if test="searchYear != null">
- and year(coalesce(job.actual_end_time, job.actual_start_time, job.end_time)) = #{searchYear}
- </if>
- <where>
- standard.period_type != 1
- <if test="type != null">
- and standard.type = #{type}
- </if>
- </where>
- group by sbtype.name, sbinfo.name,
- case standard.check_user_type
- when 1 then su_save.real_name
- when 2 then su_repair.real_name
- when 3 then coalesce(su.real_name, su_repair.real_name)
- when 4 then sdept.name
- else coalesce(su.real_name, sdept.name)
- end
- order by sbtype.name asc, sbinfo.name asc
- </select>
- </mapper>
|