DaCustomerMapper.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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="com.tofly.fees.userprofilemgt.mapper.DaCustomerMapper">
  4. <!--查询用户max用户编号 -->
  5. <select id="selectMaxCustomerNo" resultType="int">
  6. select nvl(max(customer_no), 0) customer_no
  7. from tf_ywys_da_customer
  8. </select>
  9. <!--查询用户用户编号是否已存在 -->
  10. <select id="selectExistCustomerNo" resultType="int">
  11. select nvl(count(*),0) count from tf_ywys_da_customer where customer_no=#{customer_no}
  12. </select>
  13. <!--查询当前财务日期YEAR_MONTH -->
  14. <select id="selectYearMonth" resultType="java.util.Map">
  15. select bill_year_month as cwrq from tf_ywys_sys_gdcsb where gd_flag='0'
  16. </select>
  17. <!--查询当前财务日期YEAR_MONTH -->
  18. <select id="selectCardNo" resultType="java.util.Map">
  19. select METER_CARD_NO,METER_CARD_ID from tf_ywys_da_meter where customer_no=#{customer_no}
  20. </select>
  21. <!-- select c.name mr_area ,d.name mr_boot,a.customer_no,a.customer_name,a.customer_address,a.customer_phone,a.created_datetime,a.created_oname,a.meternumber,a.customer_state, e.last_reading,e.this_reading from tf_ywys_da_customer a inner join tf_ywys_da_meter b on a.CUSTOMER_NO=b.CUSTOMER_NO
  22. left join tf_ywys_bm_mr_area c on a.mr_area=c.code left join tf_ywys_bm_mr_book d on a.mr_book=d.code
  23. left join tf_ywys_bw_meter_read_plan e on a.customer_no=e.customer_no -->
  24. <!--自定义用户档案查询page -->
  25. <!-- //用户编号、用户姓名、用户地址、联系电话
  26. //片区、抄表本、水表型号、用水性质、用户状态、是否垃圾费、建档日期、抄表人员 -->
  27. <select id="selectDaCustomerPage" resultType="com.tofly.fees.userprofilemgt.entity.DaCustomerSelect">
  28. select distinct a.customer_no customerNo,a.customer_no_old customerNoOld ,a.COMPANY_BRANCH companyBranch,a.MR_AREA mrArea,a.MR_BOOK mrBook, c.name mrAreaName ,d.name mrBookName, a.customer_name
  29. customerName,a.customer_address customerAddress,a.customer_phone customerPhone,a.apply_datetime
  30. applyDatetime,a.created_datetime createdDatetime,a.created_oname createdOname,nvl(a.meternumber,0) meterNumber
  31. ,a.customer_state customerState,a.CERT_TYPE certType,a.CERT_NO certNo, e.last_reading lastReading,e.this_reading thisReading,b.METER_CARD_ID meterCardId
  32. ,f.name priceName,g.name meterTypeName
  33. from tf_ywys_da_customer a inner join tf_ywys_da_meter b on a.CUSTOMER_NO=b.CUSTOMER_NO
  34. left join tf_ywys_bm_mr_area c on a.mr_area=c.code left join tf_ywys_bm_mr_book d on a.mr_book=d.code
  35. left join tf_ywys_bw_meter_read_plan e on a.customer_no=e.customer_no
  36. left join tf_ywys_bm_price f on b.price_code=f.code
  37. left join tf_ywys_bm_meter_type g on b.meter_type=g.code
  38. where 1=1
  39. <!--模糊查询 -->
  40. <if test="searchText != null and searchText != ''">
  41. and ( a.CUSTOMER_NO like '%${searchText}%' or a.CUSTOMER_NAME like '%${searchText}%' or a.CUSTOMER_ADDRESS like
  42. '%${searchText}%' or a.CUSTOMER_PHONE like '%${searchText}%' )
  43. </if>
  44. <!--片区 -->
  45. <if test="mr_area !=null and mr_area!='' and mr_area!='all' ">
  46. and a.mr_area=#{mr_area}
  47. </if>
  48. <!--抄表本 -->
  49. <if test="mr_book !=null and mr_book!='' and mr_book!='all'">
  50. and a.mr_book=#{mr_book}
  51. </if>
  52. <!--水表型号 -->
  53. <if test="meter_model !=null and meter_model!='' and meter_model!='all'">
  54. and b.meter_model=#{meter_model}
  55. </if>
  56. <!--用水性质-->
  57. <if test="meter_model !=null and meter_model!='' and meter_model!='all'">
  58. and b.price_code=#{price_code}
  59. </if>
  60. <!-- 用户状态-->
  61. <if test="customer_state!=null and customer_state!=''">
  62. and a.customer_state=#{customer_state}
  63. </if>
  64. <!-- 是否垃圾费-->
  65. <if test="garbage_fee_flag!=null and garbage_fee_flag!=''">
  66. and b.garbage_fee_flag=#{garbage_fee_flag}
  67. </if>
  68. <!--抄表人员> -->
  69. <if test="mr_ocode!=null and mr_ocode!='' and mr_ocode!='all' ">
  70. and d.mr_ocode=#{mr_ocode}
  71. </if>
  72. <!--建档日期-->
  73. <if test="start_created_datetime!=null and start_created_datetime!='' and end_created_datetime!=null and end_created_datetime!='' ">
  74. and a.CREATED_DATETIME between to_date(#{start_created_datetime},'yyyy-mm-dd hh24:mi:ss') and
  75. to_date(#{end_created_datetime},'yyyy-mm-dd hh24:mi:ss')
  76. </if>
  77. <!--公司 -->
  78. <if test="companyBranch!=null and companyBranch!='' and companyBranch!='all'">
  79. and a.COMPANY_BRANCH=#{companyBranch}
  80. </if>
  81. </select>
  82. <select id="selDaCustomerAcc" resultType="java.util.HashMap">
  83. select a.customer_no "customerNo",b.meter_type "meterType",nvl(c.nb_balance_amount,0) "nbBalanceAmount",nvl(c.balance_amount,0) "balanceAmount" from tf_ywys_da_customer a inner join tf_ywys_da_meter b on a.customer_no=b.customer_no
  84. left join tf_ywys_sf_cus_acc c on a.customer_no=c.customer_no
  85. where 1=1
  86. <if test="customerNo!=''">
  87. and a.customer_no=#{customerNo}
  88. </if>
  89. </select>
  90. <resultMap id="daCustomerMap" type="com.tofly.fees.userprofilemgt.entity.DaCustomer">
  91. <id property="customerNo" column="CUSTOMER_NO"/>
  92. <result property="customerNoOld" column="CUSTOMER_NO_OLD"/>
  93. <result property="companyBranch" column="COMPANY_BRANCH"/>
  94. <result property="mrArea" column="MR_AREA"/>
  95. <result property="mrBook" column="MR_BOOK"/>
  96. <result property="applyDatetime" column="APPLY_DATETIME"/>
  97. <result property="customerName" column="CUSTOMER_NAME"/>
  98. <result property="customerNameShort" column="CUSTOMER_NAME_SHORT"/>
  99. <result property="customerAddress" column="CUSTOMER_ADDRESS"/>
  100. <result property="customerPhone" column="CUSTOMER_PHONE"/>
  101. <result property="population" column="POPULATION"/>
  102. <result property="sex" column="SEX"/>
  103. <result property="customerMobile" column="CUSTOMER_MOBILE"/>
  104. <result property="homePhone" column="HOME_PHONE"/>
  105. <result property="workUnit" column="WORK_UNIT"/>
  106. <result property="workTelephone" column="WORK_TELEPHONE"/>
  107. <result property="email" column="EMAIL"/>
  108. <result property="certType" column="CERT_TYPE"/>
  109. <result property="certNo" column="CERT_NO"/>
  110. <result property="relation" column="RELATION"/>
  111. <result property="customerState" column="CUSTOMER_STATE"/>
  112. <result property="activateState" column="ACTIVATE_STATE"/>
  113. <result property="activateDatetime" column="ACTIVATE_DATETIME"/>
  114. <result property="contractState" column="CONTRACT_STATE"/>
  115. <result property="contractDatetime" column="CONTRACT_DATETIME"/>
  116. <result property="contractNo" column="CONTRACT_NO"/>
  117. <result property="remark" column="REMARK"/>
  118. <result property="bzNo" column="BZ_NO"/>
  119. <result property="bzSerialNo" column="BZ_SERIAL_NO"/>
  120. <result property="createdDatetime" column="CREATED_DATETIME"/>
  121. <result property="createdOcode" column="CREATED_OCODE"/>
  122. <result property="createdOname" column="CREATED_ONAME"/>
  123. <result property="createdSerialNo" column="CREATED_SERIAL_NO"/>
  124. <result property="operatorCode" column="OPERATOR_CODE"/>
  125. <result property="operatorName" column="OPERATOR_NAME"/>
  126. <result property="operatorDatetime" column="OPERATOR_DATETIME"/>
  127. <result property="pCert" column="P_CERT"/>
  128. <result property="pContract" column="P_CONTRACT"/>
  129. <result property="pBusLicense" column="P_BUS_LICENSE"/>
  130. <result property="pPropeertyOwnershipCert" column="P_PROPEERTY_OWNERSHIP_CERT"/>
  131. <result property="pValidCert" column="P_VALID_CERT"/>
  132. <result property="creditRating" column="CREDIT_RATING"/>
  133. <result property="isPoorHouseholds" column="IS_POOR_HOUSEHOLDS"/>
  134. <result property="mrOname" column="MR_ONAME"/>
  135. <result property="regionCode" column="REGION_CODE"/>
  136. <result property="invoiceBankAccount" column="INVOICE_BANK_ACCOUNT"/>
  137. <result property="invoiceBankName" column="INVOICE_BANK_NAME"/>
  138. <result property="invoiceName" column="INVOICE_NAME"/>
  139. <result property="invoiceNsrsbh" column="INVOICE_NSRSBH"/>
  140. <result property="invoiceAddress" column="INVOICE_ADDRESS"/>
  141. <result property="invoicePhone" column="INVOICE_PHONE"/>
  142. <result property="invoiceRemark" column="INVOICE_REMARK"/>
  143. <result property="invoiceType" column="INVOICE_TYPE"/>
  144. <result property="payMode" column="PAY_MODE"/>
  145. <result property="yearCumQuantity" column="YEAR_CUM_QUANTITY"/>
  146. <result property="monthCumQuantity" column="MONTH_CUM_QUANTITY"/>
  147. <result property="customerType" column="CUSTOMER_TYPE"/>
  148. <result property="meterNumber" column="METERNUMBER"/>
  149. </resultMap>
  150. </mapper>