AttPrdCstrProjBaseDao.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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.AttPrdCstrProjBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttPrdCstrProjBase" id="attPrdCstrProjBaseResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="code" column="CODE"/>
  7. <result property="name" column="NAME"/>
  8. <result property="type" column="TYPE"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="adName" column="AD_NAME"/>
  11. <result property="location" column="LOCATION"/>
  12. <result property="centerX" column="CENTER_X"/>
  13. <result property="centerY" column="CENTER_Y"/>
  14. <result property="gdX" column="GD_X"/>
  15. <result property="gdY" column="GD_Y"/>
  16. <result property="persId" column="PERS_ID"/>
  17. <result property="intm" column="INTM"/>
  18. <result property="uptm" column="UPTM"/>
  19. </resultMap>
  20. <sql id="table_columns">
  21. ID,
  22. CODE,
  23. NAME,
  24. TYPE,
  25. AD_CODE,
  26. AD_NAME,
  27. LOCATION,
  28. CENTER_X,
  29. CENTER_Y,
  30. GD_X,
  31. GD_Y,
  32. PERS_ID,
  33. INTM,
  34. UPTM
  35. </sql>
  36. <sql id="entity_properties">
  37. #{id},
  38. #{code},
  39. #{name},
  40. #{type},
  41. #{adCode},
  42. #{adName},
  43. #{location},
  44. #{centerX},
  45. #{centerY},
  46. #{gdX},
  47. #{gdY},
  48. #{persId},
  49. #{intm},
  50. #{uptm}
  51. </sql>
  52. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  53. <sql id="page_where">
  54. <trim prefix="where" prefixOverrides="and | or ">
  55. <if test="code != null and code != ''">and CODE = #{code}</if>
  56. <if test="name != null and name != ''">and NAME = #{name}</if>
  57. <if test="type != null and type != ''">and TYPE = #{type}</if>
  58. <if test="adCode != null and adCode != ''">and AD_CODE like '${adCode}%'</if>
  59. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  60. <if test="location != null and location != ''">and LOCATION = #{location}</if>
  61. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  62. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  63. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  64. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  65. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  66. <if test="intm != null">and INTM = #{intm}</if>
  67. <if test="uptm != null">and UPTM = #{uptm}</if>
  68. <if test="province !=null and province !=''">
  69. and AD_CODE like '${province}%'
  70. </if>
  71. </trim>
  72. </sql>
  73. <select id="get" resultMap="attPrdCstrProjBaseResultMap" parameterType="String">
  74. select
  75. <include refid="table_columns"/>
  76. from ATT_PRD_CSTR_PROJ_BASE where ID = #{id}
  77. </select>
  78. <select id="getBy" resultMap="attPrdCstrProjBaseResultMap">
  79. select
  80. <include refid="table_columns"/>
  81. from ATT_PRD_CSTR_PROJ_BASE
  82. <include refid="page_where"/>
  83. </select>
  84. <select id="findAll" resultMap="attPrdCstrProjBaseResultMap">
  85. select
  86. <include refid="table_columns"/>
  87. from ATT_PRD_CSTR_PROJ_BASE
  88. </select>
  89. <select id="findList" resultMap="attPrdCstrProjBaseResultMap">
  90. select
  91. <include refid="table_columns"/>
  92. from ATT_PRD_CSTR_PROJ_BASE
  93. <include refid="page_where"/>
  94. </select>
  95. <select id="selectCount" resultType="int">
  96. select count(ID) from ATT_PRD_CSTR_PROJ_BASE
  97. <include refid="page_where"/>
  98. </select>
  99. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttPrdCstrProjBase">
  100. insert into ATT_PRD_CSTR_PROJ_BASE(
  101. <include refid="table_columns"/>
  102. )
  103. values (
  104. <include refid="entity_properties"/>
  105. )
  106. </insert>
  107. <delete id="delete" parameterType="java.lang.String">
  108. delete from ATT_PRD_CSTR_PROJ_BASE where ID = #{id}
  109. </delete>
  110. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttPrdCstrProjBase">
  111. delete from ATT_PRD_CSTR_PROJ_BASE
  112. <include refid="page_where"/>
  113. </delete>
  114. <update id="deleteInFlag" parameterType="java.lang.String">
  115. update ATT_PRD_CSTR_PROJ_BASE set flag_valid = 0 where ID = #{id}
  116. </update>
  117. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttPrdCstrProjBase">
  118. update ATT_PRD_CSTR_PROJ_BASE
  119. <trim prefix="set" suffixOverrides=",">
  120. <if test="code != null and code != ''">CODE = #{code},</if>
  121. <if test="name != null and name != ''">NAME = #{name},</if>
  122. <if test="type != null and type != ''">TYPE = #{type},</if>
  123. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  124. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  125. <if test="location != null and location != ''">LOCATION = #{location},</if>
  126. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  127. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  128. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  129. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  130. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  131. <if test="intm != null">INTM = #{intm},</if>
  132. <if test="uptm != null">UPTM = #{uptm},</if>
  133. </trim>
  134. <where>ID = #{id}</where>
  135. </update>
  136. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttPrdCstrProjBase">
  137. update ATT_PRD_CSTR_PROJ_BASE
  138. <trim prefix="set" suffixOverrides=",">
  139. <if test="code != null and code != ''">CODE = #{code},</if>
  140. <if test="name != null and name != ''">NAME = #{name},</if>
  141. <if test="type != null and type != ''">TYPE = #{type},</if>
  142. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  143. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  144. <if test="location != null and location != ''">LOCATION = #{location},</if>
  145. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  146. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  147. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  148. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  149. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  150. <if test="intm != null">INTM = #{intm},</if>
  151. <if test="uptm != null">UPTM = #{uptm},</if>
  152. </trim>
  153. <include refid="page_where"/>
  154. </update>
  155. <!-- 其他自定义SQL -->
  156. <select id="findListReg" parameterType="cn.com.goldenwater.dcproj.param.AttPrdCstrProjBaseParam"
  157. resultType="cn.com.goldenwater.dcproj.model.AttPrdCstrProjBase">
  158. select r.name,r.ad_code,(case when r.center_x is null then e.center_x else r.center_x end) as center_x,r.obj_id,
  159. (case when r.center_y is null then e.center_y else r.center_y end) as center_y,r.state
  160. from ATT_PRD_CSTR_PROJ_BASE e,bis_insp_all_obj o,BIS_INSP_OPRD_CSTR_PROJ_RGSTR r
  161. where e.id=o.code and o.obj_id=r.obj_id
  162. <if test="state !=null and state !=''">
  163. and r.state=#{state}
  164. </if>
  165. <if test="province !=null and province !=''">
  166. and r.ad_code like '${province}%'
  167. </if>
  168. </select>
  169. <select id="getObjId" resultType="cn.com.goldenwater.dcproj.model.AttPrdCstrProjBase">
  170. SELECT
  171. <include refid="table_columns"/>
  172. FROM ATT_PRD_CSTR_PROJ_BASE
  173. WHERE ID = (SELECT CODE FROM BIS_INSP_ALL_OBJ WHERE OBJ_ID = #{objId})
  174. </select>
  175. </mapper>