RepairClassesSettingsMapper.xml 1.8 KB

123456789101112131415161718192021222324252627282930313233
  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="userName" column="user_name"/>
  9. <result property="startDate" column="start_date"/>
  10. <result property="shiftId" column="shift_id"/>
  11. <result property="shiftName" column="shift_name"/>
  12. <result property="shiftColor" column="shift_color"/>
  13. </resultMap>
  14. <select id="queryClassesSettingList" resultType="com.repair.model.vo.ClassesSettingVo" resultMap="repairClassesListMap">
  15. 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
  16. ,(select GROUP_CONCAT(color) from repair_shift_settings where find_in_set(id,rcs.shift_id) and deleted = 0) as shift_color
  17. FROM repair_classes_settings rcs
  18. <where>
  19. and rcs.deleted = 0
  20. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  21. and rcs.start_date BETWEEN #{startTime} and #{endTime}
  22. </if>
  23. <if test="userIds != null and userIds.size() > 0">
  24. and rcs.user_id in
  25. <foreach collection="userIds" item="userId" index="index" open="(" close=")" separator=",">
  26. ${userId}
  27. </foreach>
  28. </if>
  29. </where>
  30. </select>
  31. </mapper>