RepairUserMapper.xml 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.repair.mapper.RepairUserMapper">
  4. <resultMap type="com.repair.model.vo.RepairUserVo" id="repairUserPageMap">
  5. <result property="id" column="id"/>
  6. <result property="cardNumber" column="card_number"/>
  7. <result property="userName" column="user_name"/>
  8. <result property="userPhone" column="user_phone"/>
  9. <result property="teamId" column="team_id"/>
  10. <result property="teamName" column="team_name"/>
  11. <result property="schoolId" column="school_id"/>
  12. <result property="schoolName" column="school_name"/>
  13. <result property="userZzid" column="user_zzid"/>
  14. <result property="userZzname" column="user_zzname"/>
  15. <result property="buildId" column="build_id"/>
  16. <result property="buildName" column="build_name"/>
  17. <result property="articleId" column="article_id"/>
  18. <result property="articleName" column="article_name"/>
  19. <result property="workType" column="work_type"/>
  20. <result property="workTypeName" column="work_type_name"/>
  21. <result property="acceptanceTime" column="acceptance_assess_time"/>
  22. <result property="maintenanceTime" column="maintenance_assess_time"/>
  23. </resultMap>
  24. <select id="queryUserPageList" resultType="com.repair.model.vo.RepairUserVo" resultMap="repairUserPageMap">
  25. select ru.card_number,ru.acceptance_assess_time,ru.maintenance_assess_time,ru.id,ru.article_id,(select GROUP_CONCAT(name) from repair_article_type where find_in_set(id,ru.article_id)) as article_name,ru.user_name, ru.user_phone, ru.team_id, case ru.team_id when 0 then '校方人员' else '第三方人员' end as team_name, ru.school_id,ra.name as school_name,
  26. ru.user_zzid,case ru.user_zzid when 3 then '后勤人员' else '维修师傅' end as user_zzname,ru.build_id,(select GROUP_CONCAT(name) from repair_area where find_in_set(id,ru.build_id)) as build_name,ru.work_type,rwt.name as work_type_name from repair_user ru
  27. left join repair_area ra on ra.id = ru.school_id and ra.deleted = 0
  28. left join repair_work_type rwt on rwt.id = ru.work_type and ra.deleted = 0
  29. <where>
  30. and ru.deleted = 0 and (ru.user_zzid = 1 or ru.user_zzid = 2 or ru.user_zzid = 3)
  31. <if test="schoolId != null and schoolId != ''">
  32. and ru.school_id = ${schoolId}
  33. </if>
  34. <if test="teamId != null and teamId != ''">
  35. and ru.team_id = ${teamId}
  36. </if>
  37. <if test="keyWord != null and keyWord != ''">
  38. and (ru.user_name like '%' #{keyWord} '%' or ru.user_phone like '%' #{keyWord} '%')
  39. </if>
  40. </where>
  41. </select>
  42. <resultMap type="com.repair.model.vo.RepairLogisticsVo" id="repairLogisticsMap">
  43. <result property="id" column="id"/>
  44. </resultMap>
  45. <select id="queryLogisticsList" resultType="com.repair.model.vo.RepairLogisticsVo" resultMap="repairLogisticsMap">
  46. select id from repair_user ru
  47. where EXISTS (select id from repair_record where deleted = 0 and id = #{recordId} and school_id = ru.school_id)
  48. and ru.user_zzid = 3 and ru.deleted = 0
  49. </select>
  50. <resultMap type="com.repair.model.vo.UserDataVo" id="userDataMap">
  51. <result property="id" column="id"/>
  52. <result property="state" column="state"/>
  53. <result property="shiftId" column="shift_id"/>
  54. <result property="userName" column="user_name"/>
  55. <result property="userPhone" column="user_phone"/>
  56. <result property="startDate" column="start_date"/>
  57. <result property="articleId" column="article_id"/>
  58. <result property="acceptanceAssessTime" column="acceptance_assess_time"/>
  59. <result property="maintenanceAssessTime" column="maintenance_assess_time"/>
  60. </resultMap>
  61. <select id="queryUserData" resultType="com.repair.model.vo.UserDataVo" resultMap="userDataMap">
  62. select ru.user_phone,ru.acceptance_assess_time,ru.maintenance_assess_time,ru.state,ru.id,ru.user_name,rcs.start_date,rcs.shift_id,GROUP_CONCAT(rat.id) as article_id from repair_user ru
  63. left join repair_classes_settings rcs on rcs.deleted = 0 and rcs.user_id = #{userId} and start_date = #{dateNow}
  64. left join repair_article_type rat on rat.deleted = 0 and ( FIND_IN_SET(rat.id,ru.article_id) or FIND_IN_SET(rat.parent_id,ru.article_id))
  65. where ru.id = #{userId} and ru.deleted = 0
  66. </select>
  67. </mapper>