OrganizationCourseDurationSettingsMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. <!-- 这个文件是自动生成的。 不要修改此文件。所有改动将在下次重新自动生成时丢失。 -->
  4. <mapper namespace="com.ym.mec.biz.dal.dao.OrganizationCourseDurationSettingsDao">
  5. <resultMap type="com.ym.mec.biz.dal.entity.OrganizationCourseDurationSettings"
  6. id="OrganizationCourseDurationSettings">
  7. <result column="id_" property="id"/>
  8. <result column="organ_id_" property="organId"/>
  9. <result column="course_type_" property="courseType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  10. <result column="duration_" property="duration"/>
  11. <result column="create_time_" property="createTime"/>
  12. <result column="update_time_" property="updateTime"/>
  13. <result column="organ_name_" property="organ.name"/>
  14. </resultMap>
  15. <!-- 根据主键查询一条记录 -->
  16. <select id="get" resultMap="OrganizationCourseDurationSettings">
  17. SELECT *
  18. FROM organization_course_duration_settings
  19. WHERE id_ = #{id}
  20. </select>
  21. <!-- 全查询 -->
  22. <select id="findAll" resultMap="OrganizationCourseDurationSettings">
  23. SELECT *
  24. FROM organization_course_duration_settings
  25. ORDER BY id_
  26. </select>
  27. <!-- 向数据库增加一条记录 -->
  28. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.OrganizationCourseDurationSettings"
  29. useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  30. <!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval
  31. AS ID FROM DUAL </selectKey> -->
  32. INSERT INTO organization_course_duration_settings
  33. (id_,organ_id_,course_type_,duration_,create_time_,update_time_)
  34. VALUES(#{id},#{organId},#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{duration},now(),now())
  35. </insert>
  36. <!-- 根据主键查询一条记录 -->
  37. <update id="update" parameterType="com.ym.mec.biz.dal.entity.OrganizationCourseDurationSettings">
  38. UPDATE organization_course_duration_settings
  39. <set>
  40. <if test="organId != null">
  41. organ_id_ = #{organId},
  42. </if>
  43. <if test="id != null">
  44. id_ = #{id},
  45. </if>
  46. <if test="courseType != null">
  47. course_type_ = #{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  48. </if>
  49. <if test="duration != null">
  50. duration_ = #{duration},
  51. </if>
  52. <if test="createTime != null">
  53. create_time_ = #{createTime},
  54. </if>
  55. <if test="updateTime != null">
  56. update_time_ = #{updateTime},
  57. </if>
  58. </set>
  59. WHERE id_ = #{id}
  60. </update>
  61. <!-- 根据主键删除一条记录 -->
  62. <delete id="delete">
  63. DELETE
  64. FROM organization_course_duration_settings
  65. WHERE id_ = #{id}
  66. </delete>
  67. <!-- 分页查询 -->
  68. <select id="queryPage" resultMap="OrganizationCourseDurationSettings" parameterType="map">
  69. SELECT ocds.*,o.name_ organ_name_ FROM organization_course_duration_settings ocds
  70. LEFT JOIN organization o on ocds.organ_id_ = o.id_
  71. <where>
  72. <if test="organId != null">
  73. and ocds.organ_id_ = #{organId}
  74. </if>
  75. <if test="courseScheduleType != null">
  76. and ocds.course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  77. </if>
  78. </where>
  79. ORDER BY ocds.id_ desc
  80. <include refid="global.limit"/>
  81. </select>
  82. <!-- 查询当前表的总记录数 -->
  83. <select id="queryCount" resultType="int">
  84. SELECT COUNT(ups.id_) FROM organization_course_duration_settings ups
  85. <where>
  86. <if test="organId != null">
  87. and ups.organ_id_ = #{organId}
  88. </if>
  89. <if test="courseScheduleType != null">
  90. and ups.course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  91. </if>
  92. </where>
  93. </select>
  94. <select id="queryByOrganIdAndCourseType" resultMap="OrganizationCourseDurationSettings" parameterType="map">
  95. SELECT *
  96. FROM organization_course_duration_settings
  97. WHERE organ_id_ = #{organId}
  98. AND course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  99. </select>
  100. <select id="queryByOrganId" resultMap="OrganizationCourseDurationSettings">
  101. SELECT *
  102. FROM organization_course_duration_settings
  103. WHERE organ_id_ = #{organId}
  104. </select>
  105. </mapper>