RepairClassesSettingsMapper.xml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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.RepairClassesSettingsMapper">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.repair.model.vo.ClassesSettingVo" id="repairClassesListMap">
  6. <result property="id" column="id"/>
  7. <result property="userId" column="user_id"/>
  8. <result property="startDate" column="start_date"/>
  9. <result property="shiftId" column="shift_id"/>
  10. <result property="shiftName" column="shift_name"/>
  11. <result property="shiftColor" column="shift_color"/>
  12. </resultMap>
  13. <select id="queryClassesSettingList" resultType="com.repair.model.vo.ClassesSettingVo" resultMap="repairClassesListMap">
  14. SELECT rcs.id,rcs.user_id,rcs.start_date,rcs.shift_id,(select GROUP_CONCAT(name) from repair_shift_settings where find_in_set(id,rcs.shift_id) and deleted = 0) as shift_name
  15. ,(select GROUP_CONCAT(color) from repair_shift_settings where find_in_set(id,rcs.shift_id) and deleted = 0) as shift_color
  16. FROM repair_classes_settings rcs
  17. <where>
  18. and rcs.deleted = 0
  19. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  20. and rcs.start_date BETWEEN #{startTime} and #{endTime}
  21. </if>
  22. <if test="userIds != null and userIds.size() > 0">
  23. and rcs.user_id in
  24. <foreach collection="userIds" item="userId" index="index" open="(" close=")" separator=",">
  25. ${userId}
  26. </foreach>
  27. </if>
  28. </where>
  29. </select>
  30. <resultMap type="com.repair.model.vo.ClassesDataVo" id="repairClassesDataMap">
  31. <result property="id" column="id"/>
  32. <result property="userId" column="user_id"/>
  33. <result property="shiftId" column="shift_id"/>
  34. <result property="shiftName" column="shift_name"/>
  35. <result property="shiftColor" column="shift_color"/>
  36. </resultMap>
  37. <select id="queryClassesDatas" resultType="com.repair.model.vo.ClassesDataVo" resultMap="repairClassesDataMap">
  38. SELECT rcs.id,rcs.user_id,rcs.shift_id,(select GROUP_CONCAT(name) from repair_shift_settings where find_in_set(id,rcs.shift_id) and deleted = 0) as shift_name
  39. FROM repair_classes_settings rcs
  40. <where>
  41. and rcs.deleted = 0
  42. <if test="startDate != null and startDate != ''">
  43. and rcs.start_date = CURRENT_DATE()
  44. </if>
  45. <if test="userIds != null and userIds.size() > 0">
  46. and rcs.user_id in
  47. <foreach collection="userIds" item="userId" index="index" open="(" close=")" separator=",">
  48. ${userId}
  49. </foreach>
  50. </if>
  51. </where>
  52. </select>
  53. <select id="queryClassesData" resultType="com.repair.model.vo.ClassesDataVo" resultMap="repairClassesDataMap">
  54. SELECT rcs.id,rcs.user_id,rcs.shift_id,(select GROUP_CONCAT(name) from repair_shift_settings where find_in_set(id,rcs.shift_id) and deleted = 0) as shift_name
  55. FROM repair_classes_settings rcs
  56. <where>
  57. and rcs.deleted = 0 and rcs.start_date = CURRENT_DATE()
  58. <if test="userId != null and userId != ''">
  59. and rcs.user_id = ${userId}
  60. </if>
  61. </where>
  62. </select>
  63. </mapper>