BisInspMeetDiscussDao.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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="cn.com.goldenwater.dcproj.dao.BisInspMeetDiscussDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspMeetDiscuss" id="bisInspMeetDiscussResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="disNm" column="DIS_NM"/>
  7. <result property="persId" column="PERS_ID"/>
  8. <result property="persName" column="PERS_NAME"/>
  9. <result property="orgId" column="ORG_ID"/>
  10. <result property="orgNm" column="ORG_NM"/>
  11. <result property="intm" column="INTM"/>
  12. <result property="uptm" column="UPTM"/>
  13. <result property="flagValid" column="FLAG_VALID"/>
  14. <result property="meetingNumber" column="MEETING_NUMBER"/>
  15. </resultMap>
  16. <sql id="table_columns">
  17. ID,
  18. DIS_NM,
  19. PERS_ID,
  20. PERS_NAME,
  21. ORG_ID,
  22. ORG_NM,
  23. INTM,
  24. UPTM,
  25. FLAG_VALID,
  26. MEETING_NUMBER
  27. </sql>
  28. <sql id="entity_properties">
  29. #{id},
  30. #{disNm},
  31. #{persId},
  32. #{persName},
  33. #{orgId},
  34. #{orgNm},
  35. #{intm},
  36. #{uptm},
  37. #{flagValid},
  38. #{meetingNumber}
  39. </sql>
  40. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  41. <sql id="page_where">
  42. <trim prefix="where" prefixOverrides="and | or ">
  43. <if test="disNm != null and disNm != ''">and DIS_NM = #{disNm}</if>
  44. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  45. <if test="persName != null and persName != ''">and PERS_NAME = #{persName}</if>
  46. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  47. <if test="orgNm != null and orgNm != ''">and ORG_NM = #{orgNm}</if>
  48. <if test="intm != null">and INTM = #{intm}</if>
  49. <if test="uptm != null">and UPTM = #{uptm}</if>
  50. <if test="flagValid != null and flagValid != ''">and FLAG_VALID = #{flagValid}</if>
  51. <if test="meetingNumber != null and meetingNumber != ''">and MEETING_NUMBER = #{meetingNumber}</if>
  52. </trim>
  53. </sql>
  54. <select id="getBy" resultMap="bisInspMeetDiscussResultMap">
  55. select
  56. <include refid="table_columns"/>
  57. from BIS_INSP_MEET_DISCUSS
  58. <include refid="page_where"/>
  59. </select>
  60. <select id="findAll" resultMap="bisInspMeetDiscussResultMap">
  61. select
  62. <include refid="table_columns"/>
  63. from BIS_INSP_MEET_DISCUSS
  64. </select>
  65. <select id="findList" resultMap="bisInspMeetDiscussResultMap">
  66. select
  67. <include refid="table_columns"/>
  68. from BIS_INSP_MEET_DISCUSS
  69. <include refid="page_where"/>
  70. </select>
  71. <select id="selectCount" resultType="int">
  72. select count(ID) from BIS_INSP_MEET_DISCUSS
  73. <include refid="page_where"/>
  74. </select>
  75. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspMeetDiscuss">
  76. insert into BIS_INSP_MEET_DISCUSS(
  77. <include refid="table_columns"/>
  78. )
  79. values (
  80. <include refid="entity_properties"/>
  81. )
  82. </insert>
  83. <delete id="delete" parameterType="java.lang.String">
  84. delete from BIS_INSP_MEET_DISCUSS where ID = #{id}
  85. </delete>
  86. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspMeetDiscuss">
  87. delete from BIS_INSP_MEET_DISCUSS
  88. <include refid="page_where"/>
  89. </delete>
  90. <update id="deleteInFlag" parameterType="java.lang.String">
  91. update BIS_INSP_MEET_DISCUSS set flag_valid = 0 where ID = #{id}
  92. </update>
  93. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspMeetDiscuss">
  94. update BIS_INSP_MEET_DISCUSS
  95. <trim prefix="set" suffixOverrides=",">
  96. <if test="disNm != null and disNm != ''">DIS_NM = #{disNm},</if>
  97. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  98. <if test="persName != null and persName != ''">PERS_NAME = #{persName},</if>
  99. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  100. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  101. <if test="intm != null">INTM = #{intm},</if>
  102. <if test="uptm != null">UPTM = #{uptm},</if>
  103. <if test="flagValid != null and flagValid != ''">FLAG_VALID = #{flagValid},</if>
  104. <if test="meetingNumber != null and meetingNumber != ''">MEETING_NUMBER = #{meetingNumber},</if>
  105. </trim>
  106. <where>ID = #{id}</where>
  107. </update>
  108. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspMeetDiscuss">
  109. update BIS_INSP_MEET_DISCUSS
  110. <trim prefix="set" suffixOverrides=",">
  111. <if test="disNm != null and disNm != ''">DIS_NM = #{disNm},</if>
  112. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  113. <if test="persName != null and persName != ''">PERS_NAME = #{persName},</if>
  114. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  115. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  116. <if test="intm != null">INTM = #{intm},</if>
  117. <if test="uptm != null">UPTM = #{uptm},</if>
  118. <if test="flagValid != null and flagValid != ''">FLAG_VALID = #{flagValid},</if>
  119. <if test="meetingNumber != null and meetingNumber != ''">MEETING_NUMBER = #{meetingNumber},</if>
  120. </trim>
  121. <include refid="page_where"/>
  122. </update>
  123. <!-- 其他自定义SQL -->
  124. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspMeetDiscuss" id="discussMap">
  125. <id property="id" column="ID"/>
  126. <result property="disNm" column="DIS_NM"/>
  127. <result property="persId" column="PERS_ID"/>
  128. <result property="persName" column="PERS_NAME"/>
  129. <result property="orgId" column="ORG_ID"/>
  130. <result property="orgNm" column="ORG_NM"/>
  131. <result property="intm" column="INTM"/>
  132. <result property="uptm" column="UPTM"/>
  133. <collection property="bisInspMeetDiscussPersList"
  134. ofType="cn.com.goldenwater.dcproj.model.BisInspMeetDiscussPers">
  135. <result property="id" column="DISP_ID"/>
  136. <result property="persId" column="DIS_PERS_ID"/>
  137. <result property="persName" column="DIS_PERS_NAME"/>
  138. <result property="callnumber" column="callnumber"/>
  139. <result property="disId" column="DIS_ID"/>
  140. <result property="imgurl" column="imgurl"/>
  141. </collection>
  142. </resultMap>
  143. <select id="get" resultMap="bisInspMeetDiscussResultMap" parameterType="String">
  144. select
  145. <include refid="table_columns"/>
  146. from BIS_INSP_MEET_DISCUSS where ID = #{id}
  147. </select>
  148. <select id="getById" resultMap="discussMap" parameterType="String">
  149. select A.ID,A.DIS_NM,A.PERS_ID,A.PERS_NAME,A.ORG_ID,A.ORG_NM,A.INTM,
  150. A.UPTM,B.ID DISP_ID,B.PERS_ID DIS_PERS_ID,B.PERS_NAME DIS_PERS_NAME,
  151. B.DIS_ID DIS_ID,B.CALLNUMBER,b.imgurl
  152. from BIS_INSP_MEET_DISCUSS A
  153. LEFT JOIN BIS_INSP_MEET_DISCUSS_PERS B
  154. ON A.ID=B.DIS_ID WHERE A.ID = #{id}
  155. </select>
  156. <select id="findDiscuss" resultMap="discussMap">
  157. select A.ID,A.DIS_NM,A.PERS_ID,A.PERS_NAME,A.ORG_ID,A.ORG_NM,A.INTM,
  158. A.UPTM,B.ID DISP_ID,B.PERS_ID DIS_PERS_ID,B.PERS_NAME DIS_PERS_NAME,
  159. B.DIS_ID DIS_ID,B.CALLNUMBER,b.imgurl
  160. from BIS_INSP_MEET_DISCUSS A
  161. LEFT JOIN BIS_INSP_MEET_DISCUSS_PERS B
  162. ON A.ID=B.DIS_ID WHERE (
  163. A.ID IN (SELECT DISTINCT DIS_ID FROM BIS_INSP_MEET_DISCUSS_PERS WHERE PERS_ID =#{persId})
  164. or A.ID IN (SELECT DISTINCT id FROM BIS_INSP_MEET_DISCUSS WHERE PERS_ID =#{persId})
  165. )
  166. </select>
  167. </mapper>