AttPrdCstrProjBaseDao.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 <include refid="table_columns" /> from ATT_PRD_CSTR_PROJ_BASE where ID = #{id}
  75. </select>
  76. <select id="getBy" resultMap="attPrdCstrProjBaseResultMap">
  77. select <include refid="table_columns" /> from ATT_PRD_CSTR_PROJ_BASE <include refid="page_where" />
  78. </select>
  79. <select id="findAll" resultMap="attPrdCstrProjBaseResultMap">
  80. select <include refid="table_columns" /> from ATT_PRD_CSTR_PROJ_BASE
  81. </select>
  82. <select id="findList" resultMap="attPrdCstrProjBaseResultMap">
  83. select <include refid="table_columns" /> from ATT_PRD_CSTR_PROJ_BASE <include refid="page_where" />
  84. </select>
  85. <select id="selectCount" resultType="int" >
  86. select count(ID) from ATT_PRD_CSTR_PROJ_BASE <include refid="page_where" />
  87. </select>
  88. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttPrdCstrProjBase">
  89. insert into ATT_PRD_CSTR_PROJ_BASE( <include refid="table_columns" /> )
  90. values ( <include refid="entity_properties" /> )
  91. </insert>
  92. <delete id="delete" parameterType="java.lang.String">
  93. delete from ATT_PRD_CSTR_PROJ_BASE where ID = #{id}
  94. </delete>
  95. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttPrdCstrProjBase">
  96. delete from ATT_PRD_CSTR_PROJ_BASE <include refid="page_where" />
  97. </delete>
  98. <update id="deleteInFlag" parameterType="java.lang.String">
  99. update ATT_PRD_CSTR_PROJ_BASE set flag_valid = 0 where ID = #{id}
  100. </update>
  101. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttPrdCstrProjBase">
  102. update ATT_PRD_CSTR_PROJ_BASE
  103. <trim prefix="set" suffixOverrides=",">
  104. <if test="code != null and code != ''">CODE = #{code},</if>
  105. <if test="name != null and name != ''">NAME = #{name},</if>
  106. <if test="type != null and type != ''">TYPE = #{type},</if>
  107. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  108. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  109. <if test="location != null and location != ''">LOCATION = #{location},</if>
  110. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  111. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  112. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  113. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  114. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  115. <if test="intm != null">INTM = #{intm},</if>
  116. <if test="uptm != null">UPTM = #{uptm},</if>
  117. </trim>
  118. <where>ID = #{id}</where>
  119. </update>
  120. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttPrdCstrProjBase">
  121. update ATT_PRD_CSTR_PROJ_BASE
  122. <trim prefix="set" suffixOverrides=",">
  123. <if test="code != null and code != ''">CODE = #{code},</if>
  124. <if test="name != null and name != ''">NAME = #{name},</if>
  125. <if test="type != null and type != ''">TYPE = #{type},</if>
  126. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  127. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  128. <if test="location != null and location != ''">LOCATION = #{location},</if>
  129. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  130. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  131. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  132. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  133. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  134. <if test="intm != null">INTM = #{intm},</if>
  135. <if test="uptm != null">UPTM = #{uptm},</if>
  136. </trim>
  137. <include refid="page_where" />
  138. </update>
  139. <!-- 其他自定义SQL -->
  140. <select id="findListReg" parameterType="cn.com.goldenwater.dcproj.param.AttPrdCstrProjBaseParam" resultType="cn.com.goldenwater.dcproj.model.AttPrdCstrProjBase">
  141. 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,
  142. (case when r.center_y is null then e.center_y else r.center_y end) as center_y,r.state
  143. from ATT_PRD_CSTR_PROJ_BASE e,bis_insp_all_obj o,BIS_INSP_OPRD_CSTR_PROJ_RGSTR r
  144. where e.id=o.code and o.obj_id=r.obj_id
  145. <if test="state !=null and state !=''">
  146. and r.state=#{state}
  147. </if>
  148. <if test="province !=null and province !=''">
  149. and r.ad_code like '${province}%'
  150. </if>
  151. </select>
  152. </mapper>