CstInfMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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.minpay.db.table.own.mapper.CstInfMapper">
  4. <select id="selectPbcstinfQuery" resultType="hashmap" parameterType="java.util.Map">
  5. select
  6. CIF_CSTNO 'cstno',
  7. CIF_NAME 'name',
  8. CIF_PHONE 'phone',
  9. CIF_INDUSTRY 'industry',
  10. CIF_NUTURE 'nuture',
  11. CIF_LEVEL 'level',
  12. CIF_INVOICE_TYPE 'invoicetype',
  13. CIF_PROVINCE 'province',
  14. CIF_CITY 'city',
  15. CIF_AREA 'area',
  16. CIF_IS_GROUP 'isGroup',
  17. CIF_IS_IMPORTANT 'isImportant',
  18. CIF_IS_PROCOTOL 'isProcotol',
  19. CIF_COMPANY_ID 'companyId',
  20. CIF_SALE_ID 'saleId',
  21. CIF_PAY_TYPE 'payType',
  22. CIF_MIN_PAY_PERIOD 'minPayPeriod',
  23. CIF_MAX_PAY_PERIOD 'maxPayPeriod',
  24. CIF_PAY_PERIOD_STT 'periodStt',
  25. USR_NAME 'saleName',
  26. SCI_ACCNO 'accNo',
  27. (CASE WHEN SCI_VALUE IS NULL THEN 0 ELSE SCI_VALUE END) AS creditValue,
  28. CIF_GRADE 'creditGrade',
  29. CIF_DESC 'desc',
  30. CIF_GROUP_NAME 'groupName',
  31. d.add_name 'cityName',
  32. e.add_name 'areaName'
  33. from
  34. pb_cst_inf a
  35. LEFT JOIN
  36. im_user b ON CIF_SALE_ID = USR_ID
  37. LEFT JOIN
  38. hc_score_inf c ON CIF_CSTNO = SCI_CST
  39. <if test="cstType != null and cstType != ''">
  40. and SCI_TYPE = #{cstType,jdbcType=VARCHAR}
  41. </if>
  42. <if test="accType != null and accType != ''">
  43. and SCI_ACC_TYPE = #{accType,jdbcType=VARCHAR}
  44. </if>
  45. LEFT JOIN pub_address d on d.add_code = a.CIF_CITY
  46. LEFT JOIN pub_address e on e.add_code = a.CIF_CITY
  47. where
  48. 1=1
  49. <if test="saleName != null and saleName != ''">
  50. and USR_NAME like CONCAT('%', #{saleName,jdbcType=VARCHAR}, '%')
  51. </if>
  52. <if test="name != null and name != ''">
  53. and CIF_NAME like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
  54. </if>
  55. <if test="nuture != null and nuture != ''">
  56. and CIF_NUTURE = #{nuture,jdbcType=VARCHAR}
  57. </if>
  58. <if test="userId != null and userId != ''">
  59. and CIF_SALE_ID = #{userId,jdbcType=VARCHAR}
  60. </if>
  61. <if test="isDistribution != null and isDistribution != ''">
  62. AND ( CIF_SALE_ID IS NULL OR CIF_SALE_ID ='')
  63. </if>
  64. <if test="level != null and level != ''">
  65. and CIF_LEVEL = #{level,jdbcType=VARCHAR}
  66. </if>
  67. <if test="invoicetype != null and invoicetype != ''">
  68. and CIF_INVOICE_TYPE = #{invoicetype,jdbcType=VARCHAR}
  69. </if>
  70. <if test="group != null and group != ''">
  71. and CIF_SALE_ID in (select HGI_UESRID from hc_group_uesr_rel where 1=1 and HGI_GROUP = #{group,jdbcType=VARCHAR})
  72. </if>
  73. ORDER BY CIF_CSTNO DESC
  74. </select>
  75. <select id="queryApplyCustomer" resultType="hashmap" parameterType="java.util.Map">
  76. select
  77. a.DIS_ID "id",
  78. a.DIS_CST_ID "cstId",
  79. c.CIF_NAME "cstName",
  80. a.DIS_TYPE "type",
  81. a.DIS_OLD_USER "oldUser",
  82. a.DIS_NOW_USER "nowUser",
  83. a.DIS_OPER_TIME "operTime",
  84. a.DIS_OPER_USER "operUser",
  85. a.DIS_OPER_DESC "operDesc",
  86. b.USR_NAME "oldUserName",
  87. d.USR_NAME "nowUserName",
  88. e.USR_NAME "operUserName",
  89. f.HGI_NAME "oldGroupName",
  90. g.HGI_NAME "nowGroupName"
  91. from
  92. pb_cst_distribute_log a
  93. LEFT JOIN PB_CST_INF c ON a.DIS_CST_ID = c.CIF_CSTNO
  94. LEFT JOIN im_user b ON a.DIS_OLD_USER = b.USR_ID
  95. LEFT JOIN im_user d ON a.DIS_NOW_USER = d.USR_ID
  96. LEFT JOIN im_user e ON a.DIS_OPER_USER = e.USR_ID
  97. left join hc_group_inf f on f.hgi_id = a.DIS_OLD_GROUP
  98. left join hc_group_inf g on g.hgi_id = a.DIS_NOW_GROUP
  99. where
  100. 1=1
  101. <if test="saleName != null and saleName != ''">
  102. and d.USR_NAME like CONCAT('%', #{saleName,jdbcType=VARCHAR}, '%')
  103. </if>
  104. <if test="name != null and name != ''">
  105. and c.CIF_NAME like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
  106. </if>
  107. ORDER BY DIS_OPER_TIME DESC
  108. </select>
  109. <select id="queryScoreDetail" resultType="hashmap" parameterType="java.util.Map">
  110. select
  111. CSL_ID 'id',
  112. CSL_CHANGE_VALUE 'changeValue',
  113. CSL_VALUE 'value',
  114. CSL_DEAL_NO 'dealNo',
  115. CSL_CST_ID 'cstId',
  116. CSL_DESC 'desc',
  117. CSL_DEAL_TYPE 'dealType',
  118. CSL_CST_TYPE 'cstType',
  119. CSL_CREATEUSER 'createUser',
  120. CSL_CREATETIME 'createtime',
  121. CSL_ACCNO 'accNo'
  122. from
  123. hc_sco_log
  124. where
  125. 1=1
  126. and CSL_ACCNO = #{accNo,jdbcType=VARCHAR}
  127. ORDER BY CSL_CREATETIME DESC
  128. </select>
  129. <select id="queryContacts" resultType="hashmap" parameterType="java.util.Map">
  130. select
  131. CON_ID 'id',
  132. CON_NAME 'name',
  133. CON_DEPARTMENT 'department',
  134. CON_DUTY 'duty',
  135. CON_IS_DECISION 'isDecision',
  136. CON_PHONE 'phone',
  137. CON_CST_ID 'cstid',
  138. CON_DESC 'desc',
  139. CON_ADDRESS 'address'
  140. from
  141. pb_contact_inf
  142. where
  143. 1=1
  144. and CON_CST_ID = #{cstno,jdbcType=VARCHAR}
  145. and CON_CST_TYPE = '0'
  146. </select>
  147. <select id="queryProductRecord" resultType="hashmap" parameterType="java.util.Map">
  148. select
  149. q.QUD_ID 'id',
  150. q.QUD_QUOTATION_ID 'quotationId',
  151. q.QUD_GOODS_SUP_REL 'goodId',
  152. q.QUD_OFFER_STATUS 'status',
  153. q.QUD_MODEL 'model',
  154. q.QUD_NAME 'name',
  155. q.QUD_BRAND 'brand',
  156. q.QUD_NUMBER 'number',
  157. q.QUD_ORDER_COUNT 'orderNumber',
  158. q.QUD_NOT_ORDER_COUNT 'notOrderNumber',
  159. q.QUD_NOT_ORDER_COUNT 'toOrderNumber',
  160. q.QUD_CST_ID 'cstId',
  161. b.CIF_NAME 'cstName',
  162. a.HGI_NAME 'goodName'
  163. from
  164. hc_quotation_detail q
  165. left join hc_goods_inf a on a.HGI_ID = q.QUD_GOODS_SUP_REL
  166. left join pb_cst_inf b on b.CIF_CSTNO = q.QUD_CST_ID
  167. where 1=1
  168. <if test="goodName != null and goodName != ''">
  169. and a.HGI_NAME like CONCAT('%', #{goodName,jdbcType=VARCHAR}, '%')
  170. </if>
  171. <if test="cstName != null and cstName != ''">
  172. and b.CIF_NAME like CONCAT('%', #{cstName,jdbcType=VARCHAR}, '%')
  173. </if>
  174. ORDER BY QUD_ID DESC
  175. </select>
  176. </mapper>