TBranchStudyMapper.xml 7.1 KB

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