ImpRsInfoDao.xml 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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.ImpRsInfoDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.ImpRsInfo" id="impRsInfoResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="sn" column="SN"/>
  7. <result property="proCode" column="PRO_CODE"/>
  8. <result property="proName" column="PRO_NAME"/>
  9. <result property="cityCode" column="CITY_CODE"/>
  10. <result property="cityName" column="CITY_NAME"/>
  11. <result property="countyCode" column="COUNTY_CODE"/>
  12. <result property="countyName" column="COUNTY_NAME"/>
  13. <result property="rsCode" column="RS_CODE"/>
  14. <result property="rsName" column="RS_NAME"/>
  15. <result property="engScal" column="ENG_SCAL"/>
  16. <result property="totCap" column="TOT_CAP"/>
  17. <result property="isPoor" column="IS_POOR"/>
  18. <result property="isCheck" column="IS_CHECK"/>
  19. <result property="note" column="NOTE"/>
  20. <result property="orgId" column="ORG_ID"/>
  21. <result property="orgNm" column="ORG_NM"/>
  22. <result property="mnth" column="MNTH"/>
  23. <result property="oldGroupId" column="OLD_GROUP_ID"/>
  24. <result property="groupId" column="GROUP_ID"/>
  25. <result property="groupNm" column="GROUP_NM"/>
  26. <result property="regId" column="REG_ID"/>
  27. <result property="objId" column="OBJ_ID"/>
  28. </resultMap>
  29. <sql id="table_columns">
  30. ID,
  31. SN,
  32. PRO_CODE,
  33. PRO_NAME,
  34. CITY_CODE,
  35. CITY_NAME,
  36. COUNTY_CODE,
  37. COUNTY_NAME,
  38. RS_CODE,
  39. RS_NAME,
  40. ENG_SCAL,
  41. TOT_CAP,
  42. IS_POOR,
  43. IS_CHECK,
  44. NOTE,
  45. ORG_ID,
  46. ORG_NM,
  47. MNTH,
  48. OLD_GROUP_ID,
  49. GROUP_ID,
  50. GROUP_NM,
  51. REG_ID,
  52. OBJ_ID
  53. </sql>
  54. <sql id="entity_properties">
  55. #{id},
  56. #{sn},
  57. #{proCode},
  58. #{proName},
  59. #{cityCode},
  60. #{cityName},
  61. #{countyCode},
  62. #{countyName},
  63. #{rsCode},
  64. #{rsName},
  65. #{engScal},
  66. #{totCap},
  67. #{isPoor},
  68. #{isCheck},
  69. #{note},
  70. #{orgId},
  71. #{orgNm},
  72. #{mnth},
  73. #{oldGroupId},
  74. #{groupId},
  75. #{groupNm},
  76. #{regId},
  77. #{objId}
  78. </sql>
  79. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  80. <sql id="page_where">
  81. <trim prefix="where" prefixOverrides="and | or ">
  82. <if test="sn != null and sn != ''">and SN = #{sn}</if>
  83. <if test="proCode != null and proCode != ''">and PRO_CODE = #{proCode}</if>
  84. <if test="proName != null and proName != ''">and PRO_NAME = #{proName}</if>
  85. <if test="cityCode != null and cityCode != ''">and CITY_CODE = #{cityCode}</if>
  86. <if test="cityName != null and cityName != ''">and CITY_NAME = #{cityName}</if>
  87. <if test="countyCode != null and countyCode != ''">and COUNTY_CODE = #{countyCode}</if>
  88. <if test="countyName != null and countyName != ''">and COUNTY_NAME = #{countyName}</if>
  89. <if test="rsCode != null and rsCode != ''">and RS_CODE = #{rsCode}</if>
  90. <if test="rsName != null and rsName != ''">and (RS_NAME like '%${rsName}%' or #{rsName} like '%'||RS_NAME||'%')</if>
  91. <if test="engScal != null and engScal != ''">and ENG_SCAL = #{engScal}</if>
  92. <if test="totCap != null and totCap != ''">and TOT_CAP = #{totCap}</if>
  93. <if test="isPoor != null and isPoor != ''">and IS_POOR = #{isPoor}</if>
  94. <if test="isCheck != null and isCheck != ''">and IS_CHECK = #{isCheck}</if>
  95. <if test="note != null and note != ''">and NOTE = #{note}</if>
  96. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  97. <if test="orgNm != null and orgNm != ''">and ORG_NM = #{orgNm}</if>
  98. <if test="mnth != null and mnth != ''">and MNTH = #{mnth}</if>
  99. <if test="oldGroupId != null and oldGroupId != ''">and OLD_GROUP_ID = #{oldGroupId}</if>
  100. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  101. <if test="groupNm != null and groupNm != ''">and GROUP_NM = #{groupNm}</if>
  102. <if test="regId != null and regId != ''">and REG_ID = #{regId}</if>
  103. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  104. </trim>
  105. </sql>
  106. <select id="get" resultMap="impRsInfoResultMap" parameterType="String" >
  107. select <include refid="table_columns" /> from IMP_RS_INFO where ID = #{id}
  108. </select>
  109. <select id="getBy" resultMap="impRsInfoResultMap">
  110. select <include refid="table_columns" /> from IMP_RS_INFO <include refid="page_where" />
  111. </select>
  112. <select id="findAll" resultMap="impRsInfoResultMap">
  113. select <include refid="table_columns" /> from IMP_RS_INFO
  114. </select>
  115. <select id="findList" resultMap="impRsInfoResultMap">
  116. select <include refid="table_columns" /> from IMP_RS_INFO <include refid="page_where" />
  117. ORDER BY TO_NUMBER(SN)
  118. </select>
  119. <select id="selectCount" resultType="int" >
  120. select count(ID) from IMP_RS_INFO <include refid="page_where" />
  121. </select>
  122. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.ImpRsInfo">
  123. insert into IMP_RS_INFO( <include refid="table_columns" /> )
  124. values ( <include refid="entity_properties" /> )
  125. </insert>
  126. <delete id="delete" parameterType="java.lang.String">
  127. delete from IMP_RS_INFO where ID = #{id}
  128. </delete>
  129. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.ImpRsInfo">
  130. delete from IMP_RS_INFO <include refid="page_where" />
  131. </delete>
  132. <update id="deleteInFlag" parameterType="java.lang.String">
  133. update IMP_RS_INFO set flag_valid = 0 where ID = #{id}
  134. </update>
  135. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.ImpRsInfo">
  136. update IMP_RS_INFO
  137. <trim prefix="set" suffixOverrides=",">
  138. <if test="sn != null and sn != ''">SN = #{sn},</if>
  139. <if test="proCode != null and proCode != ''">PRO_CODE = #{proCode},</if>
  140. <if test="proName != null and proName != ''">PRO_NAME = #{proName},</if>
  141. <if test="cityCode != null and cityCode != ''">CITY_CODE = #{cityCode},</if>
  142. <if test="cityName != null and cityName != ''">CITY_NAME = #{cityName},</if>
  143. <if test="countyCode != null and countyCode != ''">COUNTY_CODE = #{countyCode},</if>
  144. <if test="countyName != null and countyName != ''">COUNTY_NAME = #{countyName},</if>
  145. <if test="rsCode != null and rsCode != ''">RS_CODE = #{rsCode},</if>
  146. <if test="rsName != null and rsName != ''">RS_NAME = #{rsName},</if>
  147. <if test="engScal != null and engScal != ''">ENG_SCAL = #{engScal},</if>
  148. <if test="totCap != null and totCap != ''">TOT_CAP = #{totCap},</if>
  149. <if test="isPoor != null and isPoor != ''">IS_POOR = #{isPoor},</if>
  150. <if test="isCheck != null and isCheck != ''">IS_CHECK = #{isCheck},</if>
  151. <if test="note != null and note != ''">NOTE = #{note},</if>
  152. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  153. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  154. <if test="mnth != null and mnth != ''">MNTH = #{mnth},</if>
  155. <if test="oldGroupId != null and oldGroupId != ''">OLD_GROUP_ID = #{oldGroupId},</if>
  156. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  157. <if test="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
  158. <if test="regId != null and regId != ''">REG_ID = #{regId},</if>
  159. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  160. </trim>
  161. <where>ID = #{id}</where>
  162. </update>
  163. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.ImpRsInfo">
  164. update IMP_RS_INFO
  165. <trim prefix="set" suffixOverrides=",">
  166. <if test="sn != null and sn != ''">SN = #{sn},</if>
  167. <if test="proCode != null and proCode != ''">PRO_CODE = #{proCode},</if>
  168. <if test="proName != null and proName != ''">PRO_NAME = #{proName},</if>
  169. <if test="cityCode != null and cityCode != ''">CITY_CODE = #{cityCode},</if>
  170. <if test="cityName != null and cityName != ''">CITY_NAME = #{cityName},</if>
  171. <if test="countyCode != null and countyCode != ''">COUNTY_CODE = #{countyCode},</if>
  172. <if test="countyName != null and countyName != ''">COUNTY_NAME = #{countyName},</if>
  173. <if test="rsCode != null and rsCode != ''">RS_CODE = #{rsCode},</if>
  174. <if test="rsName != null and rsName != ''">RS_NAME = #{rsName},</if>
  175. <if test="engScal != null and engScal != ''">ENG_SCAL = #{engScal},</if>
  176. <if test="totCap != null and totCap != ''">TOT_CAP = #{totCap},</if>
  177. <if test="isPoor != null and isPoor != ''">IS_POOR = #{isPoor},</if>
  178. <if test="isCheck != null and isCheck != ''">IS_CHECK = #{isCheck},</if>
  179. <if test="note != null and note != ''">NOTE = #{note},</if>
  180. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  181. <if test="orgNm != null and orgNm != ''">ORG_NM = #{orgNm},</if>
  182. <if test="mnth != null and mnth != ''">MNTH = #{mnth},</if>
  183. <if test="oldGroupId != null and oldGroupId != ''">OLD_GROUP_ID = #{oldGroupId},</if>
  184. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  185. <if test="groupNm != null and groupNm != ''">GROUP_NM = #{groupNm},</if>
  186. <if test="regId != null and regId != ''">REG_ID = #{regId},</if>
  187. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  188. </trim>
  189. <include refid="page_where" />
  190. </update>
  191. <!-- 其他自定义SQL -->
  192. <select id="getRegGroupList" resultType="java.util.Map" parameterType="java.util.Map">
  193. select c.*,a.* from BIS_INSP_RSVR_RGSTR a
  194. left join bis_insp_all_obj b on a.obj_id = b.obj_id
  195. left join bis_insp_all c on b.id = c.id
  196. where 1=1
  197. <if test="regId != null and regId != ''">and a.rgstr_id = #{regId}</if>
  198. order by c.id
  199. </select>
  200. <select id="getPersIdByReg" resultType="java.util.Map" parameterType="java.util.Map">
  201. select d.rec_pers_id,c.pers_name,c.id from bis_insp_rsvr_rgstr b
  202. left join BIS_INSP_BASE_EXT d on b.rgstr_id = d.rgstr_id
  203. left join BIS_INSP_ALL_RLATION_PERS c on d.rec_pers_id = c.guid
  204. where 1=1
  205. <if test="regId != null and regId != ''">and b.rgstr_id = #{regId}</if>
  206. order by c.id
  207. </select>
  208. </mapper>