123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- <?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.repair.RepairApplicationFormMapper">
- <sql id="Base_Column_List">
- application.*,
- user.real_name as userName,
- user2.real_name as repairUserName,
- user3.real_name as checkUserName,
- sb.model as model,
- sb.name as sbName,part.name as partName,
- sb.no as sbNo, sb.cph as sbCph, sb.model_id as modelId,
- error.name as repairErrorTypeName
- </sql>
- <select id="selectPageList" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
- resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
- select
- <include refid="Base_Column_List"/>
- from t_repair_application_form application
- left join t_sys_user user on application.user_id = user.user_id
- left join t_sys_user user2 on application.repair_user_id = user2.user_id
- left join t_sys_user user3 on application.check_user_id = user3.user_id
- left join t_sb_info sb on application.sb_id = sb.id
- left join t_error_type error on application.repair_error_type_id = error.id
- left join t_part_info part on application.part_id = part.id
- <where>
- <if test="keyword != null and keyword != ''">
- and ( sb.name like concat('%',#{keyword},'%') or
- sb.no like concat('%',#{keyword},'%') or
- application.content like concat('%',#{keyword},'%') )
- </if>
- <if test="content != null and content != ''">
- and application.content like concat('%',#{content},'%')
- </if>
- <if test="sbId != null and sbId != ''">
- and application.sb_id = #{sbId}
- </if>
- <if test="category != null and category != ''">
- and application.category = #{category}
- </if>
- <if test="categoryList != null and categoryList.size > 0">
- AND application.category in
- <foreach item="item" index="index" collection="categoryList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="zbh != null and zbh != ''">
- and sb.zbh = #{zbh}
- </if>
- <if test="no != null and no != ''">
- and application.no = #{no}
- </if>
- <if test="planFlag != null and planFlag != ''">
- and application.plan_flag = #{planFlag}
- </if>
- <if test="status != null and status != ''">
- and application.status = #{status}
- </if>
- <if test="actualUser != null and actualUser != ''">
- and application.actual_user = #{actualUser}
- </if>
- <if test="mainRepairId != null and mainRepairId != ''">
- and application.main_repair_id = #{mainRepairId}
- </if>
- <if test="outType != null and outType != ''">
- and application.out_type = #{outType}
- </if>
- <if test="type != null and type != ''">
- and application.type = #{type}
- </if>
- <if test="status != null and status != ''">
- and application.status = #{status}
- </if>
- <if test="userId != null and userId != ''">
- and application.user_id = #{userId}
- </if>
- <!--<if test="repairUserId != null and repairUserId != ''">
- <if test="repairUserIdOrNoAssignFlag != null and repairUserIdOrNoAssignFlag == true">
- and (application.repair_user_id = #{repairUserId} or application.repair_user_id is null)
- </if>
- <if test="repairUserIdOrNoAssignFlag == null || repairUserIdOrNoAssignFlag == false">
- and (application.repair_user_id = #{repairUserId} or sb.repair_user_second = #{repairUserId} )
- </if>
- </if>-->
- <if test="repairUserId != null and repairUserId != ''">
- and application.repair_user_id = #{repairUserId}
- </if>
- <if test="checkUserId != null and checkUserId != ''">
- and application.check_user_id = #{checkUserId}
- </if>
- <if test="repairUserName != null and repairUserName != ''">
- and user2.real_name like concat('%',#{repairUserName},'%')
- </if>
- <if test="searchStartTime != null">
- and application.apply_time <![CDATA[ >= ]]> #{searchStartTime}
- </if>
- <if test="searchEndTime != null">
- and application.apply_time <![CDATA[ <= ]]> #{searchEndTime}
- </if>
- <!-- 新增查询参数 -->
- <if test="statusList != null and statusList.size > 0">
- AND application.status in
- <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="repairStartTimeStart != null">
- and application.repair_start_time <![CDATA[ > ]]> #{repairStartTimeStart}
- </if>
- <if test="repairStartTimeEnd != null">
- and application.repair_start_time <![CDATA[ < ]]> #{repairStartTimeEnd}
- </if>
- <if test="dispatchUserId != null">
- and application.dispatch_user_id = #{dispatchUserId}
- </if>
- <if test="checkAllFlag != null and checkAllFlag == 1">
- and application.check_user_id is not null
- </if>
- </where>
- </select>
- <select id="selectById" parameterType="java.lang.Object"
- resultType="com.platform.dao.entity.repair.RepairApplicationForm">
- select
- <include refid="Base_Column_List"/>
- from t_repair_application_form application
- left join t_sys_user user on application.user_id = user.user_id
- left join t_sys_user user2 on application.repair_user_id = user2.user_id
- left join t_sys_user user3 on application.check_user_id = user3.user_id
- left join t_sb_info sb on application.sb_id = sb.id
- left join t_part_info part on application.part_id = part.id
- left join t_error_type error on application.repair_error_type_id = error.id
- where application.id = #{id,jdbcType=VARCHAR}
- </select>
- <select id="selectNoById" parameterType="java.lang.Object" resultType="java.lang.String">
- select no
- from t_repair_application_form
- where id = #{id,jdbcType=VARCHAR}
- </select>
- <!-- 维修统计数据 -->
- <select id="getWorkplaceRepairData" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
- resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
- select count(1) as tempTotalNum,rf.status from t_repair_application_form rf
- <where>
- <if test="repairUserId != null">
- and rf.repair_user_id = #{repairUserId}
- </if>
- <if test="searchTime != null">
- and rf.repair_start_time like concat('',#{searchTime},'%')
- </if>
- <if test="type != null">
- and rf.type = #{type}
- </if>
- </where>
- group by rf.status
- </select>
- <!-- 维修统计数据 -->
- <select id="getCurrentlyList" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
- resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
- select * from t_repair_application_form
- <where>
- <if test="searchStartTime != null">
- and repair_start_time <![CDATA[>]]> #{searchStartTime}
- </if>
- <if test="searchEndTime != null">
- and repair_start_time <![CDATA[<]]> #{searchEndTime}
- </if>
- <if test="repairUserId != null">
- and repair_user_id = #{repairUserId}
- </if>
- </where>
- </select>
- <!-- 近月统计单数和费用 -->
- <select id="getWorkplaceRepairSumData" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
- resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
- select count(1) as tempTotalNum from t_repair_application_form rf
- <where>
- <if test="repairUserId != null">
- and rf.repair_user_id = #{repairUserId}
- </if>
- <if test="searchStartTime != null">
- and rf.repair_start_time <![CDATA[>]]> #{searchStartTime}
- </if>
- <if test="searchEndTime != null">
- and rf.repair_start_time <![CDATA[<]]> #{searchEndTime}
- </if>
- <if test="type != null">
- and rf.type = #{type}
- </if>
- </where>
- </select>
- <!-- 修改派工维修单 -->
- <update id="updateForRepairDispatch" parameterType="com.platform.dao.entity.repair.RepairApplicationForm">
- update t_repair_application_form
- <set>
- repair_end_time = null,
- <if test="sbId != null">
- sb_id = #{sbId},
- </if>
- <if test="needStop != null">
- need_stop = #{needStop},
- </if>
- <if test="no != null">
- no = #{no},
- </if>
- <if test="source != null">
- source = #{source},
- </if>
- <if test="applyTime != null">
- apply_time = #{applyTime},
- </if>
- <if test="level != null">
- level = #{level},
- </if>
- <if test="content != null">
- content = #{content},
- </if>
- <if test="status != null">
- status= #{status},
- </if>
- <if test="repairStartTime != null">
- repair_start_time = #{repairStartTime},
- </if>
- <if test="repairDispatchList != null">
- repair_dispatch_list = #{repairDispatchList},
- </if>
- <if test="repairDispatchRemark != null">
- repair_dispatch_remark = #{repairDispatchRemark},
- </if>
- <if test="receiveMinutes != null">
- receive_minutes = #{receiveMinutes},
- </if>
- <if test="repairMinutes != null">
- repair_minutes = #{repairMinutes},
- </if>
- <if test="dealMinutes != null">
- deal_minutes = #{dealMinutes},
- </if>
- <if test="repairOvertime != null">
- repair_overtime = #{repairOvertime},
- </if>
- <if test="receiveOvertime != null">
- receive_overtime = #{receiveOvertime},
- </if>
- <if test="userId != null">
- user_id = #{userId},
- </if>
- <if test="repairUserId != null">
- repair_user_id = #{repairUserId},
- </if>
- <if test="checkUserId != null">
- check_user_id = #{checkUserId},
- </if>
- <if test="checkStartTime != null">
- check_start_time = #{checkStartTime},
- </if>
- <if test="checkContent != null">
- check_content = #{checkContent},
- </if>
- <if test="createdTime != null">
- created_time = #{createdTime},
- </if>
- <if test="updateTime != null">
- update_time = #{updateTime},
- </if>
- <if test="actualUser != null">
- actual_user = #{actualUser},
- </if>
- <if test="type != null">
- type = #{type},
- </if>
- <!--<if test="dispatchUserId">
- and dispatch_user_id = #{dispatchUserId}
- </if>-->
- </set>
- where id = #{id}
- </update>
- <select id="getRepairCount" resultType="com.platform.dao.vo.repair.RepairApplicationFormVO"
- parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
- >
- select status,count(1) as count from t_repair_application_form form
- <where>
- status in (1,2,4)
- <if test="repairUserId!=null">
- repair_user_id=#{repairUserId}
- </if>
- </where>
- group by status
- </select>
- </mapper>
|