| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?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.repair.mapper.RepairClassesSettingsMapper">
- <!-- 可根据自己的需求,是否要使用 -->
- <resultMap type="com.repair.model.vo.ClassesSettingVo" id="repairClassesListMap">
- <result property="id" column="id"/>
- <result property="userId" column="user_id"/>
- <result property="startDate" column="start_date"/>
- <result property="shiftId" column="shift_id"/>
- <result property="shiftName" column="shift_name"/>
- <result property="shiftColor" column="shift_color"/>
- </resultMap>
- <select id="queryClassesSettingList" resultType="com.repair.model.vo.ClassesSettingVo" resultMap="repairClassesListMap">
- 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
- ,(select GROUP_CONCAT(color) from repair_shift_settings where find_in_set(id,rcs.shift_id) and deleted = 0) as shift_color
- FROM repair_classes_settings rcs
- <where>
- and rcs.deleted = 0
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and rcs.start_date BETWEEN #{startTime} and #{endTime}
- </if>
- <if test="userIds != null and userIds.size() > 0">
- and rcs.user_id in
- <foreach collection="userIds" item="userId" index="index" open="(" close=")" separator=",">
- ${userId}
- </foreach>
- </if>
- </where>
- </select>
- <resultMap type="com.repair.model.vo.ClassesDataVo" id="repairClassesDataMap">
- <result property="id" column="id"/>
- <result property="userId" column="user_id"/>
- <result property="shiftId" column="shift_id"/>
- <result property="shiftName" column="shift_name"/>
- <result property="shiftColor" column="shift_color"/>
- </resultMap>
- <select id="queryClassesDatas" resultType="com.repair.model.vo.ClassesDataVo" resultMap="repairClassesDataMap">
- 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
- FROM repair_classes_settings rcs
- <where>
- and rcs.deleted = 0
- <if test="startDate != null and startDate != ''">
- and rcs.start_date = CURRENT_DATE()
- </if>
- <if test="userIds != null and userIds.size() > 0">
- and rcs.user_id in
- <foreach collection="userIds" item="userId" index="index" open="(" close=")" separator=",">
- ${userId}
- </foreach>
- </if>
- </where>
- </select>
- <select id="queryClassesData" resultType="com.repair.model.vo.ClassesDataVo" resultMap="repairClassesDataMap">
- 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
- FROM repair_classes_settings rcs
- <where>
- and rcs.deleted = 0 and rcs.start_date = CURRENT_DATE()
- <if test="userId != null and userId != ''">
- and rcs.user_id = ${userId}
- </if>
- </where>
- </select>
- </mapper>
|