EduTrainTeacherMapper.xml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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.jeeplus.modules.train.mapper.EduTrainTeacherMapper">
  4. <sql id="eduTrainTeacherColumns">
  5. a.id AS "id",
  6. a.name AS "name",
  7. a.age AS "age",
  8. a.major AS "major",
  9. a.unit AS "unit",
  10. a.expert AS "expert",
  11. a.experience AS "experience",
  12. a.create_by AS "createBy.id",
  13. a.create_date AS "createDate",
  14. a.update_by AS "updateBy.id",
  15. a.update_date AS "updateDate",
  16. a.del_flag AS "delFlag"
  17. </sql>
  18. <sql id="eduTrainTeacherJoins">
  19. </sql>
  20. <select id="get" resultType="EduTrainTeacher" >
  21. SELECT
  22. <include refid="eduTrainTeacherColumns"/>
  23. FROM edu_train_teacher a
  24. <include refid="eduTrainTeacherJoins"/>
  25. WHERE a.id = #{id}
  26. </select>
  27. <select id="findList" resultType="EduTrainTeacher" >
  28. SELECT
  29. <include refid="eduTrainTeacherColumns"/>
  30. FROM edu_train_teacher a
  31. <include refid="eduTrainTeacherJoins"/>
  32. <where>
  33. a.del_flag = #{DEL_FLAG_NORMAL}
  34. ${dataScope}
  35. <if test="name != null and name != ''">
  36. AND a.name LIKE
  37. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  38. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  39. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  40. </if>
  41. <if test="major != null and major != ''">
  42. AND a.major LIKE
  43. <if test="dbName == 'oracle'">'%'||#{major}||'%'</if>
  44. <if test="dbName == 'mssql'">'%'+#{major}+'%'</if>
  45. <if test="dbName == 'mysql'">concat('%',#{major},'%')</if>
  46. </if>
  47. <if test="unit != null and unit != ''">
  48. AND a.unit = #{unit}
  49. </if>
  50. </where>
  51. <choose>
  52. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  53. ORDER BY ${page.orderBy}
  54. </when>
  55. <otherwise>
  56. ORDER BY a.update_date DESC
  57. </otherwise>
  58. </choose>
  59. </select>
  60. <select id="findAllList" resultType="EduTrainTeacher" >
  61. SELECT
  62. <include refid="eduTrainTeacherColumns"/>
  63. FROM edu_train_teacher a
  64. <include refid="eduTrainTeacherJoins"/>
  65. <where>
  66. a.del_flag = #{DEL_FLAG_NORMAL}
  67. ${dataScope}
  68. </where>
  69. <choose>
  70. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  71. ORDER BY ${page.orderBy}
  72. </when>
  73. <otherwise>
  74. ORDER BY a.update_date DESC
  75. </otherwise>
  76. </choose>
  77. </select>
  78. <insert id="insert">
  79. INSERT INTO edu_train_teacher(
  80. id,
  81. name,
  82. age,
  83. major,
  84. unit,
  85. expert,
  86. experience,
  87. create_by,
  88. create_date,
  89. update_by,
  90. update_date,
  91. del_flag
  92. ) VALUES (
  93. #{id},
  94. #{name},
  95. #{age},
  96. #{major},
  97. #{unit},
  98. #{expert},
  99. #{experience},
  100. #{createBy.id},
  101. #{createDate},
  102. #{updateBy.id},
  103. #{updateDate},
  104. #{delFlag}
  105. )
  106. </insert>
  107. <update id="update">
  108. UPDATE edu_train_teacher SET
  109. name = #{name},
  110. age = #{age},
  111. major = #{major},
  112. unit = #{unit},
  113. expert = #{expert},
  114. experience = #{experience},
  115. update_by = #{updateBy.id},
  116. update_date = #{updateDate}
  117. WHERE id = #{id}
  118. </update>
  119. <!--物理删除-->
  120. <update id="delete">
  121. DELETE FROM edu_train_teacher
  122. WHERE id = #{id}
  123. </update>
  124. <!--逻辑删除-->
  125. <update id="deleteByLogic">
  126. UPDATE edu_train_teacher SET
  127. del_flag = #{DEL_FLAG_DELETE}
  128. WHERE id = #{id}
  129. </update>
  130. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  131. <select id="findUniqueByProperty" resultType="EduTrainTeacher" statementType="STATEMENT">
  132. select * FROM edu_train_teacher where ${propertyName} = '${value}'
  133. </select>
  134. </mapper>