ClueMapper.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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.management.platform.mapper.ClueMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.management.platform.entity.Clue">
  6. <id column="id" property="id" />
  7. <result column="company_id" property="companyId" />
  8. <result column="clue_name" property="clueName" />
  9. <result column="clue_source_id" property="clueSourceId" />
  10. <result column="phone" property="phone" />
  11. <result column="email" property="email" />
  12. <result column="customer_industry_id" property="customerIndustryId" />
  13. <result column="customer_level_id" property="customerLevelId" />
  14. <result column="address" property="address" />
  15. <result column="incharger_id" property="inchargerId" />
  16. <result column="remark" property="remark" />
  17. <result column="is_delete" property="isDelete" />
  18. <result column="plate1" property="plate1" />
  19. <result column="plate2" property="plate2" />
  20. <result column="plate3" property="plate3" />
  21. <result column="plate4" property="plate4" />
  22. <result column="plate5" property="plate5" />
  23. <result column="company_name" property="companyName" />
  24. <result column="create_time" property="createTime" />
  25. <result column="create_id" property="createId" />
  26. </resultMap>
  27. <!-- 通用查询结果列 -->
  28. <sql id="Base_Column_List">
  29. id, company_id, clue_name, clue_source_id, phone , email, customer_industry_id, customer_level_id, address, incharger_id, remark, is_delete, plate1, plate2, plate3, plate4, plate5,create_time,createId
  30. </sql>
  31. <select id="list" resultType="com.management.platform.entity.Clue">
  32. select c.id,
  33. c.company_id,
  34. (select company_name from company where company_id = c.id) companyName,
  35. c.clue_name,
  36. c.clue_source_id,
  37. c.phone,
  38. c.email,
  39. c.customer_industry_id,
  40. c.customer_level_id,
  41. c.address,
  42. c.incharger_id,
  43. c.remark,
  44. c.is_delete,
  45. c.plate1,
  46. c.plate2,
  47. c.plate3,
  48. c.plate4,
  49. c.plate5,
  50. c.create_time,
  51. c.create_id
  52. from Clue c
  53. where
  54. c.company_id = #{companyId} and is_delete = 0
  55. <if test="startTime != null and endTime != null ">
  56. and c.create_time BETWEEN #{startTime} and #{endTime}
  57. </if>
  58. <if test="clueName != null and clueName != '' ">
  59. and c.clue_name = #{clueName}
  60. </if>
  61. <if test="clueSourceId != null">
  62. and c.clue_source_id = #{clueSourceId}
  63. </if>
  64. <if test="customerIndustryId != null">
  65. and c.customer_industry_id = #{customerIndustryId}
  66. </if>
  67. limit #{pageIndex},#{pageFrom}
  68. </select>
  69. <select id="list1" resultType="com.management.platform.entity.Clue">
  70. select c.id,
  71. c.company_id,
  72. (select company_name from company where company_id = c.id) companyName,
  73. c.clue_name,
  74. c.clue_source_id,
  75. c.phone,
  76. c.email,
  77. c.customer_industry_id,
  78. c.customer_level_id,
  79. c.address,
  80. c.incharger_id,
  81. c.remark,
  82. c.is_delete,
  83. c.plate1,
  84. c.plate2,
  85. c.plate3,
  86. c.plate4,
  87. c.plate5,
  88. c.create_time,
  89. c.create_id
  90. from Clue c
  91. where
  92. c.company_id = #{companyId} and is_delete = 0
  93. and c.incharger_id in
  94. (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
  95. and c.incharger_id is null
  96. <if test="startTime != null and endTime != null ">
  97. and c.create_time BETWEEN #{startTime} and #{endTime}
  98. </if>
  99. <if test="clueName != null and clueName != '' ">
  100. and c.clue_name = #{clueName}
  101. </if>
  102. <if test="clueSourceId != null">
  103. and c.clue_source_id = #{clueSourceId}
  104. </if>
  105. <if test="customerIndustryId != null">
  106. and c.customer_industry_id = #{customerIndustryId}
  107. </if>
  108. limit #{pageIndex},#{pageFrom}
  109. </select>
  110. <select id="list2" resultType="com.management.platform.entity.Clue">
  111. select c.id,
  112. c.company_id,
  113. (select company_name from company where company_id = c.id) companyName,
  114. c.clue_name,
  115. c.clue_source_id,
  116. c.phone,
  117. c.email,
  118. c.customer_industry_id,
  119. c.customer_level_id,
  120. c.address,
  121. c.incharger_id,
  122. c.remark,
  123. c.is_delete,
  124. c.plate1,
  125. c.plate2,
  126. c.plate3,
  127. c.plate4,
  128. c.plate5,
  129. c.create_time,
  130. c.create_id
  131. from Clue c
  132. where
  133. c.company_id = #{companyId} and is_delete = 0
  134. and c.incharger_id = #{userId} and c.incharger_id is null
  135. <if test="startTime != null and endTime != null ">
  136. and c.create_time BETWEEN #{startTime} and #{endTime}
  137. </if>
  138. <if test="clueName != null and clueName != '' ">
  139. and c.clue_name = #{clueName}
  140. </if>
  141. <if test="clueSourceId != null">
  142. and c.clue_source_id = #{clueSourceId}
  143. </if>
  144. <if test="customerIndustryId != null">
  145. and c.customer_industry_id = #{customerIndustryId}
  146. </if>
  147. limit #{pageIndex},#{pageFrom}
  148. </select>
  149. <select id="Deleterlist" resultType="com.management.platform.entity.Clue">
  150. select c.id,
  151. c.company_id,
  152. (select company_name from company where company_id = c.id) companyName,
  153. c.clue_name,
  154. c.clue_source_id,
  155. c.phone,
  156. c.email,
  157. c.customer_industry_id,
  158. c.customer_level_id,
  159. c.address,
  160. c.incharger_id,
  161. c.remark,
  162. c.is_delete,
  163. c.plate1,
  164. c.plate2,
  165. c.plate3,
  166. c.plate4,
  167. c.plate5,
  168. c.create_time,
  169. c.create_id
  170. from Clue c
  171. where
  172. c.company_id = #{companyId} and is_delete = 1
  173. <if test="startTime != null and endTime != null ">
  174. and c.create_time BETWEEN #{startTime} and #{endTime}
  175. </if>
  176. <if test="clueName != null and clueName != '' ">
  177. and c.clue_name = #{clueName}
  178. </if>
  179. <if test="clueSourceId != null">
  180. and c.clue_source_id = #{clueSourceId}
  181. </if>
  182. <if test="customerIndustryId != null">
  183. and c.customer_industry_id = #{customerIndustryId}
  184. </if>
  185. limit #{pageIndex},#{pageFrom}
  186. </select>
  187. <select id="getTotal" resultType="java.lang.Integer">
  188. select count(*)
  189. from Clue c
  190. where
  191. c.company_id = #{companyId} and is_delete = 0
  192. <if test="startTime != null and endTime != null ">
  193. and c.create_time BETWEEN #{startTime} and #{endTime}
  194. </if>
  195. <if test="clueName != null and clueName != '' ">
  196. and c.clue_name = #{clueName}
  197. </if>
  198. <if test="clueSourceId != null">
  199. and c.clue_source_id = #{clueSourceId}
  200. </if>
  201. <if test="customerIndustryId != null">
  202. and c.customer_industry_id = #{customerIndustryId}
  203. </if>
  204. </select>
  205. <select id="getDeleterTotal" resultType="java.lang.Integer">
  206. select count(*)
  207. from Clue c
  208. where
  209. c.company_id = #{companyId} and is_delete = 1
  210. <if test="startTime != null and endTime != null ">
  211. and c.create_time BETWEEN #{startTime} and #{endTime}
  212. </if>
  213. <if test="clueName != null and clueName != '' ">
  214. and c.clue_name = #{clueName}
  215. </if>
  216. <if test="clueSourceId != null">
  217. and c.clue_source_id = #{clueSourceId}
  218. </if>
  219. <if test="customerIndustryId != null">
  220. and c.customer_industry_id = #{customerIndustryId}
  221. </if>
  222. </select>
  223. </mapper>