TrainingSnapshotMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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.project.training.mapper.TrainingSnapshotMapper">
  6. <resultMap type="TrainingSnapshot" id="TrainingSnapshotResult">
  7. <result property="id" column="ID" />
  8. <result property="snapshotName" column="SNAPSHOT_NAME" />
  9. <result property="description" column="DESCRIPTION" />
  10. <result property="snapshotYear" column="SNAPSHOT_YEAR" />
  11. <result property="trainingType" column="TRAINING_TYPE" />
  12. <result property="snapshotData" column="SNAPSHOT_DATA" />
  13. <result property="queryParams" column="QUERY_PARAMS" />
  14. <result property="createrCode" column="CREATER_CODE" />
  15. <result property="createdate" column="CREATEDATE" />
  16. <result property="updaterCode" column="UPDATER_CODE" />
  17. <result property="updatedate" column="UPDATEDATE" />
  18. <result property="delFlag" column="DEL_FLAG" />
  19. </resultMap>
  20. <sql id="selectTrainingSnapshotVo">
  21. select ID, SNAPSHOT_NAME, DESCRIPTION, SNAPSHOT_YEAR, TRAINING_TYPE, SNAPSHOT_DATA, QUERY_PARAMS, CREATER_CODE, CREATEDATE, UPDATER_CODE, UPDATEDATE, DEL_FLAG from t_training_snapshot
  22. </sql>
  23. <select id="selectTrainingSnapshotList" parameterType="TrainingSnapshot" resultMap="TrainingSnapshotResult">
  24. <include refid="selectTrainingSnapshotVo"/>
  25. <where>
  26. <if test="snapshotName != null and snapshotName != ''"> and SNAPSHOT_NAME like '%' || #{snapshotName} || '%'</if>
  27. <if test="snapshotYear != null and snapshotYear != ''"> and SNAPSHOT_YEAR = #{snapshotYear}</if>
  28. <if test="trainingType != null and trainingType != ''"> and TRAINING_TYPE = #{trainingType}</if>
  29. and DEL_FLAG = 0
  30. </where>
  31. order by CREATEDATE desc
  32. </select>
  33. <select id="selectTrainingSnapshotById" parameterType="Long" resultMap="TrainingSnapshotResult">
  34. <include refid="selectTrainingSnapshotVo"/>
  35. where ID = #{id}
  36. </select>
  37. <select id="selectTrainingSnapshotByYearAndType" resultMap="TrainingSnapshotResult">
  38. SELECT * FROM (
  39. <include refid="selectTrainingSnapshotVo"/>
  40. where SNAPSHOT_YEAR = #{snapshotYear} and TRAINING_TYPE = #{trainingType} and DEL_FLAG = 0
  41. order by CREATEDATE desc
  42. ) WHERE ROWNUM = 1
  43. </select>
  44. <select id="selectTrainingSnapshotByYear" resultMap="TrainingSnapshotResult">
  45. SELECT * FROM (
  46. <include refid="selectTrainingSnapshotVo"/>
  47. where SNAPSHOT_YEAR = #{snapshotYear} and DEL_FLAG = 0
  48. order by CREATEDATE desc
  49. ) WHERE ROWNUM = 1
  50. </select>
  51. <insert id="insertTrainingSnapshot" parameterType="TrainingSnapshot">
  52. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  53. SELECT seq_t_training_snapshot.NEXTVAL as id FROM DUAL
  54. </selectKey>
  55. insert into t_training_snapshot
  56. <trim prefix="(" suffix=")" suffixOverrides=",">
  57. <if test="id != null">ID,</if>
  58. <if test="snapshotName != null">SNAPSHOT_NAME,</if>
  59. <if test="description != null">DESCRIPTION,</if>
  60. <if test="snapshotYear != null">SNAPSHOT_YEAR,</if>
  61. <if test="trainingType != null">TRAINING_TYPE,</if>
  62. <if test="snapshotData != null">SNAPSHOT_DATA,</if>
  63. <if test="queryParams != null">QUERY_PARAMS,</if>
  64. <if test="createrCode != null">CREATER_CODE,</if>
  65. <if test="createdate != null">CREATEDATE,</if>
  66. <if test="updaterCode != null">UPDATER_CODE,</if>
  67. <if test="updatedate != null">UPDATEDATE,</if>
  68. <if test="delFlag != null">DEL_FLAG,</if>
  69. </trim>
  70. <trim prefix="values (" suffix=")" suffixOverrides=",">
  71. <if test="id != null">#{id},</if>
  72. <if test="snapshotName != null">#{snapshotName},</if>
  73. <if test="description != null">#{description},</if>
  74. <if test="snapshotYear != null">#{snapshotYear},</if>
  75. <if test="trainingType != null">#{trainingType},</if>
  76. <if test="snapshotData != null">#{snapshotData},</if>
  77. <if test="queryParams != null">#{queryParams},</if>
  78. <if test="createrCode != null">#{createrCode},</if>
  79. <if test="createdate != null">#{createdate},</if>
  80. <if test="updaterCode != null">#{updaterCode},</if>
  81. <if test="updatedate != null">#{updatedate},</if>
  82. <if test="delFlag != null">#{delFlag},</if>
  83. </trim>
  84. </insert>
  85. <update id="updateTrainingSnapshot" parameterType="TrainingSnapshot">
  86. update t_training_snapshot
  87. <trim prefix="SET" suffixOverrides=",">
  88. <if test="snapshotName != null">SNAPSHOT_NAME = #{snapshotName},</if>
  89. <if test="description != null">DESCRIPTION = #{description},</if>
  90. <if test="snapshotYear != null">SNAPSHOT_YEAR = #{snapshotYear},</if>
  91. <if test="trainingType != null">TRAINING_TYPE = #{trainingType},</if>
  92. <if test="snapshotData != null">SNAPSHOT_DATA = #{snapshotData},</if>
  93. <if test="queryParams != null">QUERY_PARAMS = #{queryParams},</if>
  94. <if test="updaterCode != null">UPDATER_CODE = #{updaterCode},</if>
  95. <if test="updatedate != null">UPDATEDATE = #{updatedate},</if>
  96. <if test="delFlag != null">DEL_FLAG = #{delFlag},</if>
  97. </trim>
  98. where ID = #{id}
  99. </update>
  100. <delete id="deleteTrainingSnapshotById" parameterType="Long">
  101. update t_training_snapshot set DEL_FLAG = 2 where ID = #{id}
  102. </delete>
  103. <delete id="deleteTrainingSnapshotByIds" parameterType="String">
  104. update t_training_snapshot set DEL_FLAG = 2 where ID in
  105. <foreach item="id" collection="array" open="(" separator="," close=")">
  106. #{id}
  107. </foreach>
  108. </delete>
  109. </mapper>