BisInspPlanDao.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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.BisInspPlanDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspPlan" id="bisInspPlanResultMap">
  5. <result property="plnaId" column="PLNA_ID"/>
  6. <result property="guid" column="GUID"/>
  7. <result property="prsnTitle" column="PRSN_TITLE"/>
  8. <result property="palnExp" column="PALN_EXP"/>
  9. <result property="prsnId" column="PRSN_ID"/>
  10. <result property="palnSttm" column="PALN_STTM"/>
  11. <result property="palnEntm" column="PALN_ENTM"/>
  12. <result property="palnState" column="PALN_STATE"/>
  13. <result property="intm" column="INTM"/>
  14. <result property="uptm" column="UPTM"/>
  15. <result property="note" column="NOTE"/>
  16. </resultMap>
  17. <resultMap type="cn.com.goldenwater.dcproj.dto.BisInspGroupDto" id="bisInspGroupDtoResultMap">
  18. <result property="inspGroupId" column="INSP_GROUP_ID"/>
  19. <result property="plnaId" column="PLNA_ID"/>
  20. <result property="guid" column="GUID"/>
  21. <result property="inspGroupName" column="INSP_GROUP_NAME"/>
  22. <result property="downStat" column="DOWN_STAT"/>
  23. <result property="dataStat" column="DATA_STAT"/>
  24. <result property="collTime" column="COLL_TIME"/>
  25. <result property="recPers" column="REC_PERS"/>
  26. <association property="bisInspPlan" javaType="cn.com.goldenwater.dcproj.model.BisInspPlan">
  27. <result property="plnaId" column="PLNA_ID"/>
  28. <result property="guid" column="PLAN_GUID"/>
  29. <result property="prsnTitle" column="PRSN_TITLE"/>
  30. <result property="palnExp" column="PALN_EXP"/>
  31. <result property="prsnId" column="PRSN_ID"/>
  32. <result property="palnSttm" column="PALN_STTM"/>
  33. <result property="palnEntm" column="PALN_ENTM"/>
  34. <result property="palnState" column="PALN_STATE"/>
  35. <result property="intm" column="INTM"/>
  36. <result property="uptm" column="UPTM"/>
  37. <result property="note" column="NOTE"/>
  38. </association>
  39. </resultMap>
  40. <sql id="table_columns">
  41. PLNA_ID,
  42. GUID,
  43. PRSN_TITLE,
  44. PALN_EXP,
  45. PRSN_ID,
  46. PALN_STTM,
  47. PALN_ENTM,
  48. PALN_STATE,
  49. INTM,
  50. UPTM,
  51. NOTE
  52. </sql>
  53. <sql id="entity_properties">
  54. #{plnaId},
  55. #{guid},
  56. #{prsnTitle},
  57. #{palnExp},
  58. #{prsnId},
  59. #{palnSttm},
  60. #{palnEntm},
  61. #{palnState},
  62. #{intm},
  63. #{uptm},
  64. #{note}
  65. </sql>
  66. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  67. <sql id="page_where">
  68. <trim prefix="where" prefixOverrides="and | or ">
  69. <if test="guid != null and guid != ''">and GUID = #{guid}</if>
  70. <if test="prsnTitle != null and prsnTitle != ''">and PRSN_TITLE = #{prsnTitle}</if>
  71. <if test="palnExp != null and palnExp != ''">and PALN_EXP = #{palnExp}</if>
  72. <if test="prsnId != null and prsnId != ''">and PRSN_ID = #{prsnId}</if>
  73. <if test="palnSttm != null">and PALN_STTM = #{palnSttm}</if>
  74. <if test="palnEntm != null">and PALN_ENTM = #{palnEntm}</if>
  75. <if test="palnState != null and palnState != ''">and PALN_STATE = #{palnState}</if>
  76. <if test="intm != null">and INTM = #{intm}</if>
  77. <if test="uptm != null">and UPTM = #{uptm}</if>
  78. <if test="note != null and note != ''">and NOTE = #{note}</if>
  79. </trim>
  80. </sql>
  81. <select id="get" resultMap="bisInspPlanResultMap" parameterType="String">
  82. select
  83. <include refid="table_columns"/>
  84. from BIS_INSP_PLAN where GUID = #{id}
  85. </select>
  86. <select id="getBy" resultMap="bisInspPlanResultMap">
  87. select
  88. <include refid="table_columns"/>
  89. from BIS_INSP_PLAN
  90. <include refid="page_where"/>
  91. </select>
  92. <select id="findAll" resultMap="bisInspPlanResultMap">
  93. select
  94. <include refid="table_columns"/>
  95. from BIS_INSP_PLAN
  96. </select>
  97. <select id="findList" resultMap="bisInspPlanResultMap">
  98. select
  99. <include refid="table_columns"/>
  100. from BIS_INSP_PLAN
  101. <include refid="page_where"/>
  102. </select>
  103. <select id="selectCount" resultType="int">
  104. select count(ID) from BIS_INSP_PLAN
  105. <include refid="page_where"/>
  106. </select>
  107. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlan">
  108. insert into BIS_INSP_PLAN(
  109. <include refid="table_columns"/>
  110. )
  111. values (
  112. <include refid="entity_properties"/>
  113. )
  114. </insert>
  115. <delete id="delete" parameterType="java.lang.String">
  116. delete from BIS_INSP_PLAN where PLNA_ID = #{id}
  117. </delete>
  118. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlan">
  119. delete from BIS_INSP_PLAN
  120. <include refid="page_where"/>
  121. </delete>
  122. <update id="deleteInFlag" parameterType="java.lang.String">
  123. update BIS_INSP_PLAN set flag_valid = 0 where ID = #{id}
  124. </update>
  125. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlan">
  126. update BIS_INSP_PLAN
  127. <trim prefix="set" suffixOverrides=",">
  128. <if test="guid != null and guid != ''">GUID = #{guid},</if>
  129. <if test="prsnTitle != null and prsnTitle != ''">PRSN_TITLE = #{prsnTitle},</if>
  130. <if test="palnExp != null and palnExp != ''">PALN_EXP = #{palnExp},</if>
  131. <if test="prsnId != null and prsnId != ''">PRSN_ID = #{prsnId},</if>
  132. <if test="palnSttm != null">PALN_STTM = #{palnSttm},</if>
  133. <if test="palnEntm != null">PALN_ENTM = #{palnEntm},</if>
  134. <if test="palnState != null and palnState != ''">PALN_STATE = #{palnState},</if>
  135. <if test="intm != null">INTM = #{intm},</if>
  136. <if test="uptm != null">UPTM = #{uptm},</if>
  137. <if test="note != null and note != ''">NOTE = #{note},</if>
  138. </trim>
  139. <where>ID = #{id}</where>
  140. </update>
  141. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlan">
  142. update BIS_INSP_PLAN
  143. <trim prefix="set" suffixOverrides=",">
  144. <if test="guid != null and guid != ''">GUID = #{guid},</if>
  145. <if test="prsnTitle != null and prsnTitle != ''">PRSN_TITLE = #{prsnTitle},</if>
  146. <if test="palnExp != null and palnExp != ''">PALN_EXP = #{palnExp},</if>
  147. <if test="prsnId != null and prsnId != ''">PRSN_ID = #{prsnId},</if>
  148. <if test="palnSttm != null">PALN_STTM = #{palnSttm},</if>
  149. <if test="palnEntm != null">PALN_ENTM = #{palnEntm},</if>
  150. <if test="palnState != null and palnState != ''">PALN_STATE = #{palnState},</if>
  151. <if test="intm != null">INTM = #{intm},</if>
  152. <if test="uptm != null">UPTM = #{uptm},</if>
  153. <if test="note != null and note != ''">NOTE = #{note},</if>
  154. </trim>
  155. <include refid="page_where"/>
  156. </update>
  157. <!-- 其他自定义SQL -->
  158. <!--根据人员id查批次-->
  159. <select id="findListByUserId" resultType="cn.com.goldenwater.dcproj.model.BisInspPlan">
  160. select t.*
  161. from BIS_INSP_PLAN t
  162. left join BIS_INSP_GROUP g
  163. on t.plna_id = g.plna_id
  164. left join REL_PERS_INSPGROUP rel
  165. on rel.insp_group_id = g.insp_group_id
  166. left join ATT_PERS_BASE p
  167. on p.guid = rel.pers_id
  168. left join GW_SYS_USER u
  169. on u.ofc_id = p.guid
  170. where u.id = #{userId}
  171. </select>
  172. <!--根据人员id查批次-->
  173. <select id="findListByPersId" resultMap="bisInspGroupDtoResultMap">
  174. select g.*,t.PLNA_ID,t.GUID PLAN_GUID,t.PRSN_TITLE,t.PALN_EXP,
  175. t.PRSN_ID,t.PALN_STTM,t.PALN_ENTM,t.PALN_STATE,t.INTM,t.UPTM
  176. from BIS_INSP_PLAN t
  177. left join BIS_INSP_GROUP g
  178. on t.plna_id = g.plna_id
  179. left join REL_PERS_INSPGROUP rel
  180. on rel.insp_group_id = g.insp_group_id
  181. where rel.pers_id = #{persId}
  182. </select>
  183. <sql id="choseSql">
  184. <choose>
  185. <when test="province !=null and province !=''">
  186. and ad_code=#{province}
  187. </when>
  188. <otherwise>
  189. and ad_code is null
  190. </otherwise>
  191. </choose>
  192. </sql>
  193. <select id="getAllRlation" resultType="cn.com.goldenwater.dcproj.model.BisInspAllRlation">
  194. SELECT * FROM BIS_INSP_ALL_RLATION WHERE ID LIKE '${id}%'
  195. <include refid="choseSql"/>
  196. </select>
  197. <select id="getAllObj" resultType="cn.com.goldenwater.dcproj.model.BisInspAllObj">
  198. SELECT * FROM BIS_INSP_ALL_OBJ WHERE ID LIKE '${id}%'
  199. <include refid="choseSql"/>
  200. </select>
  201. <select id="getAllArea" resultType="cn.com.goldenwater.dcproj.model.BisInspSelArea">
  202. SELECT * FROM BIS_INSP_SEL_AREA WHERE ID LIKE '${id}%'
  203. <if test="province !=null and province !=''">
  204. AND ORG_ID=#{orgId}
  205. </if>
  206. </select>
  207. </mapper>