TBranchStudyMapper.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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.branch.mapper.TBranchStudyMapper">
  6. <resultMap type="TBranchStudy" id="TBranchStudyResult">
  7. <result property="studyId" column="study_id" />
  8. <result property="studyTime" column="study_time" />
  9. <result property="studyVenue" column="study_venue" />
  10. <result property="lecturer" column="lecturer" />
  11. <result property="recorder" column="recorder" />
  12. <result property="participants" column="participants" />
  13. <result property="absentees" column="absentees" />
  14. <result property="contents" column="contents" />
  15. <result property="remarks" column="remarks" />
  16. <result property="delFlag" column="del_flag" />
  17. <result property="createBy" column="create_by" />
  18. <result property="createTime" column="create_time" />
  19. <result property="updateBy" column="update_by" />
  20. <result property="updateTime" column="update_time" />
  21. <result property="deptId" column="dept_id" />
  22. <result property="filesId" column="files_id" />
  23. </resultMap>
  24. <sql id="selectTBranchStudyVo">
  25. select
  26. u.study_id,
  27. u.study_time,
  28. u.study_venue,
  29. u.lecturer,
  30. u.recorder,
  31. u.participants,
  32. u.absentees,
  33. u.contents,
  34. u.remarks,
  35. u.del_flag,
  36. u.create_by,
  37. u.create_time,
  38. u.update_by,
  39. u.update_time,
  40. u.dept_id,
  41. u.files_id
  42. from t_branch_study u
  43. left join sys_dept d on u.dept_id = d.dept_id
  44. </sql>
  45. <select id="selectTBranchStudyList" parameterType="TBranchStudy" resultMap="TBranchStudyResult">
  46. <include refid="selectTBranchStudyVo"/>
  47. <where>
  48. <if test="studyId != null "> and u.study_id = #{studyId}</if>
  49. <if test="studyTime != null "> and u.study_time = #{studyTime}</if>
  50. <if test="studyVenue != null and studyVenue != ''"> and u.study_venue = #{studyVenue}</if>
  51. <if test="lecturer != null and lecturer != ''"> and u.lecturer = #{lecturer}</if>
  52. <if test="recorder != null and recorder != ''"> and u.recorder = #{recorder}</if>
  53. <if test="participants != null and participants != ''"> and u.participants = #{participants}</if>
  54. <if test="absentees != null and absentees != ''"> and u.absentees = #{absentees}</if>
  55. <if test="contents != null and contents != ''"> and u.contents = #{contents}</if>
  56. <if test="remarks != null and remarks != ''"> and u.remarks = #{remarks}</if>
  57. <if test="deptId != null and deptId != 0">
  58. AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) <![CDATA[ <> ]]> 0 )))
  59. </if>
  60. and u.del_flag = 0
  61. </where>
  62. <!-- 数据范围过滤 -->
  63. ${params.dataScope}
  64. </select>
  65. <select id="selectTBranchStudyByStudyId" parameterType="Long" resultMap="TBranchStudyResult">
  66. <include refid="selectTBranchStudyVo"/>
  67. where u.study_id = #{studyId}
  68. and u.del_flag = 0
  69. </select>
  70. <insert id="insertTBranchStudy" parameterType="TBranchStudy">
  71. <selectKey keyProperty="studyId" resultType="long" order="BEFORE">
  72. SELECT seq_t_branch_study.NEXTVAL as studyId FROM DUAL
  73. </selectKey>
  74. insert into t_branch_study
  75. <trim prefix="(" suffix=")" suffixOverrides=",">
  76. <if test="studyId != null">study_id,</if>
  77. <if test="studyTime != null">study_time,</if>
  78. <if test="studyVenue != null">study_venue,</if>
  79. <if test="lecturer != null">lecturer,</if>
  80. <if test="recorder != null">recorder,</if>
  81. <if test="participants != null">participants,</if>
  82. <if test="absentees != null">absentees,</if>
  83. <if test="contents != null">contents,</if>
  84. <if test="remarks != null">remarks,</if>
  85. <if test="delFlag != null">del_flag,</if>
  86. <if test="createBy != null">create_by,</if>
  87. <if test="createTime != null">create_time,</if>
  88. <if test="updateBy != null">update_by,</if>
  89. <if test="updateTime != null">update_time,</if>
  90. <if test="deptId != null and deptId != 0">dept_id,</if>
  91. <if test="filesId != null">files_id,</if>
  92. </trim>
  93. <trim prefix="values (" suffix=")" suffixOverrides=",">
  94. <if test="studyId != null">#{studyId},</if>
  95. <if test="studyTime != null">#{studyTime},</if>
  96. <if test="studyVenue != null">#{studyVenue},</if>
  97. <if test="lecturer != null">#{lecturer},</if>
  98. <if test="recorder != null">#{recorder},</if>
  99. <if test="participants != null">#{participants},</if>
  100. <if test="absentees != null">#{absentees},</if>
  101. <if test="contents != null">#{contents},</if>
  102. <if test="remarks != null">#{remarks},</if>
  103. <if test="delFlag != null">#{delFlag},</if>
  104. <if test="createBy != null">#{createBy},</if>
  105. <if test="createTime != null">#{createTime},</if>
  106. <if test="updateBy != null">#{updateBy},</if>
  107. <if test="updateTime != null">#{updateTime},</if>
  108. <if test="deptId != null and deptId != ''">#{deptId},</if>
  109. <if test="filesId != null">#{filesId},</if>
  110. </trim>
  111. </insert>
  112. <update id="updateTBranchStudy" parameterType="TBranchStudy">
  113. update t_branch_study
  114. <trim prefix="SET" suffixOverrides=",">
  115. <if test="studyTime != null">study_time = #{studyTime},</if>
  116. <if test="studyVenue != null">study_venue = #{studyVenue},</if>
  117. <if test="lecturer != null">lecturer = #{lecturer},</if>
  118. <if test="recorder != null">recorder = #{recorder},</if>
  119. <if test="participants != null">participants = #{participants},</if>
  120. <if test="absentees != null">absentees = #{absentees},</if>
  121. <if test="contents != null">contents = #{contents},</if>
  122. <if test="remarks != null">remarks = #{remarks},</if>
  123. <if test="delFlag != null">del_flag = #{delFlag},</if>
  124. <if test="createBy != null">create_by = #{createBy},</if>
  125. <if test="createTime != null">create_time = #{createTime},</if>
  126. <if test="updateBy != null">update_by = #{updateBy},</if>
  127. <if test="updateTime != null">update_time = #{updateTime},</if>
  128. <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
  129. <if test="filesId != null">files_id = #{filesId},</if>
  130. </trim>
  131. where study_id = #{studyId}
  132. </update>
  133. <update id="deleteTBranchStudyByStudyId" parameterType="Long">
  134. update t_branch_study set del_flag = 2 where study_id = #{studyId}
  135. </update>
  136. <update id="deleteTBranchStudyByStudyIds" parameterType="String">
  137. update t_branch_study set del_flag = 2 where study_id in
  138. <foreach item="studyId" collection="array" open="(" separator="," close=")">
  139. #{studyId}
  140. </foreach>
  141. </update>
  142. </mapper>