OperatingHoursMapper.xml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. </resultMap>
  12. <sql id="selectOperatingHoursVo">
  13. select id, md_id, start_time, end_time from operating_hours
  14. </sql>
  15. <select id="selectOperatingHoursList" parameterType="OperatingHours" resultMap="OperatingHoursResult">
  16. <include refid="selectOperatingHoursVo"/>
  17. <where>
  18. <if test="id != null "> and id = #{id}</if>
  19. <if test="mdId != null "> and md_id = #{mdId}</if>
  20. </where>
  21. </select>
  22. <select id="selectOperatingHoursById" parameterType="Long" resultMap="OperatingHoursResult">
  23. <include refid="selectOperatingHoursVo"/>
  24. where id = #{id}
  25. </select>
  26. <insert id="insertOperatingHours" parameterType="OperatingHours" useGeneratedKeys="true" keyProperty="id">
  27. insert into operating_hours
  28. <trim prefix="(" suffix=")" suffixOverrides=",">
  29. <if test="mdId != null">md_id,</if>
  30. <if test="startTime != null">start_time,</if>
  31. <if test="endTime != null">end_time,</if>
  32. </trim>
  33. <trim prefix="values (" suffix=")" suffixOverrides=",">
  34. <if test="mdId != null">#{mdId},</if>
  35. <if test="startTime != null">#{startTime},</if>
  36. <if test="endTime != null">#{endTime},</if>
  37. </trim>
  38. </insert>
  39. <update id="updateOperatingHours" parameterType="OperatingHours">
  40. update operating_hours
  41. <trim prefix="SET" suffixOverrides=",">
  42. <if test="mdId != null">md_id = #{mdId},</if>
  43. <if test="startTime != null">start_time = #{startTime},</if>
  44. <if test="endTime != null">end_time = #{endTime},</if>
  45. </trim>
  46. where id = #{id}
  47. </update>
  48. <delete id="deleteOperatingHoursById" parameterType="Long">
  49. delete from operating_hours where id = #{id}
  50. </delete>
  51. <delete id="deleteOperatingHoursByIds" parameterType="String">
  52. delete from operating_hours where id in
  53. <foreach item="id" collection="array" open="(" separator="," close=")">
  54. #{id}
  55. </foreach>
  56. </delete>
  57. </mapper>