EduTrainEnrollMapper.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.EduTrainEnrollMapper">
  4. <sql id="eduTrainEnrollColumns">
  5. a.id AS "id",
  6. a.plan_id AS "plan.id",
  7. a.train_office AS "trainOffice",
  8. a.train_names AS "trainNames",
  9. a.create_by AS "createBy.id",
  10. a.create_date AS "createDate",
  11. a.status AS "status",
  12. p.title AS "plan.title",
  13. u.name AS "createBy.name"
  14. </sql>
  15. <sql id="eduTrainEnrollJoins">
  16. left join edu_train_plan p on p.id = a.plan_id
  17. left join sys_user u on u.id = a.create_by
  18. </sql>
  19. <select id="get" resultType="EduTrainEnroll" >
  20. SELECT
  21. <include refid="eduTrainEnrollColumns"/>
  22. FROM edu_train_enroll a
  23. <include refid="eduTrainEnrollJoins"/>
  24. WHERE a.id = #{id}
  25. </select>
  26. <select id="findByPlan" resultType="EduTrainEnroll" >
  27. SELECT
  28. <include refid="eduTrainEnrollColumns"/>
  29. FROM edu_train_enroll a
  30. <include refid="eduTrainEnrollJoins"/>
  31. WHERE a.plan_id = #{planId} and a.create_by = #{userId}
  32. </select>
  33. <select id="findList" resultType="EduTrainEnroll" >
  34. SELECT
  35. <include refid="eduTrainEnrollColumns"/>
  36. FROM edu_train_enroll a
  37. <include refid="eduTrainEnrollJoins"/>
  38. <where>
  39. ${dataScope}
  40. <if test="trainOffice != null and trainOffice != ''">
  41. AND a.train_office = #{trainOffice}
  42. </if>
  43. <if test="trainNames != null and trainNames != ''">
  44. AND a.train_names LIKE
  45. <if test="dbName == 'oracle'">'%'||#{trainNames}||'%'</if>
  46. <if test="dbName == 'mssql'">'%'+#{trainNames}+'%'</if>
  47. <if test="dbName == 'mysql'">concat('%',#{trainNames},'%')</if>
  48. </if>
  49. <if test="status != null and status != ''">
  50. AND a.status = #{status}
  51. </if>
  52. </where>
  53. <choose>
  54. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  55. ORDER BY ${page.orderBy}
  56. </when>
  57. <otherwise>
  58. </otherwise>
  59. </choose>
  60. </select>
  61. <select id="findAllList" resultType="EduTrainEnroll" >
  62. SELECT
  63. <include refid="eduTrainEnrollColumns"/>
  64. FROM edu_train_enroll a
  65. <include refid="eduTrainEnrollJoins"/>
  66. <where>
  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. </otherwise>
  75. </choose>
  76. </select>
  77. <insert id="insert">
  78. INSERT INTO edu_train_enroll(
  79. id,
  80. train_office,
  81. train_names,
  82. create_by,
  83. create_date,
  84. status,
  85. plan_id
  86. ) VALUES (
  87. #{id},
  88. #{trainOffice},
  89. #{trainNames},
  90. #{createBy.id},
  91. #{createDate},
  92. #{status},
  93. #{plan.id}
  94. )
  95. </insert>
  96. <update id="update">
  97. UPDATE edu_train_enroll SET
  98. train_office = #{trainOffice},
  99. train_names = #{trainNames},
  100. status = #{status},
  101. plan_id = #{plan.id}
  102. WHERE id = #{id}
  103. </update>
  104. <!--物理删除-->
  105. <update id="delete">
  106. DELETE FROM edu_train_enroll
  107. WHERE id = #{id}
  108. </update>
  109. <!--逻辑删除-->
  110. <update id="deleteByLogic">
  111. UPDATE edu_train_enroll SET
  112. del_flag = #{DEL_FLAG_DELETE}
  113. WHERE id = #{id}
  114. </update>
  115. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  116. <select id="findUniqueByProperty" resultType="EduTrainEnroll" statementType="STATEMENT">
  117. select * FROM edu_train_enroll where ${propertyName} = '${value}'
  118. </select>
  119. </mapper>