AttEmpwtprjBaseDao.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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.AttEmpwtprjBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttEmpwtprjBase" id="attEmpwtprjBaseResultMap">
  5. <result property="adName" column="AD_NAME"/>
  6. <result property="buidTimeYear" column="BUID_TIME_YEAR"/>
  7. <result property="engSta" column="ENG_STA"/>
  8. <result property="id" column="ID"/>
  9. <result property="ptype" column="PTYPE"/>
  10. <result property="adCode" column="AD_CODE"/>
  11. <result property="nm" column="NM"/>
  12. <result property="stwktm" column="STWKTM"/>
  13. <result property="plantm" column="PLANTM"/>
  14. <result property="estapp" column="ESTAPP"/>
  15. <result property="sumApp" column="SUM_APP"/>
  16. <result property="planApp" column="PLAN_APP"/>
  17. <result property="lgtd" column="LGTD"/>
  18. <result property="lttd" column="LTTD"/>
  19. <result property="lgtdPc" column="LGTD_PC"/>
  20. <result property="lttdPc" column="LTTD_PC"/>
  21. <result property="intm" column="INTM"/>
  22. <result property="uptm" column="UPTM"/>
  23. <result property="note" column="NOTE"/>
  24. <result property="unitId" column="UNIT_ID"/>
  25. <result property="unitNm" column="UNIT_NM"/>
  26. <result property="engProfil" column="ENG_PROFIL"/>
  27. <result property="engBuild" column="ENG_BUILD"/>
  28. <result property="hstInsp" column="HST_INSP"/>
  29. <result property="fenjiUnit" column="FENJI_UNIT"/>
  30. </resultMap>
  31. <sql id="table_columns">
  32. AD_NAME,ENG_PROFIL,ENG_BUILD,HST_INSP,FENJI_UNIT,SUM_APP,PLAN_APP,
  33. BUID_TIME_YEAR,
  34. ENG_STA,
  35. ID,
  36. PTYPE,
  37. AD_CODE,
  38. NM,
  39. STWKTM,
  40. PLANTM,
  41. ESTAPP,
  42. LGTD,
  43. LTTD,
  44. LGTD_PC,
  45. LTTD_PC,
  46. INTM,
  47. UPTM,
  48. NOTE,
  49. UNIT_ID,
  50. UNIT_NM
  51. </sql>
  52. <sql id="entity_properties">
  53. #{adName}, #{engProfil}, #{engBuild}, #{hstInsp},#{fenjiUnit},#{sumApp},#{planApp},
  54. #{buidTimeYear},
  55. #{engSta},
  56. #{id},
  57. #{ptype},
  58. #{adCode},
  59. #{nm},
  60. #{stwktm},
  61. #{plantm},
  62. #{estapp},
  63. #{lgtd},
  64. #{lttd},
  65. #{lgtdPc},
  66. #{lttdPc},
  67. #{intm},
  68. #{uptm},
  69. #{note},
  70. #{unitId},
  71. #{unitNm}
  72. </sql>
  73. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  74. <sql id="page_where">
  75. <trim prefix="where" prefixOverrides="and | or ">
  76. <if test="buidTimeYear != null and buidTimeYear != ''">and BUID_TIME_YEAR = #{buidTimeYear}</if>
  77. <if test="engSta != null">and ENG_STA = #{engSta}</if>
  78. <if test="planApp != null">and PLAN_APP = #{planApp}</if>
  79. <if test="sumApp != null">and SUM_APP = #{sumApp}</if>
  80. <if test="fenjiUnit != null and fenjiUnit !=''">and fenji_Unit = #{fenjiUnit}</if>
  81. <if test="id != null and id != ''">and ID = #{id}</if>
  82. <if test="ptype != null and ptype != ''">and PTYPE = #{ptype}</if>
  83. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  84. <if test="nm != null and nm != ''">and NM = #{nm}</if>
  85. <if test="stwktm != null and stwktm != ''">and STWKTM = #{stwktm}</if>
  86. <if test="plantm != null and plantm != ''">and PLANTM = #{plantm}</if>
  87. <if test="estapp != null and estapp != ''">and ESTAPP = #{estapp}</if>
  88. <if test="lgtd != null and lgtd != ''">and LGTD = #{lgtd}</if>
  89. <if test="lttd != null and lttd != ''">and LTTD = #{lttd}</if>
  90. <if test="lgtdPc != null and lgtdPc != ''">and LGTD_PC = #{lgtdPc}</if>
  91. <if test="lttdPc != null and lttdPc != ''">and LTTD_PC = #{lttdPc}</if>
  92. <if test="intm != null">and INTM = #{intm}</if>
  93. <if test="uptm != null">and UPTM = #{uptm}</if>
  94. <if test="note != null and note != ''">and NOTE = #{note}</if>
  95. <if test="unitId != null and unitId != ''">and UNIT_ID = #{unitId}</if>
  96. <if test="unitNm != null and unitNm != ''">and UNIT_NM = #{unitNm}</if>
  97. <if test="engProfil != null and engProfil != ''">and eng_Profil = #{engProfil}</if>
  98. <if test="engBuild != null and engBuild != ''">and eng_Build = #{engBuild}</if>
  99. <if test="hstInsp != null and hstInsp != ''">and hst_Insp = #{hstInsp}</if>
  100. </trim>
  101. </sql>
  102. <select id="get" resultMap="attEmpwtprjBaseResultMap" parameterType="String">
  103. select
  104. <include refid="table_columns"/>
  105. from ATT_EMPWTPRJ_BASE where ID = #{id}
  106. </select>
  107. <select id="getBy" resultMap="attEmpwtprjBaseResultMap">
  108. select
  109. <include refid="table_columns"/>
  110. from ATT_EMPWTPRJ_BASE
  111. <include refid="page_where"/>
  112. </select>
  113. <select id="findAll" resultMap="attEmpwtprjBaseResultMap">
  114. select
  115. <include refid="table_columns"/>
  116. from ATT_EMPWTPRJ_BASE
  117. </select>
  118. <select id="findList" resultMap="attEmpwtprjBaseResultMap">
  119. select
  120. <include refid="table_columns"/>
  121. from ATT_EMPWTPRJ_BASE
  122. <include refid="page_where"/>
  123. </select>
  124. <select id="selectCount" resultType="int">
  125. select count(ID) from ATT_EMPWTPRJ_BASE
  126. <include refid="page_where"/>
  127. </select>
  128. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttEmpwtprjBase">
  129. insert into ATT_EMPWTPRJ_BASE(
  130. <include refid="table_columns"/>
  131. )
  132. values (
  133. <include refid="entity_properties"/>
  134. )
  135. </insert>
  136. <delete id="delete" parameterType="java.lang.String">
  137. delete from ATT_EMPWTPRJ_BASE where ID = #{id}
  138. </delete>
  139. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttEmpwtprjBase">
  140. delete from ATT_EMPWTPRJ_BASE
  141. <include refid="page_where"/>
  142. </delete>
  143. <update id="deleteInFlag" parameterType="java.lang.String">
  144. update ATT_EMPWTPRJ_BASE set flag_valid = 0 where ID = #{id}
  145. </update>
  146. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttEmpwtprjBase">
  147. update ATT_EMPWTPRJ_BASE
  148. <trim prefix="set" suffixOverrides=",">
  149. <if test="buidTimeYear != null and buidTimeYear != ''">BUID_TIME_YEAR = #{buidTimeYear},</if>
  150. <if test="engSta != null">ENG_STA = #{engSta},</if>
  151. <if test="id != null and id != ''">ID = #{id},</if>
  152. <if test="ptype != null and ptype != ''">PTYPE = #{ptype},</if>
  153. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  154. <if test="nm != null and nm != ''">NM = #{nm},</if>
  155. <if test="stwktm != null and stwktm != ''">STWKTM = #{stwktm},</if>
  156. <if test="plantm != null and plantm != ''">PLANTM = #{plantm},</if>
  157. <if test="estapp != null and estapp != ''">ESTAPP = #{estapp},</if>
  158. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  159. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  160. <if test="lgtdPc != null and lgtdPc != ''">LGTD_PC = #{lgtdPc},</if>
  161. <if test="lttdPc != null and lttdPc != ''">LTTD_PC = #{lttdPc},</if>
  162. <if test="intm != null">INTM = #{intm},</if>
  163. <if test="uptm != null">UPTM = #{uptm},</if>
  164. <if test="note != null and note != ''">NOTE = #{note},</if>
  165. <if test="unitId != null and unitId != ''">UNIT_ID = #{unitId},</if>
  166. <if test="unitNm != null and unitNm != ''">UNIT_NM = #{unitNm},</if>
  167. <if test="engProfil != null and engProfil != ''"> eng_Profil = #{engProfil},</if>
  168. <if test="engBuild != null and engBuild != ''"> eng_Build = #{engBuild},</if>
  169. <if test="hstInsp != null and hstInsp != ''"> hst_Insp = #{hstInsp},</if>
  170. <if test="fenjiUnit != null and fenjiUnit !=''"> FENJI_UNIT = #{fenjiUnit},</if>
  171. <if test="planApp != null"> PLAN_APP = #{planApp},</if>
  172. <if test="sumApp != null"> SUM_APP = #{sumApp},</if>
  173. </trim>
  174. <where>ID = #{id}</where>
  175. </update>
  176. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttEmpwtprjBase">
  177. update ATT_EMPWTPRJ_BASE
  178. <trim prefix="set" suffixOverrides=",">
  179. <if test="buidTimeYear != null and buidTimeYear != ''">BUID_TIME_YEAR = #{buidTimeYear},</if>
  180. <if test="engSta != null">ENG_STA = #{engSta},</if>
  181. <if test="id != null and id != ''">ID = #{id},</if>
  182. <if test="ptype != null and ptype != ''">PTYPE = #{ptype},</if>
  183. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  184. <if test="nm != null and nm != ''">NM = #{nm},</if>
  185. <if test="stwktm != null and stwktm != ''">STWKTM = #{stwktm},</if>
  186. <if test="plantm != null and plantm != ''">PLANTM = #{plantm},</if>
  187. <if test="estapp != null and estapp != ''">ESTAPP = #{estapp},</if>
  188. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  189. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  190. <if test="lgtdPc != null and lgtdPc != ''">LGTD_PC = #{lgtdPc},</if>
  191. <if test="lttdPc != null and lttdPc != ''">LTTD_PC = #{lttdPc},</if>
  192. <if test="intm != null">INTM = #{intm},</if>
  193. <if test="uptm != null">UPTM = #{uptm},</if>
  194. <if test="note != null and note != ''">NOTE = #{note},</if>
  195. <if test="unitId != null and unitId != ''">UNIT_ID = #{unitId},</if>
  196. <if test="unitNm != null and unitNm != ''">UNIT_NM = #{unitNm},</if>
  197. <if test="engProfil != null and engProfil != ''"> eng_Profil = #{engProfil},</if>
  198. <if test="engBuild != null and engBuild != ''"> eng_Build = #{engBuild},</if>
  199. <if test="hstInsp != null and hstInsp != ''"> hst_Insp = #{hstInsp},</if>
  200. <if test="fenjiUnit != null and fenjiUnit !=''"> FENJI_UNIT = #{fenjiUnit},</if>
  201. <if test="planApp != null"> PLAN_APP = #{planApp},</if>
  202. <if test="sumApp != null"> SUM_APP = #{sumApp},</if>
  203. </trim>
  204. <include refid="page_where"/>
  205. </update>
  206. <sql id="orgIdSql">
  207. <choose>
  208. <when test="orgId !=null and orgId !=''">
  209. and ORG_ID=#{orgId}
  210. </when>
  211. <otherwise>
  212. and ORG_ID is null
  213. </otherwise>
  214. </choose>
  215. </sql>
  216. <!-- 其他自定义SQL -->
  217. <select id="getObjByPersId" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam" resultType="cn.com.goldenwater.dcproj.model.AttEmpwtprjBase">
  218. SELECT A.ID,A.eng_Profil,A.eng_Build,A.hst_Insp,A.FENJI_UNIT,A.PLAN_APP,A.SUM_APP,
  219. A.PTYPE,
  220. A.AD_CODE,
  221. A.NM,
  222. A.STWKTM,
  223. A.PLANTM,
  224. A.ESTAPP,
  225. A.LGTD,
  226. A.LTTD,
  227. A.LGTD_PC,
  228. A.LTTD_PC,
  229. A.INTM,
  230. A.UPTM,
  231. A.NOTE,
  232. A.UNIT_ID,
  233. A.UNIT_NM,
  234. A.AD_NAME,
  235. A.ENG_STA,B.OBJ_ID,
  236. A.BUID_TIME_YEAR FROM ATT_EMPWTPRJ_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.ID = B.CODE
  237. WHERE B.PTYPE = #{objType}
  238. <choose>
  239. <when test="province !=null and province !=''">
  240. and B.AD_CODE=#{province}
  241. </when>
  242. <otherwise>
  243. and B.AD_CODE is null
  244. </otherwise>
  245. </choose>
  246. AND
  247. B.id in (${inIdsSql})
  248. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  249. <if test="stnm != null and stnm != ''">and A.NM LIKE '%${stnm}%'</if>
  250. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.LGTD_PC BETWEEN #{minLgtd} AND #{maxLgtd}</if>
  251. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.LTTD_PC BETWEEN #{minLttd} AND #{maxLttd}</if>
  252. </select>
  253. <select id="getObjListNotInspGroupId" parameterType="String" resultType="cn.com.goldenwater.dcproj.model.AttEmpwtprjBase" >
  254. select t.*
  255. from ATT_EMPWTPRJ_BASE t
  256. where t.id not in (
  257. select CODE from BIS_INSP_ALL_OBJ B where id like concat(#{inspGroupId},'%') and B.obj_type=#{objType}
  258. <choose>
  259. <when test="province !=null and province !=''">
  260. and B.AD_CODE =#{province}
  261. </when>
  262. <otherwise>
  263. and B.AD_CODE is null
  264. </otherwise>
  265. </choose>
  266. )
  267. <if test="adName != null and adName != ''">and t.nm LIKE '%${adName}%'</if>
  268. <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
  269. </select>
  270. </mapper>