OperatingHoursMapper.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.system.mapper.OperatingHoursMapper">
  6. <resultMap type="OperatingHours" id="OperatingHoursResult">
  7. <result property="id" column="id" />
  8. <result property="mdId" column="md_id" />
  9. <result property="startTime" column="start_time" />
  10. <result property="endTime" column="end_time" />
  11. <result property="dayOfWeek" column="day_of_week" />
  12. <result property="isOpen" column="is_open" />
  13. </resultMap>
  14. <sql id="selectOperatingHoursVo">
  15. select id, md_id, start_time, end_time, day_of_week, is_open from operating_hours
  16. </sql>
  17. <select id="selectOperatingHoursList" parameterType="OperatingHours" resultMap="OperatingHoursResult">
  18. <include refid="selectOperatingHoursVo"/>
  19. <where>
  20. <if test="id != null "> and id = #{id}</if>
  21. <if test="mdId != null "> and md_id = #{mdId}</if>
  22. <if test="dayOfWeek != null "> and day_of_week = #{dayOfWeek}</if>
  23. <if test="isOpen != null "> and is_open = #{isOpen}</if>
  24. </where>
  25. </select>
  26. <select id="selectOperatingHoursById" parameterType="Long" resultMap="OperatingHoursResult">
  27. <include refid="selectOperatingHoursVo"/>
  28. where id = #{id}
  29. </select>
  30. <insert id="insertOperatingHours" parameterType="OperatingHours" useGeneratedKeys="true" keyProperty="id">
  31. insert into operating_hours
  32. <trim prefix="(" suffix=")" suffixOverrides=",">
  33. <if test="mdId != null">md_id,</if>
  34. <if test="startTime != null">start_time,</if>
  35. <if test="endTime != null">end_time,</if>
  36. <if test="dayOfWeek != null">day_of_week,</if>
  37. <if test="isOpen != null">is_open,</if>
  38. </trim>
  39. <trim prefix="values (" suffix=")" suffixOverrides=",">
  40. <if test="mdId != null">#{mdId},</if>
  41. <if test="startTime != null">#{startTime},</if>
  42. <if test="endTime != null">#{endTime},</if>
  43. <if test="dayOfWeek != null">#{dayOfWeek},</if>
  44. <if test="isOpen != null">#{isOpen},</if>
  45. </trim>
  46. </insert>
  47. <update id="updateOperatingHours" parameterType="OperatingHours">
  48. update operating_hours
  49. <trim prefix="SET" suffixOverrides=",">
  50. <if test="mdId != null">md_id = #{mdId},</if>
  51. <if test="startTime != null">start_time = #{startTime},</if>
  52. <if test="endTime != null">end_time = #{endTime},</if>
  53. <if test="dayOfWeek != null">day_of_week = #{dayOfWeek},</if>
  54. <if test="isOpen != null">is_open = #{isOpen},</if>
  55. </trim>
  56. where id = #{id}
  57. </update>
  58. <delete id="deleteOperatingHoursById" parameterType="Long">
  59. delete from operating_hours where id = #{id}
  60. </delete>
  61. <delete id="deleteOperatingHoursByIds" parameterType="String">
  62. delete from operating_hours where id in
  63. <foreach item="id" collection="array" open="(" separator="," close=")">
  64. #{id}
  65. </foreach>
  66. </delete>
  67. </mapper>