BisInspManageResponsibilityDao.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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.BisInspManageResponsibilityDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspManageResponsibility"
  5. id="bisInspManageResponsibilityResultMap">
  6. <result property="accompany" column="ACCOMPANY"/>
  7. <result property="mngrId" column="MNGR_ID"/>
  8. <result property="engId" column="ENG_ID"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="personAmount" column="PERSON_AMOUNT"/>
  11. <result property="focusSupplyPerc" column="FOCUS_SUPPLY_PERC"/>
  12. <result property="waterSupplyPerc" column="WATER_SUPPLY_PERC"/>
  13. <result property="isGovRes" column="IS_GOV_RES"/>
  14. <result property="isConRes" column="IS_CON_RES"/>
  15. <result property="isDeptRes" column="IS_DEPT_RES"/>
  16. <result property="isCntyDept" column="IS_CNTY_DEPT"/>
  17. <result property="isCntyFunc" column="IS_CNTY_FUNC"/>
  18. <result property="isCntyFee" column="IS_CNTY_FEE"/>
  19. <result property="isQuailtyChk" column="IS_QUAILTY_CHK"/>
  20. <result property="pracFee" column="PRAC_FEE"/>
  21. <result property="visitDate" column="VISIT_DATE"/>
  22. <result property="visitorId" column="VISITOR_ID"/>
  23. <result property="recPersId" column="REC_PERS_ID"/>
  24. <result property="recPers2" column="REC_PERS2"/>
  25. <result property="recPersTel" column="REC_PERS_TEL"/>
  26. <result property="createTime" column="CREATE_TIME"/>
  27. <result property="updateTime" column="UPDATE_TIME"/>
  28. <result property="status" column="STATUS"/>
  29. </resultMap>
  30. <sql id="table_columns">
  31. ACCOMPANY ,
  32. MNGR_ID ,
  33. ENG_ID ,
  34. AD_CODE ,
  35. PERSON_AMOUNT ,
  36. FOCUS_SUPPLY_PERC ,
  37. WATER_SUPPLY_PERC ,
  38. IS_GOV_RES ,
  39. IS_CON_RES ,
  40. IS_DEPT_RES ,
  41. IS_CNTY_DEPT ,
  42. IS_CNTY_FUNC ,
  43. IS_CNTY_FEE ,
  44. IS_QUAILTY_CHK ,
  45. PRAC_FEE ,
  46. DATE_FORMAT(VISIT_DATE,'%Y-%m-%d') VISIT_DATE,
  47. VISITOR_ID ,
  48. REC_PERS_ID ,
  49. REC_PERS2 ,
  50. REC_PERS_TEL ,
  51. DATE_FORMAT(CREATE_TIME,'%Y-%m-%d %H:%i:%s') CREATE_TIME,
  52. DATE_FORMAT(UPDATE_TIME,'%Y-%m-%d %H:%i:%s') UPDATE_TIME,
  53. STATUS
  54. </sql>
  55. <sql id="table_columns2">
  56. ACCOMPANY ,
  57. MNGR_ID ,
  58. ENG_ID ,
  59. AD_CODE ,
  60. PERSON_AMOUNT ,
  61. FOCUS_SUPPLY_PERC ,
  62. WATER_SUPPLY_PERC ,
  63. IS_GOV_RES ,
  64. IS_CON_RES ,
  65. IS_DEPT_RES ,
  66. IS_CNTY_DEPT ,
  67. IS_CNTY_FUNC ,
  68. IS_CNTY_FEE ,
  69. IS_QUAILTY_CHK ,
  70. PRAC_FEE ,
  71. VISIT_DATE ,
  72. VISITOR_ID ,
  73. REC_PERS_ID ,
  74. REC_PERS2 ,
  75. REC_PERS_TEL ,
  76. CREATE_TIME ,
  77. UPDATE_TIME ,
  78. STATUS
  79. </sql>
  80. <sql id="entity_properties">
  81. #{accompany},
  82. #{mngrId},
  83. #{engId},
  84. #{adCode},
  85. #{personAmount},
  86. #{focusSupplyPerc},
  87. #{waterSupplyPerc},
  88. #{isGovRes},
  89. #{isConRes},
  90. #{isDeptRes},
  91. #{isCntyDept},
  92. #{isCntyFunc},
  93. #{isCntyFee},
  94. #{isQuailtyChk},
  95. #{pracFee},
  96. STR_TO_DATE(#{visitDate},'%Y-%m-%d'),
  97. #{visitorId},
  98. #{recPersId},
  99. #{recPers2},
  100. #{recPersTel},
  101. STR_TO_DATE(#{createTime},'%Y-%m-%d %H:%i:%s') ,
  102. STR_TO_DATE(#{updateTime},'%Y-%m-%d %H:%i:%s') ,
  103. #{status}
  104. </sql>
  105. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  106. <sql id="page_where">
  107. <trim prefix="where" prefixOverrides="and | or ">
  108. <if test="accompany != null and accompany != ''">and ACCOMPANY = #{accompany}</if>
  109. <if test="mngrId != null and mngrId != ''">and MNGR_ID = #{mngrId}</if>
  110. <if test="engId != null and engId != ''">and ENG_ID = #{engId}</if>
  111. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  112. <if test="personAmount != null and personAmount != ''">and PERSON_AMOUNT = #{personAmount}</if>
  113. <if test="focusSupplyPerc != null and focusSupplyPerc != ''">and FOCUS_SUPPLY_PERC = #{focusSupplyPerc}</if>
  114. <if test="waterSupplyPerc != null and waterSupplyPerc != ''">and WATER_SUPPLY_PERC = #{waterSupplyPerc}</if>
  115. <if test="isGovRes != null and isGovRes != ''">and IS_GOV_RES = #{isGovRes}</if>
  116. <if test="isConRes != null and isConRes != ''">and IS_CON_RES = #{isConRes}</if>
  117. <if test="isDeptRes != null and isDeptRes != ''">and IS_DEPT_RES = #{isDeptRes}</if>
  118. <if test="isCntyDept != null and isCntyDept != ''">and IS_CNTY_DEPT = #{isCntyDept}</if>
  119. <if test="isCntyFunc != null and isCntyFunc != ''">and IS_CNTY_FUNC = #{isCntyFunc}</if>
  120. <if test="isCntyFee != null and isCntyFee != ''">and IS_CNTY_FEE = #{isCntyFee}</if>
  121. <if test="isQuailtyChk != null and isQuailtyChk != ''">and IS_QUAILTY_CHK = #{isQuailtyChk}</if>
  122. <if test="pracFee != null and pracFee != ''">and PRAC_FEE = #{pracFee}</if>
  123. <if test="visitDate != null and visitDate != ''">and VISIT_DATE = STR_TO_DATE(#{visitDate},'%Y-%m-%d')</if>
  124. <if test="visitorId != null and visitorId != ''">and VISITOR_ID = #{visitorId}</if>
  125. <if test="recPersId != null and recPersId != ''">and REC_PERS_ID = #{recPersId}</if>
  126. <if test="recPers2 != null and recPers2 != ''">and REC_PERS2 = #{recPers2}</if>
  127. <if test="recPersTel != null and recPersTel != ''">and REC_PERS_TEL = #{recPersTel}</if>
  128. <if test="createTime != null and createTime != ''">and CREATE_TIME = STR_TO_DATE(#{createTime},'%Y-%m-%d %H:%i:%s')
  129. </if>
  130. <if test="updateTime != null and updateTime != ''">and UPDATE_TIME = STR_TO_DATE(#{updateTime},'%Y-%m-%d %H:%i:%s')
  131. </if>
  132. <if test="status != null and status != ''">and STATUS = #{status}</if>
  133. </trim>
  134. </sql>
  135. <select id="get" resultMap="bisInspManageResponsibilityResultMap" parameterType="String">
  136. select
  137. <include refid="table_columns"/>
  138. from BIS_INSP_MANAGE_RESPONSIBILITY where MNGR_ID = #{id}
  139. </select>
  140. <select id="getBy" resultMap="bisInspManageResponsibilityResultMap">
  141. select
  142. <include refid="table_columns"/>
  143. from BIS_INSP_MANAGE_RESPONSIBILITY
  144. <include refid="page_where"/>
  145. </select>
  146. <select id="findAll" resultMap="bisInspManageResponsibilityResultMap">
  147. select
  148. <include refid="table_columns"/>
  149. from BIS_INSP_MANAGE_RESPONSIBILITY
  150. </select>
  151. <select id="findList" resultMap="bisInspManageResponsibilityResultMap">
  152. select
  153. <include refid="table_columns"/>
  154. from BIS_INSP_MANAGE_RESPONSIBILITY
  155. <include refid="page_where"/>
  156. ORDER BY UPDATE_TIME DESC
  157. </select>
  158. <select id="selectCount" resultType="int">
  159. select count(MNGR_ID) from BIS_INSP_MANAGE_RESPONSIBILITY
  160. <include refid="page_where"/>
  161. </select>
  162. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspManageResponsibility">
  163. insert into BIS_INSP_MANAGE_RESPONSIBILITY(
  164. <include refid="table_columns2"/>
  165. )
  166. values (
  167. <include refid="entity_properties"/>
  168. )
  169. </insert>
  170. <delete id="delete" parameterType="java.lang.String">
  171. delete from BIS_INSP_MANAGE_RESPONSIBILITY where MNGR_ID = #{id}
  172. </delete>
  173. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspManageResponsibility">
  174. delete from BIS_INSP_MANAGE_RESPONSIBILITY
  175. <include refid="page_where"/>
  176. </delete>
  177. <update id="deleteInFlag" parameterType="java.lang.String">
  178. update BIS_INSP_MANAGE_RESPONSIBILITY set flag_valid = 0 where MNGR_ID = #{id}
  179. </update>
  180. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspManageResponsibility">
  181. update BIS_INSP_MANAGE_RESPONSIBILITY
  182. <trim prefix="set" suffixOverrides=",">
  183. <if test="accompany != null and accompany != ''">ACCOMPANY = #{accompany},</if>
  184. <if test="engId != null and engId != ''">ENG_ID = #{engId},</if>
  185. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  186. <if test="personAmount != null and personAmount != ''">PERSON_AMOUNT = #{personAmount},</if>
  187. <if test="focusSupplyPerc != null and focusSupplyPerc != ''">FOCUS_SUPPLY_PERC = #{focusSupplyPerc},</if>
  188. <if test="waterSupplyPerc != null and waterSupplyPerc != ''">WATER_SUPPLY_PERC = #{waterSupplyPerc},</if>
  189. <if test="isGovRes != null and isGovRes != ''">IS_GOV_RES = #{isGovRes},</if>
  190. <if test="isConRes != null and isConRes != ''">IS_CON_RES = #{isConRes},</if>
  191. <if test="isDeptRes != null and isDeptRes != ''">IS_DEPT_RES = #{isDeptRes},</if>
  192. <if test="isCntyDept != null and isCntyDept != ''">IS_CNTY_DEPT = #{isCntyDept},</if>
  193. <if test="isCntyFunc != null and isCntyFunc != ''">IS_CNTY_FUNC = #{isCntyFunc},</if>
  194. <if test="isCntyFee != null and isCntyFee != ''">IS_CNTY_FEE = #{isCntyFee},</if>
  195. <if test="isQuailtyChk != null and isQuailtyChk != ''">IS_QUAILTY_CHK = #{isQuailtyChk},</if>
  196. <if test="pracFee != null and pracFee != ''">PRAC_FEE = #{pracFee},</if>
  197. <if test="visitDate != null and visitDate != ''">VISIT_DATE = STR_TO_DATE(#{visitDate},'%Y-%m-%d'),</if>
  198. <if test="visitorId != null and visitorId != ''">VISITOR_ID = #{visitorId},</if>
  199. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  200. <if test="recPers2 != null and recPers2 != ''">REC_PERS2 = #{recPers2},</if>
  201. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  202. <if test="createTime != null and createTime != ''">CREATE_TIME = STR_TO_DATE(#{createTime},'%Y-%m-%d %H:%i:%s'),
  203. </if>
  204. <if test="updateTime != null and updateTime != ''">UPDATE_TIME = STR_TO_DATE(#{updateTime},'%Y-%m-%d %H:%i:%s'),
  205. </if>
  206. <if test="status != null and status != ''">STATUS = #{status},</if>
  207. </trim>
  208. <where>MNGR_ID = #{mngrId}</where>
  209. </update>
  210. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspManageResponsibility">
  211. update BIS_INSP_MANAGE_RESPONSIBILITY
  212. <trim prefix="set" suffixOverrides=",">
  213. <if test="accompany != null and accompany != ''">ACCOMPANY = #{accompany},</if>
  214. <if test="engId != null and engId != ''">ENG_ID = #{engId},</if>
  215. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  216. <if test="personAmount != null and personAmount != ''">PERSON_AMOUNT = #{personAmount},</if>
  217. <if test="focusSupplyPerc != null and focusSupplyPerc != ''">FOCUS_SUPPLY_PERC = #{focusSupplyPerc},</if>
  218. <if test="waterSupplyPerc != null and waterSupplyPerc != ''">WATER_SUPPLY_PERC = #{waterSupplyPerc},</if>
  219. <if test="isGovRes != null and isGovRes != ''">IS_GOV_RES = #{isGovRes},</if>
  220. <if test="isConRes != null and isConRes != ''">IS_CON_RES = #{isConRes},</if>
  221. <if test="isDeptRes != null and isDeptRes != ''">IS_DEPT_RES = #{isDeptRes},</if>
  222. <if test="isCntyDept != null and isCntyDept != ''">IS_CNTY_DEPT = #{isCntyDept},</if>
  223. <if test="isCntyFunc != null and isCntyFunc != ''">IS_CNTY_FUNC = #{isCntyFunc},</if>
  224. <if test="isCntyFee != null and isCntyFee != ''">IS_CNTY_FEE = #{isCntyFee},</if>
  225. <if test="isQuailtyChk != null and isQuailtyChk != ''">IS_QUAILTY_CHK = #{isQuailtyChk},</if>
  226. <if test="pracFee != null and pracFee != ''">PRAC_FEE = #{pracFee},</if>
  227. <if test="visitDate != null and visitDate != ''">VISIT_DATE = STR_TO_DATE(#{visitDate},'%Y-%m-%d'),</if>
  228. <if test="visitorId != null and visitorId != ''">VISITOR_ID = #{visitorId},</if>
  229. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  230. <if test="recPers2 != null and recPers2 != ''">REC_PERS2 = #{recPers2},</if>
  231. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  232. <if test="createTime != null and createTime != ''">CREATE_TIME = STR_TO_DATE(#{createTime},'%Y-%m-%d %H:%i:%s'),
  233. </if>
  234. <if test="updateTime != null and updateTime != ''">UPDATE_TIME = STR_TO_DATE(#{updateTime},'%Y-%m-%d %H:%i:%s'),
  235. </if>
  236. <if test="status != null and status != ''">STATUS = #{status},</if>
  237. </trim>
  238. <include refid="page_where"/>
  239. </update>
  240. <!-- 其他自定义SQL -->
  241. <select id="getMsCounts" resultType="int">
  242. SELECT
  243. COUNT(B.ENG_ID)
  244. FROM
  245. BIS_INSP_VILL_RGSTR A
  246. LEFT JOIN BIS_INSP_MANAGE_RESPONSIBILITY B ON A.ENG_ID = B.ENG_ID
  247. WHERE
  248. A.OBJ_ID = #{objId}
  249. </select>
  250. <sql id="orgIdSql">
  251. <choose>
  252. <when test="orgId !=null and orgId !=''">
  253. and ORG_ID=#{orgId}
  254. </when>
  255. <otherwise>
  256. and ORG_ID is null
  257. </otherwise>
  258. </choose>
  259. </sql>
  260. <select id="getListByCodeAndPerId" parameterType="cn.com.goldenwater.dcproj.dto.VillRgstrDto"
  261. resultType="cn.com.goldenwater.dcproj.model.BisInspManageResponsibility">
  262. SELECT * FROM BIS_INSP_MANAGE_RESPONSIBILITY A LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID = B.ENG_ID
  263. LEFT JOIN BIS_INSP_ALL_OBJ C ON B.OBJ_ID = C.OBJ_ID
  264. WHERE
  265. C.id in (${inIdsSql})
  266. AND C.CODE LIKE '${adCode}%' AND C.PTYPE = '2'
  267. </select>
  268. <select id="getPageByNodeId" parameterType="cn.com.goldenwater.dcproj.param.GetVillPageByNodeIdParam"
  269. resultType="cn.com.goldenwater.dcproj.dto.BisInspManageResponsibilityDcdxDto">
  270. select A.ACCOMPANY ,
  271. A.MNGR_ID ,
  272. A.ENG_ID ,
  273. A.AD_CODE ,
  274. A.PERSON_AMOUNT ,
  275. A.FOCUS_SUPPLY_PERC ,
  276. A.WATER_SUPPLY_PERC ,
  277. A.IS_GOV_RES ,
  278. A.IS_CON_RES ,
  279. A.IS_DEPT_RES ,
  280. A.IS_CNTY_DEPT ,
  281. A.IS_CNTY_FUNC ,
  282. A.IS_CNTY_FEE ,
  283. A.IS_QUAILTY_CHK ,
  284. A.PRAC_FEE ,
  285. DATE_FORMAT(A.VISIT_DATE,'%Y-%m-%d') VISIT_DATE,
  286. A.VISITOR_ID ,
  287. A.REC_PERS_ID ,
  288. A.REC_PERS2 ,
  289. A.REC_PERS_TEL ,
  290. DATE_FORMAT(A.CREATE_TIME,'%Y-%m-%d %H:%i:%s') CREATE_TIME,
  291. DATE_FORMAT(A.UPDATE_TIME,'%Y-%m-%d %H:%i:%s') UPDATE_TIME,
  292. A.STATUS ,D.PNM GROUP_NM,F.PNM CHKCOM,F.ID CHKID,H.AD_NAME COUNTY,I.AD_NAME CITY,J.AD_NAME PROVINCE from
  293. BIS_INSP_MANAGE_RESPONSIBILITY A LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID=B.ENG_ID LEFT JOIN bis_insp_all_obj
  294. C ON B.OBJ_ID=C.OBJ_ID
  295. 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
  296. E.PID=F.ID
  297. LEFT JOIN ATT_AD_X_BASE H ON A.AD_CODE=H.AD_CODE
  298. 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 WHERE 1=1
  299. <if test="nodeId != null and nodeId != ''">
  300. and C.ID like concat(#{nodeId},'%')
  301. </if>
  302. <if test="startDate != null and startDate != ''">
  303. AND A.VISIT_DATE &gt;=STR_TO_DATE(#{startDate},'%Y-%m-%d')
  304. </if>
  305. <if test="endDate != null and endDate != ''">
  306. AND A.VISIT_DATE &lt;= DATE_ADD(STR_TO_DATE(#{endDate},'%Y-%m-%d'), INTERVAL 1 DAY )
  307. </if>
  308. <if test="chkComId != null and chkComId != ''">
  309. AND F.ID =#{chkComId}
  310. </if>
  311. <if test="groupId != null and groupId != ''">
  312. AND D.ID =#{groupId}
  313. </if>
  314. <if test="adNm != null and adNm != ''">
  315. AND( H.AD_NAME LIKE concat('%',#{adNm},'%') OR I.AD_NAME LIKE concat('%',#{adNm},'%') OR J.AD_NAME LIKE
  316. concat('%',#{adNm},'%') )
  317. </if>
  318. ORDER BY A.UPDATE_TIME DESC,A.VISIT_DATE DESC
  319. </select>
  320. </mapper>