AttSafetyBaseDao.xml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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.AttSafetyBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttSafetyBase" id="attSafetyBaseResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="name" column="NAME"/>
  7. <result property="mgPers" column="MG_PERS"/>
  8. <result property="mgPersTel" column="MG_PERS_TEL"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="adName" column="AD_NAME"/>
  11. <result property="loc" column="LOC"/>
  12. <result property="note" column="NOTE"/>
  13. <result property="centerX" column="CENTER_X"/>
  14. <result property="centerY" column="CENTER_Y"/>
  15. <result property="gdX" column="GD_X"/>
  16. <result property="gdY" column="GD_Y"/>
  17. <result property="intm" column="INTM"/>
  18. <result property="uptm" column="UPTM"/>
  19. <result property="dataStat" column="DATA_STAT"/>
  20. </resultMap>
  21. <sql id="table_columns">
  22. ID,
  23. NAME,
  24. MG_PERS,
  25. MG_PERS_TEL,
  26. AD_CODE,
  27. AD_NAME,
  28. LOC,
  29. NOTE,
  30. CENTER_X,
  31. CENTER_Y,
  32. GD_X,
  33. GD_Y,
  34. INTM,
  35. UPTM,
  36. DATA_STAT
  37. </sql>
  38. <sql id="entity_properties">
  39. #{id},
  40. #{name},
  41. #{mgPers},
  42. #{mgPersTel},
  43. #{adCode},
  44. #{adName},
  45. #{loc},
  46. #{note},
  47. #{centerX},
  48. #{centerY},
  49. #{gdX},
  50. #{gdY},
  51. #{intm},
  52. #{uptm},
  53. #{dataStat}
  54. </sql>
  55. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  56. <sql id="page_where">
  57. <trim prefix="where" prefixOverrides="and | or ">
  58. <if test="name != null and name != ''">
  59. and NAME = #{name}
  60. </if>
  61. <if test="mgPers != null and mgPers != ''">
  62. and MG_PERS = #{mgPers}
  63. </if>
  64. <if test="mgPersTel != null and mgPersTel != ''">
  65. and MG_PERS_TEL = #{mgPersTel}
  66. </if>
  67. <if test="adCode != null and adCode != ''">
  68. and AD_CODE = #{adCode}
  69. </if>
  70. <if test="adName != null and adName != ''">
  71. and AD_NAME = #{adName}
  72. </if>
  73. <if test="loc != null and loc != ''">
  74. and LOC = #{loc}
  75. </if>
  76. <if test="note != null and note != ''">
  77. and NOTE = #{note}
  78. </if>
  79. <if test="centerX != null and centerX != ''">
  80. and CENTER_X = #{centerX}
  81. </if>
  82. <if test="centerY != null and centerY != ''">
  83. and CENTER_Y = #{centerY}
  84. </if>
  85. <if test="gdX != null and gdX != ''">
  86. and GD_X = #{gdX}
  87. </if>
  88. <if test="gdY != null and gdY != ''">
  89. and GD_Y = #{gdY}
  90. </if>
  91. <if test="intm != null">
  92. and INTM = #{intm}
  93. </if>
  94. <if test="uptm != null">
  95. and UPTM = #{uptm}
  96. </if>
  97. <if test="dataStat != null and dataStat != ''">
  98. and DATA_STAT = #{dataStat}
  99. </if>
  100. and DATA_STAT='0'
  101. </trim>
  102. </sql>
  103. <select id="get" resultMap="attSafetyBaseResultMap" parameterType="String">
  104. select
  105. <include refid="table_columns"/>
  106. from ATT_SAFETY_BASE where ID = #{id}
  107. </select>
  108. <select id="getBy" resultMap="attSafetyBaseResultMap">
  109. select
  110. <include refid="table_columns"/>
  111. from ATT_SAFETY_BASE
  112. <include refid="page_where"/>
  113. </select>
  114. <select id="findAll" resultMap="attSafetyBaseResultMap">
  115. select
  116. <include refid="table_columns"/>
  117. from ATT_SAFETY_BASE
  118. </select>
  119. <select id="findList" resultMap="attSafetyBaseResultMap">
  120. select
  121. <include refid="table_columns"/>
  122. from ATT_SAFETY_BASE
  123. <include refid="page_where"/>
  124. </select>
  125. <select id="selectCount" resultType="int">
  126. select count(ID) from ATT_SAFETY_BASE
  127. <include refid="page_where"/>
  128. </select>
  129. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttSafetyBase">
  130. insert into ATT_SAFETY_BASE(
  131. <include refid="table_columns"/>
  132. )
  133. values (
  134. <include refid="entity_properties"/>
  135. )
  136. </insert>
  137. <delete id="delete" parameterType="java.lang.String">
  138. update ATT_SAFETY_BASE set DATA_STAT='9' where ID = #{id}
  139. </delete>
  140. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttSafetyBase">
  141. update ATT_SAFETY_BASE set DATA_STAT='9'
  142. <include refid="page_where"/>
  143. </delete>
  144. <update id="deleteInFlag" parameterType="java.lang.String">
  145. update ATT_SAFETY_BASE set DATA_STAT = '9' where ID = #{id}
  146. </update>
  147. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttSafetyBase">
  148. update ATT_SAFETY_BASE
  149. <trim prefix="set" suffixOverrides=",">
  150. <if test="name != null and name != ''">NAME
  151. = #{name},
  152. </if>
  153. <if test="mgPers != null and mgPers != ''">MG_PERS
  154. = #{mgPers},
  155. </if>
  156. <if test="mgPersTel != null and mgPersTel != ''">MG_PERS_TEL
  157. = #{mgPersTel},
  158. </if>
  159. <if test="adCode != null and adCode != ''">AD_CODE
  160. = #{adCode},
  161. </if>
  162. <if test="adName != null and adName != ''">AD_NAME
  163. = #{adName},
  164. </if>
  165. <if test="loc != null and loc != ''">LOC
  166. = #{loc},
  167. </if>
  168. <if test="note != null and note != ''">NOTE
  169. = #{note},
  170. </if>
  171. <if test="centerX != null and centerX != ''">CENTER_X
  172. = #{centerX},
  173. </if>
  174. <if test="centerY != null and centerY != ''">CENTER_Y
  175. = #{centerY},
  176. </if>
  177. <if test="gdX != null and gdX != ''">GD_X
  178. = #{gdX},
  179. </if>
  180. <if test="gdY != null and gdY != ''">GD_Y
  181. = #{gdY},
  182. </if>
  183. <if test="intm != null">INTM
  184. = #{intm},
  185. </if>
  186. <if test="uptm != null">UPTM
  187. = #{uptm},
  188. </if>
  189. <if test="dataStat != null and dataStat != ''">DATA_STAT
  190. = #{dataStat},
  191. </if>
  192. </trim>
  193. <where>ID = #{id}</where>
  194. </update>
  195. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttSafetyBase">
  196. update ATT_SAFETY_BASE
  197. <trim prefix="set" suffixOverrides=",">
  198. <if test="name != null and name != ''">NAME
  199. = #{name},
  200. </if>
  201. <if test="mgPers != null and mgPers != ''">MG_PERS
  202. = #{mgPers},
  203. </if>
  204. <if test="mgPersTel != null and mgPersTel != ''">MG_PERS_TEL
  205. = #{mgPersTel},
  206. </if>
  207. <if test="adCode != null and adCode != ''">AD_CODE
  208. = #{adCode},
  209. </if>
  210. <if test="adName != null and adName != ''">AD_NAME
  211. = #{adName},
  212. </if>
  213. <if test="loc != null and loc != ''">LOC
  214. = #{loc},
  215. </if>
  216. <if test="note != null and note != ''">NOTE
  217. = #{note},
  218. </if>
  219. <if test="centerX != null and centerX != ''">CENTER_X
  220. = #{centerX},
  221. </if>
  222. <if test="centerY != null and centerY != ''">CENTER_Y
  223. = #{centerY},
  224. </if>
  225. <if test="gdX != null and gdX != ''">GD_X
  226. = #{gdX},
  227. </if>
  228. <if test="gdY != null and gdY != ''">GD_Y
  229. = #{gdY},
  230. </if>
  231. <if test="intm != null">INTM
  232. = #{intm},
  233. </if>
  234. <if test="uptm != null">UPTM
  235. = #{uptm},
  236. </if>
  237. <if test="dataStat != null and dataStat != ''">DATA_STAT
  238. = #{dataStat},
  239. </if>
  240. </trim>
  241. <include refid="page_where"/>
  242. </update>
  243. <!-- 其他自定义SQL -->
  244. <select id="getObjId" resultType="cn.com.goldenwater.dcproj.model.AttSafetyBase">
  245. SELECT
  246. <include refid="table_columns"/>
  247. FROM ATT_SAFETY_BASE
  248. WHERE ID = (SELECT CODE FROM BIS_INSP_ALL_OBJ WHERE OBJ_ID = #{objId})
  249. </select>
  250. </mapper>