RepairCollaborateRecordMapper.xml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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.RepairCollaborateRecordMapper">
  4. <resultMap type="com.repair.model.vo.CollaborateRecordVo" id="repairCollaborateRecordMap">
  5. <result property="id" column="id"/>
  6. <result property="recordId" column="record_id"/>
  7. <result property="state" column="state"/>
  8. </resultMap>
  9. <select id="queryCollaborateRecordList" resultType="com.repair.model.vo.CollaborateRecordVo" resultMap="repairCollaborateRecordMap">
  10. select id,record_id,'转单' as state from repair_transfer_record
  11. <where>
  12. and deleted = 0 and approval_statu = 2
  13. <if test="recordIds != null and recordIds.size() > 0">
  14. and record_id in
  15. <foreach collection="recordIds" item="recordId" index="index" open="(" close=")" separator=",">
  16. ${recordId}
  17. </foreach>
  18. </if>
  19. </where>
  20. UNION ALL
  21. select id,record_id,'协作' as state from repair_collaborate_record
  22. <where>
  23. and deleted = 0 and approval_statu = 2
  24. <if test="recordIds != null and recordIds.size() > 0">
  25. and record_id in
  26. <foreach collection="recordIds" item="recordId" index="index" open="(" close=")" separator=",">
  27. ${recordId}
  28. </foreach>
  29. </if>
  30. </where>
  31. UNION ALL
  32. select id,record_id,'转线下' as state from repair_offline_record
  33. <where>
  34. and deleted = 0 and approval_statu = 2
  35. <if test="recordIds != null and recordIds.size() > 0">
  36. and record_id in
  37. <foreach collection="recordIds" item="recordId" index="index" open="(" close=")" separator=",">
  38. ${recordId}
  39. </foreach>
  40. </if>
  41. </where>
  42. </select>
  43. <resultMap type="com.repair.model.vo.CollaborateDetailVo" id="repairCollaborateDetailMap">
  44. <result property="id" column="id"/>
  45. <result property="userName" column="user_name"/>
  46. <result property="collaboratorName" column="collaborator_name"/>
  47. <result property="voice" column="voice"/>
  48. <result property="voiceLength" column="voice_length"/>
  49. <result property="remark" column="remark"/>
  50. </resultMap>
  51. <select id="queryCollaborateDetail" resultType="com.repair.model.vo.CollaborateDetailVo" resultMap="repairCollaborateDetailMap">
  52. select rcr.id,rcr.voice_length,rus.user_name,GROUP_CONCAT(CONCAT(ru.id,'-',ru.user_name)) as collaborator_name,rcr.voice,rcr.remark from repair_collaborate_record rcr
  53. left join repair_user ru on ru.deleted = 0 and find_in_set(ru.id,rcr.collaborator)
  54. left join repair_user rus on rus.deleted = 0 and rus.id = rcr.user_id
  55. where rcr.deleted = 0 and rcr.approval_statu = 2 and rcr.record_id = #{recordId}
  56. group by rcr.id
  57. </select>
  58. </mapper>