123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394 |
- <?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.username 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.dispatch_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 != ''">
- 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>
- <if test="repairDeptId != null and repairDeptId != ''">
- and application.repair_dept_id = #{repairDeptId}
- </if>
- <if test="reportLeaderId != null and reportLeaderId != ''">
- and application.report_leader_id = #{reportLeaderId}
- </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.dispatch_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) repairCount from t_repair_application_form form left JOIN t_sys_user_dept dept ON
- dept.user_id=form.repair_user_id
- <where>
- <if test="statusList != null and statusList.size > 0">
- AND form.status in
- <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="userId!=null and userId!=''">
- and form.user_id=#{userId}
- </if>
- <if test="repairUserId!=null and repairUserId!=''">
- and form.repair_user_id=#{repairUserId}
- </if>
- <if test="dispatchUserId!=null and dispatchUserId!=''">
- and form.dispatch_user_id=#{dispatchUserId}
- </if>
- <if test="deptId!=null and deptId!=null">
- and dept.dept_id=#{deptId}
- </if>
- </where>
- group by status
- </select>
- <update id="updateLongYan" parameterType="com.platform.dao.entity.repair.RepairApplicationForm">
- update t_repair_application_form
- <set>
- <choose>
- <when test="repairUserId != null">
- repair_user_id = #{repairUserId},
- </when>
- <otherwise>
- repair_user_id = null,
- </otherwise>
- </choose>
- <choose>
- <when test="repairUseName != null">
- repair_user_name = #{repairUseName},
- </when>
- <otherwise>
- repair_user_name = null,
- </otherwise>
- </choose>
- <if test="remark != null">
- remark = #{remark},
- </if>
- <if test="remarkTwo != null">
- remark_two = #{remarkTwo},
- </if>
- <if test="status != null">
- status = #{status},
- </if>
- <if test="repairMinutes != null">
- repair_minutes = #{repairMinutes},
- </if>
- <if test="dispatchUserId != null">
- dispatch_user_id = #{dispatchUserId},
- </if>
- </set>
- where id = #{id}
- </update>
- <select id="getDeptName" parameterType="String"
- resultType="String">
- select name from t_sys_dept
- where dept_id=#{id}
- </select>
- <select id="getFirstRepairApplicationFormVO" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
- resultType="com.platform.dao.vo.repair.RepairApplicationFormVO">
- select form.*,info.name sbName,info.cph sbCph,info.no sbNo from t_repair_application_form form left join t_sb_info info
- on form.sb_id=info.id
- <where>
- <if test="userId!=null and userId!=''">
- and form.user_id=#{userId}
- </if>
- <if test="repairUserId!=null and repairUserId!=''">
- and form.repair_user_id=#{repairUserId}
- </if>
- <if test="dispatchUserId!=null and dispatchUserId!=''">
- and form.dispatch_user_id=#{dispatchUserId}
- </if>
- </where>
- order by form.update_time desc
- limit 1
- </select>
- <select id="getRepairCount1" parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
- resultType="BigDecimal">
- select count(*) from t_repair_application_form form
- <where>
- <if test="statusList != null and statusList.size > 0">
- AND form.status in
- <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="userId!=null and userId!=''">
- and form.user_id=#{userId}
- </if>
- <if test="repairUserId!=null and repairUserId!=''">
- and form.repair_user_id=#{repairUserId}
- </if>
- <if test="dispatchUserId!=null and dispatchUserId!=''">
- and form.dispatch_user_id=#{dispatchUserId}
- </if>
- <if test="status!=null and status!=null">
- and form.status=#{status}
- </if>
- </where>
- </select>
- </mapper>
|