BisInsNtfctnDao.xml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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.BisInsNtfctnDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInsNtfctn" id="bisInsNtfctnResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="inspType" column="INSP_TYPE"/>
  7. <result property="plnNm" column="PLN_NM"/>
  8. <result property="planYr" column="PLAN_YR"/>
  9. <result property="planNo" column="PLAN_NO"/>
  10. <result property="orgId" column="ORG_ID"/>
  11. <result property="planUnt" column="PLAN_UNT"/>
  12. <result property="intm" column="INTM"/>
  13. <result property="planCnt" column="PLAN_CNT"/>
  14. <result property="planCar" column="PLAN_CAR"/>
  15. <result property="pesrid" column="PESRID"/>
  16. <result property="flagValid" column="FLAG_VALID"/>
  17. <result property="sendState" column="SEND_STATE"/>
  18. </resultMap>
  19. <sql id="table_columns">
  20. ID,
  21. INSP_TYPE,
  22. PLN_NM,
  23. PLAN_YR,
  24. PLAN_NO,
  25. ORG_ID,
  26. PLAN_UNT,
  27. INTM,
  28. PLAN_CNT,
  29. PLAN_CAR,
  30. PESRID,
  31. FLAG_VALID,
  32. SEND_STATE
  33. </sql>
  34. <sql id="entity_properties">
  35. #{id},
  36. #{inspType},
  37. #{plnNm},
  38. #{planYr},
  39. #{planNo},
  40. #{orgId},
  41. #{planUnt},
  42. #{intm},
  43. #{planCnt},
  44. #{planCar},
  45. #{pesrid},
  46. #{flagValid},
  47. #{sendState}
  48. </sql>
  49. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  50. <sql id="page_where">
  51. <trim prefix="where" prefixOverrides="and | or ">
  52. <if test="inspType != null and inspType != ''">and INSP_TYPE = #{inspType}</if>
  53. <if test="plnNm != null and plnNm != ''">and PLN_NM = #{plnNm}</if>
  54. <if test="planYr != null and planYr != ''">and PLAN_YR = #{planYr}</if>
  55. <if test="planNo != null and planNo != ''">and PLAN_NO = #{planNo}</if>
  56. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  57. <if test="planUnt != null and planUnt != ''">and PLAN_UNT = #{planUnt}</if>
  58. <if test="intm != null">and INTM = #{intm}</if>
  59. <if test="planCnt != null and planCnt != ''">and PLAN_CNT = #{planCnt}</if>
  60. <if test="planCar != null and planCar != ''">and PLAN_CAR = #{planCar}</if>
  61. <if test="pesrid != null and pesrid != ''">and PESRID = #{pesrid}</if>
  62. <if test="flagValid != null">and FLAG_VALID = #{flagValid}</if>
  63. <if test="sendState != null and sendState != ''">and SEND_STATE = #{sendState}</if>
  64. </trim>
  65. </sql>
  66. <select id="get" resultMap="bisInsNtfctnResultMap" parameterType="String">
  67. select
  68. <include refid="table_columns"/>
  69. from BIS_INS_NTFCTN where ID = #{id}
  70. </select>
  71. <select id="getBy" resultMap="bisInsNtfctnResultMap">
  72. select
  73. <include refid="table_columns"/>
  74. from BIS_INS_NTFCTN
  75. <include refid="page_where"/>
  76. </select>
  77. <select id="findAll" resultMap="bisInsNtfctnResultMap">
  78. select
  79. <include refid="table_columns"/>
  80. from BIS_INS_NTFCTN
  81. </select>
  82. <select id="findList" resultMap="bisInsNtfctnResultMap">
  83. select
  84. <include refid="table_columns"/>
  85. from BIS_INS_NTFCTN
  86. <include refid="page_where"/>
  87. </select>
  88. <select id="selectCount" resultType="int">
  89. select count(ID) from BIS_INS_NTFCTN
  90. <include refid="page_where"/>
  91. </select>
  92. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInsNtfctn">
  93. insert into BIS_INS_NTFCTN(
  94. <include refid="table_columns"/>
  95. )
  96. values (
  97. <include refid="entity_properties"/>
  98. )
  99. </insert>
  100. <delete id="delete" parameterType="java.lang.String">
  101. delete from BIS_INS_NTFCTN where ID = #{id}
  102. </delete>
  103. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInsNtfctn">
  104. delete from BIS_INS_NTFCTN
  105. <include refid="page_where"/>
  106. </delete>
  107. <update id="deleteInFlag" parameterType="java.lang.String">
  108. update BIS_INS_NTFCTN set flag_valid = '0' where ID = #{id}
  109. </update>
  110. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInsNtfctn">
  111. update BIS_INS_NTFCTN
  112. <trim prefix="set" suffixOverrides=",">
  113. <if test="inspType != null and inspType != ''">INSP_TYPE = #{inspType},</if>
  114. <if test="plnNm != null and plnNm != ''">PLN_NM = #{plnNm},</if>
  115. <if test="planYr != null and planYr != ''">PLAN_YR = #{planYr},</if>
  116. <if test="planNo != null and planNo != ''">PLAN_NO = #{planNo},</if>
  117. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  118. <if test="planUnt != null and planUnt != ''">PLAN_UNT = #{planUnt},</if>
  119. <if test="intm != null">INTM = #{intm},</if>
  120. <if test="planCnt != null and planCnt != ''">PLAN_CNT = #{planCnt},</if>
  121. <if test="planCar != null and planCar != ''">PLAN_CAR = #{planCar},</if>
  122. <if test="pesrid != null and pesrid != ''">PESRID = #{pesrid},</if>
  123. <if test="flagValid != null">FLAG_VALID = #{flagValid},</if>
  124. <if test="sendState != null and sendState != ''">SEND_STATE = #{sendState},</if>
  125. </trim>
  126. <where>ID = #{id}</where>
  127. </update>
  128. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInsNtfctn">
  129. update BIS_INS_NTFCTN
  130. <trim prefix="set" suffixOverrides=",">
  131. <if test="inspType != null and inspType != ''">INSP_TYPE = #{inspType},</if>
  132. <if test="plnNm != null and plnNm != ''">PLN_NM = #{plnNm},</if>
  133. <if test="planYr != null and planYr != ''">PLAN_YR = #{planYr},</if>
  134. <if test="planNo != null and planNo != ''">PLAN_NO = #{planNo},</if>
  135. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  136. <if test="planUnt != null and planUnt != ''">PLAN_UNT = #{planUnt},</if>
  137. <if test="intm != null">INTM = #{intm},</if>
  138. <if test="planCnt != null and planCnt != ''">PLAN_CNT = #{planCnt},</if>
  139. <if test="planCar != null and planCar != ''">PLAN_CAR = #{planCar},</if>
  140. <if test="pesrid != null and pesrid != ''">PESRID = #{pesrid},</if>
  141. <if test="flagValid != null">FLAG_VALID = #{flagValid},</if>
  142. <if test="sendState != null and sendState != ''">SENG_STATE = #{sendState},</if>
  143. </trim>
  144. <include refid="page_where"/>
  145. </update>
  146. <!-- 其他自定义SQL -->
  147. <select id="queryNtfctn" resultType="cn.com.goldenwater.dcproj.dto.BisInsNtfctnDto">
  148. select A.*,B.PERS_NAME,B.ORG_NM from BIS_INS_NTFCTN A
  149. LEFT JOIN BIS_INSP_ALL_RLATION_PERS B ON A.PESRID=B.GUID
  150. where A.FLAG_VALID='1'
  151. <if test="inspType != null and inspType != ''">and A.INSP_TYPE = #{inspType}</if>
  152. <if test="plnNm != null and plnNm != ''">and A.PLN_NM = #{plnNm}</if>
  153. <if test="planYr != null and planYr != ''">and A.PLAN_YR = #{planYr}</if>
  154. <if test="planNo != null and planNo != ''">and A.PLAN_NO = #{planNo}</if>
  155. <if test="orgId != null and orgId != ''">and A.ORG_ID = #{orgId}</if>
  156. <if test="planUnt != null and planUnt != ''">and A.PLAN_UNT = #{planUnt}</if>
  157. <if test="planCnt != null and planCnt != ''">and A.PLAN_CNT = #{planCnt}</if>
  158. <if test="planCar != null and planCar != ''">and A.PLAN_CAR = #{planCar}</if>
  159. <if test="pesrid != null and pesrid != ''">and A.PESRID = #{pesrid}</if>
  160. <if test="sendState != null and sendState != ''">and SENG_STATE = #{sendState}</if>
  161. </select>
  162. <select id="getNtfcById" parameterType="String" resultType="cn.com.goldenwater.dcproj.dto.NtfctnAndDvdwkDto">
  163. SELECT A.ID,
  164. A.INSP_TYPE,
  165. A.PLN_NM,
  166. A.PLAN_YR,
  167. A.PLAN_NO,
  168. A.ORG_ID,
  169. A.PLAN_UNT,
  170. A.INTM,
  171. A.PLAN_CNT,
  172. A.PLAN_CAR,
  173. A.PESRID,
  174. A.FLAG_VALID,
  175. A.SEND_STATE,B.PERS_NAME,B.ORG_NM FROM BIS_INS_NTFCTN A LEFT JOIN BIS_INSP_ALL_RLATION_PERS B ON A.PESRID=B.GUID
  176. where A.FLAG_VALID='1' AND A.ID = #{id}
  177. </select>
  178. <select id="queryNtfctnAndDvdwk" parameterType="cn.com.goldenwater.dcproj.param.BisInsNtfctnParam"
  179. resultType="cn.com.goldenwater.dcproj.dto.NtfctnDvdwkDto">
  180. SELECT A.*,B.DVDWK_ID,
  181. B.GUID,
  182. B.ORG_DP,
  183. B.DTYPE,
  184. B.CONTENT,
  185. B.INSP_NUM,
  186. B.AD_CODE,
  187. B.AD_NAME,
  188. B.ORG_NAME,
  189. B.INSP_COUNT,
  190. B.INSP_SCALE FROM BIS_INS_NTFCTN A LEFT JOIN BIS_INSP_DVDWK B ON A.ID = B.SCHM_ID
  191. WHERE A.FLAG_VALID='1' AND A.SEND_STATE = '1'
  192. AND A.ID IN (SELECT NTFCTN_ID FROM BIS_INSP_RECV_UNIT WHERE ORG_ID IN (SELECT ORG_ID FROM bis_insp_all_rlation_pers WHERE GUID = #{pesrid}))
  193. <if test="inspType != null and inspType != ''">and A.INSP_TYPE = #{inspType}</if>
  194. <if test="plnNm != null and plnNm != ''">and A.PLN_NM = #{plnNm}</if>
  195. <if test="planYr != null and planYr != ''">and A.PLAN_YR = #{planYr}</if>
  196. <if test="planNo != null and planNo != ''">and A.PLAN_NO = #{planNo}</if>
  197. <if test="orgId != null and orgId != ''">and A.ORG_ID = #{orgId}</if>
  198. <if test="planUnt != null and planUnt != ''">and A.PLAN_UNT = #{planUnt}</if>
  199. <if test="planCnt != null and planCnt != ''">and A.PLAN_CNT = #{planCnt}</if>
  200. <if test="planCar != null and planCar != ''">and A.PLAN_CAR = #{planCar}</if>
  201. <if test="pesrid != null and pesrid != ''">and A.PESRID = #{pesrid}</if>
  202. <if test="sendState != null and sendState != ''">and SENG_STATE = #{sendState}</if>
  203. </select>
  204. </mapper>