BisInspVlgdrinkFacOperDao.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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.BisInspVlgdrinkFacOperDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspVlgdrinkFacOper" id="bisInspVlgdrinkFacOperResultMap">
  5. <result property="adnm" column="ADNM"/>
  6. <result property="runstseId" column="RUNSTSE_ID"/>
  7. <result property="engId" column="ENG_ID"/>
  8. <result property="adCode" column="AD_CODE"/>
  9. <result property="isNdAdmin" column="IS_ND_ADMIN"/>
  10. <result property="isAdmin" column="IS_ADMIN"/>
  11. <result property="adminNm" column="ADMIN_NM"/>
  12. <result property="adminAge" column="ADMIN_AGE"/>
  13. <result property="adminPro" column="ADMIN_PRO"/>
  14. <result property="salary" column="SALARY"/>
  15. <result property="operFee" column="OPER_FEE"/>
  16. <result property="otherFeeOrg" column="OTHER_FEE_ORG"/>
  17. <result property="feeCommons" column="FEE_COMMONS"/>
  18. <result property="visitDate" column="VISIT_DATE"/>
  19. <result property="recPersId" column="REC_PERS_ID"/>
  20. <result property="recPers2" column="REC_PERS2"/>
  21. <result property="recPersTel" column="REC_PERS_TEL"/>
  22. <result property="createTime" column="CREATE_TIME"/>
  23. <result property="updateTime" column="UPDATE_TIME"/>
  24. <result property="status" column="STATUS"/>
  25. <result property="isComMng" column="IS_COM_MNG"/>
  26. </resultMap>
  27. <sql id="table_columns">
  28. ADNM ,
  29. RUNSTSE_ID ,
  30. ENG_ID ,
  31. AD_CODE ,
  32. IS_ND_ADMIN ,
  33. IS_ADMIN ,
  34. ADMIN_NM ,
  35. ADMIN_AGE ,
  36. ADMIN_PRO ,
  37. SALARY ,
  38. OPER_FEE ,
  39. OTHER_FEE_ORG ,
  40. FEE_COMMONS ,
  41. TO_CHAR(VISIT_DATE,'YYYY-MM-DD') VISIT_DATE,
  42. REC_PERS_ID ,
  43. REC_PERS2 ,
  44. REC_PERS_TEL ,
  45. TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
  46. TO_CHAR(UPDATE_TIME,'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
  47. STATUS,
  48. IS_COM_MNG
  49. </sql>
  50. <sql id="table_columns2">
  51. ADNM ,
  52. RUNSTSE_ID ,
  53. ENG_ID ,
  54. AD_CODE ,
  55. IS_ND_ADMIN ,
  56. IS_ADMIN ,
  57. ADMIN_NM ,
  58. ADMIN_AGE ,
  59. ADMIN_PRO ,
  60. SALARY ,
  61. OPER_FEE ,
  62. OTHER_FEE_ORG ,
  63. FEE_COMMONS ,
  64. VISIT_DATE ,
  65. REC_PERS_ID ,
  66. REC_PERS2 ,
  67. REC_PERS_TEL ,
  68. CREATE_TIME ,
  69. UPDATE_TIME ,
  70. STATUS,
  71. IS_COM_MNG
  72. </sql>
  73. <sql id="entity_properties">
  74. #{adnm},
  75. #{runstseId},
  76. #{engId},
  77. #{adCode},
  78. #{isNdAdmin},
  79. #{isAdmin},
  80. #{adminNm},
  81. #{adminAge},
  82. #{adminPro},
  83. #{salary},
  84. #{operFee},
  85. #{otherFeeOrg},
  86. #{feeCommons},
  87. TO_DATE(#{visitDate},'YYYY-MM-DD'),
  88. #{recPersId},
  89. #{recPers2},
  90. #{recPersTel},
  91. TO_DATE(#{createTime},'YYYY-MM-DD HH24:MI:SS') ,
  92. TO_DATE(#{updateTime},'YYYY-MM-DD HH24:MI:SS') ,
  93. #{status},
  94. #{isComMng}
  95. </sql>
  96. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  97. <sql id="page_where">
  98. <trim prefix="where" prefixOverrides="and | or ">
  99. <if test="adnm != null and adnm != ''">and ADNM = #{adnm}</if>
  100. <if test="runstseId != null and runstseId != ''">and RUNSTSE_ID = #{runstseId}</if>
  101. <if test="engId != null and engId != ''">and ENG_ID = #{engId}</if>
  102. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  103. <if test="isNdAdmin != null and isNdAdmin != ''">and IS_ND_ADMIN = #{isNdAdmin}</if>
  104. <if test="isAdmin != null and isAdmin != ''">and IS_ADMIN = #{isAdmin}</if>
  105. <if test="adminNm != null and adminNm != ''">and ADMIN_NM = #{adminNm}</if>
  106. <if test="adminAge != null and adminAge != ''">and ADMIN_AGE = #{adminAge}</if>
  107. <if test="adminPro != null and adminPro != ''">and ADMIN_PRO = #{adminPro}</if>
  108. <if test="salary != null and salary != ''">and SALARY = #{salary}</if>
  109. <if test="operFee != null and operFee != ''">and OPER_FEE = #{operFee}</if>
  110. <if test="otherFeeOrg != null and otherFeeOrg != ''">and OTHER_FEE_ORG = #{otherFeeOrg}</if>
  111. <if test="feeCommons != null and feeCommons != ''">and FEE_COMMONS = #{feeCommons}</if>
  112. <if test="visitDate != null and visitDate != ''">and VISIT_DATE = TO_DATE(#{visitDate},'YYYY-MM-DD')</if>
  113. <if test="recPersId != null and recPersId != ''">and REC_PERS_ID = #{recPersId}</if>
  114. <if test="recPers2 != null and recPers2 != ''">and REC_PERS2 = #{recPers2}</if>
  115. <if test="recPersTel != null and recPersTel != ''">and REC_PERS_TEL = #{recPersTel}</if>
  116. <if test="createTime != null and createTime != ''">and CREATE_TIME = TO_DATE(#{createTime},'YYYY-MM-DD
  117. HH24:MI:SS')
  118. </if>
  119. <if test="updateTime != null and updateTime != ''">and UPDATE_TIME = TO_DATE(#{updateTime},'YYYY-MM-DD
  120. HH24:MI:SS')
  121. </if>
  122. <if test="status != null and status != ''">and STATUS = #{status}</if>
  123. <if test="isComMng != null and isComMng != ''">and IS_COM_MNG = #{isComMng}</if>
  124. </trim>
  125. </sql>
  126. <select id="get" resultMap="bisInspVlgdrinkFacOperResultMap" parameterType="String">
  127. select
  128. <include refid="table_columns"/>
  129. from BIS_INSP_VLGDRINK_FAC_OPER where RUNSTSE_ID = #{id}
  130. </select>
  131. <select id="getBy" resultMap="bisInspVlgdrinkFacOperResultMap">
  132. select
  133. <include refid="table_columns"/>
  134. from BIS_INSP_VLGDRINK_FAC_OPER
  135. <include refid="page_where"/>
  136. </select>
  137. <select id="findAll" resultMap="bisInspVlgdrinkFacOperResultMap">
  138. select
  139. <include refid="table_columns"/>
  140. from BIS_INSP_VLGDRINK_FAC_OPER
  141. </select>
  142. <select id="findList" resultMap="bisInspVlgdrinkFacOperResultMap">
  143. select
  144. <include refid="table_columns"/>
  145. from BIS_INSP_VLGDRINK_FAC_OPER
  146. <include refid="page_where"/>
  147. ORDER BY UPDATE_TIME DESC
  148. </select>
  149. <select id="selectCount" resultType="int">
  150. select count(RUNSTSE_ID) from BIS_INSP_VLGDRINK_FAC_OPER
  151. <include refid="page_where"/>
  152. </select>
  153. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspVlgdrinkFacOper">
  154. insert into BIS_INSP_VLGDRINK_FAC_OPER(
  155. <include refid="table_columns2"/>
  156. )
  157. values (
  158. <include refid="entity_properties"/>
  159. )
  160. </insert>
  161. <delete id="delete" parameterType="java.lang.String">
  162. delete from BIS_INSP_VLGDRINK_FAC_OPER where RUNSTSE_ID = #{id}
  163. </delete>
  164. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspVlgdrinkFacOper">
  165. delete from BIS_INSP_VLGDRINK_FAC_OPER
  166. <include refid="page_where"/>
  167. </delete>
  168. <update id="deleteInFlag" parameterType="java.lang.String">
  169. update BIS_INSP_VLGDRINK_FAC_OPER set flag_valid = 0 where RUNSTSE_ID = #{id}
  170. </update>
  171. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspVlgdrinkFacOper">
  172. update BIS_INSP_VLGDRINK_FAC_OPER
  173. <trim prefix="set" suffixOverrides=",">
  174. <if test="adnm != null and adnm != ''">ADNM = #{adnm},</if>
  175. <if test="engId != null and engId != ''">ENG_ID = #{engId},</if>
  176. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  177. <if test="isNdAdmin != null and isNdAdmin != ''">IS_ND_ADMIN = #{isNdAdmin},</if>
  178. <if test="isAdmin != null and isAdmin != ''">IS_ADMIN = #{isAdmin},</if>
  179. <if test="adminNm != null and adminNm != ''">ADMIN_NM = #{adminNm},</if>
  180. <if test="adminAge != null and adminAge != ''">ADMIN_AGE = #{adminAge},</if>
  181. <if test="adminPro != null and adminPro != ''">ADMIN_PRO = #{adminPro},</if>
  182. <if test="salary != null and salary != ''">SALARY = #{salary},</if>
  183. <if test="operFee != null and operFee != ''">OPER_FEE = #{operFee},</if>
  184. <if test="otherFeeOrg != null and otherFeeOrg != ''">OTHER_FEE_ORG = #{otherFeeOrg},</if>
  185. <if test="feeCommons != null and feeCommons != ''">FEE_COMMONS = #{feeCommons},</if>
  186. <if test="visitDate != null and visitDate != ''">VISIT_DATE = TO_DATE(#{visitDate},'YYYY-MM-DD'),</if>
  187. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  188. <if test="recPers2 != null and recPers2 != ''">REC_PERS2 = #{recPers2},</if>
  189. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  190. <if test="createTime != null and createTime != ''">CREATE_TIME = TO_DATE(#{createTime},'YYYY-MM-DD
  191. HH24:MI:SS'),
  192. </if>
  193. <if test="updateTime != null and updateTime != ''">UPDATE_TIME = TO_DATE(#{updateTime},'YYYY-MM-DD
  194. HH24:MI:SS'),
  195. </if>
  196. <if test="status != null and status != ''">STATUS = #{status},</if>
  197. <if test="isComMng != null and isComMng != ''">IS_COM_MNG = #{isComMng},</if>
  198. </trim>
  199. <where>RUNSTSE_ID = #{runstseId}</where>
  200. </update>
  201. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspVlgdrinkFacOper">
  202. update BIS_INSP_VLGDRINK_FAC_OPER
  203. <trim prefix="set" suffixOverrides=",">
  204. <if test="adnm != null and adnm != ''">ADNM = #{adnm},</if>
  205. <if test="engId != null and engId != ''">ENG_ID = #{engId},</if>
  206. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  207. <if test="isNdAdmin != null and isNdAdmin != ''">IS_ND_ADMIN = #{isNdAdmin},</if>
  208. <if test="isAdmin != null and isAdmin != ''">IS_ADMIN = #{isAdmin},</if>
  209. <if test="adminNm != null and adminNm != ''">ADMIN_NM = #{adminNm},</if>
  210. <if test="adminAge != null and adminAge != ''">ADMIN_AGE = #{adminAge},</if>
  211. <if test="adminPro != null and adminPro != ''">ADMIN_PRO = #{adminPro},</if>
  212. <if test="salary != null and salary != ''">SALARY = #{salary},</if>
  213. <if test="operFee != null and operFee != ''">OPER_FEE = #{operFee},</if>
  214. <if test="otherFeeOrg != null and otherFeeOrg != ''">OTHER_FEE_ORG = #{otherFeeOrg},</if>
  215. <if test="feeCommons != null and feeCommons != ''">FEE_COMMONS = #{feeCommons},</if>
  216. <if test="visitDate != null and visitDate != ''">VISIT_DATE = TO_DATE(#{visitDate},'YYYY-MM-DD'),</if>
  217. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  218. <if test="recPers2 != null and recPers2 != ''">REC_PERS2 = #{recPers2},</if>
  219. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  220. <if test="createTime != null and createTime != ''">CREATE_TIME = TO_DATE(#{createTime},'YYYY-MM-DD
  221. HH24:MI:SS'),
  222. </if>
  223. <if test="updateTime != null and updateTime != ''">UPDATE_TIME = TO_DATE(#{updateTime},'YYYY-MM-DD
  224. HH24:MI:SS'),
  225. </if>
  226. <if test="status != null and status != ''">STATUS = #{status},</if>
  227. <if test="isComMng != null and isComMng != ''">IS_COM_MNG = #{isComMng},</if>
  228. </trim>
  229. <include refid="page_where"/>
  230. </update>
  231. <!-- 其他自定义SQL -->
  232. <select id="getListByCodeAndPerId" parameterType="cn.com.goldenwater.dcproj.dto.VillRgstrDto"
  233. resultType="cn.com.goldenwater.dcproj.model.BisInspVlgdrinkFacOper">
  234. SELECT * FROM BIS_INSP_VLGDRINK_FAC_OPER A LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID = B.ENG_ID
  235. LEFT JOIN BIS_INSP_ALL_OBJ C ON B.OBJ_ID = C.OBJ_ID
  236. WHERE
  237. <!--
  238. REGEXP_LIKE(
  239. C.Id,(SELECT LISTAGG(id, '|') WITHIN GROUP(ORDER BY PERSID) as id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persId})
  240. )
  241. -->
  242. REGEXP_LIKE(
  243. C.Id,'^('||
  244. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId})>0 then
  245. (SELECT LISTAGG(id, '|') as
  246. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId} group by persid)
  247. else (select 'non' from dual) end)
  248. ||')')
  249. AND C.CODE LIKE '${adCode}%' AND C.PTYPE = '2'
  250. </select>
  251. <select id="getPageByNodeId" parameterType="cn.com.goldenwater.dcproj.param.GetVillPageByNodeIdParam"
  252. resultType="cn.com.goldenwater.dcproj.dto.BisInspVlgdrinkFacOperDcdxDto">
  253. select A.ADNM ,
  254. A.RUNSTSE_ID ,
  255. A.ENG_ID ,
  256. A.AD_CODE ,
  257. A.IS_ND_ADMIN ,
  258. A.IS_ADMIN ,
  259. A.ADMIN_NM ,
  260. A.ADMIN_AGE ,
  261. A.ADMIN_PRO ,
  262. A.SALARY ,
  263. A.OPER_FEE ,
  264. A.OTHER_FEE_ORG ,
  265. A.FEE_COMMONS ,
  266. TO_CHAR(A.VISIT_DATE,'YYYY-MM-DD') VISIT_DATE,
  267. A.REC_PERS_ID ,
  268. A.REC_PERS2 ,
  269. A.REC_PERS_TEL ,
  270. TO_CHAR(A.CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
  271. TO_CHAR(A.UPDATE_TIME,'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
  272. A.STATUS,
  273. A.IS_COM_MNG,D.PNM GROUP_NM,F.PNM CHKCOM,H.AD_NAME TOWN,I.AD_NAME COUNTY,J.AD_NAME CITY,K.AD_NAME PROVINCE from
  274. BIS_INSP_VLGDRINK_FAC_OPER A
  275. LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID=B.ENG_ID LEFT JOIN bis_insp_all_obj C ON B.OBJ_ID=C.OBJ_ID
  276. LEFT JOIN BIS_INSP_ALL D ON C.ID=D.ID LEFT JOIN BIS_INSP_ALL E ON D.PID=E.ID LEFT JOIN BIS_INSP_ALL F ON
  277. E.PID=F.ID
  278. LEFT JOIN ATT_AD_X_BASE G ON A.AD_CODE=G.AD_CODE LEFT JOIN ATT_AD_X_BASE H ON G.AD_FCODE=H.AD_CODE
  279. LEFT JOIN ATT_AD_X_BASE I ON H.AD_FCODE=I.AD_CODE LEFT JOIN ATT_AD_X_BASE J ON I.AD_FCODE=J.AD_CODE
  280. LEFT JOIN ATT_AD_X_BASE K ON J.AD_FCODE=K.AD_CODE WHERE 1=1
  281. <if test="nodeId != null and nodeId != ''">
  282. and C.ID like #{nodeId}||'%'
  283. </if>
  284. <if test="startDate != null and startDate != ''">
  285. AND A.VISIT_DATE &gt;=TO_DATE(#{startDate},'YYYY-MM-DD')
  286. </if>
  287. <if test="endDate != null and endDate != ''">
  288. AND A.VISIT_DATE &lt;TO_DATE(#{endDate},'YYYY-MM-DD')+1
  289. </if>
  290. <if test="chkComId != null and chkComId != ''">
  291. AND F.ID =#{chkComId}
  292. </if>
  293. <if test="groupId != null and groupId != ''">
  294. AND D.ID =#{groupId}
  295. </if>
  296. <if test="adNm != null and adNm != ''">
  297. AND( A.ADNM LIKE '%'||#{adNm}||'%' OR H.AD_NAME LIKE '%'||#{adNm}||'%' OR I.AD_NAME LIKE '%'||#{adNm}||'%'
  298. OR J.AD_NAME LIKE '%'||#{adNm}||'%' OR K.AD_NAME LIKE '%'||#{adNm}||'%')
  299. </if>
  300. ORDER BY A.UPDATE_TIME DESC,A.VISIT_DATE DESC
  301. </select>
  302. </mapper>