CustomerMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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.goafanti.common.dao.CustomerMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.Customer">
  5. <id column="id" jdbcType="VARCHAR" property="id" />
  6. <result column="aid" jdbcType="VARCHAR" property="aid" />
  7. <result column="company_nmae" jdbcType="VARCHAR" property="companyName" />
  8. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  9. <result column="company_industry" jdbcType="VARCHAR" property="companyIndustry" />
  10. <result column="company_intention" jdbcType="VARCHAR" property="companyIntention" />
  11. <result column="adress" jdbcType="VARCHAR" property="adress" />
  12. <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
  13. <result column="customer_position" jdbcType="VARCHAR" property="customerPosition" />
  14. <result column="mobile" jdbcType="VARCHAR" property="mobile" />
  15. <result column="email" jdbcType="VARCHAR" property="email" />
  16. <result column="department" jdbcType="VARCHAR" property="department" />
  17. <result column="qq" jdbcType="VARCHAR" property="qq" />
  18. <result column="wechat" jdbcType="VARCHAR" property="wechat" />
  19. <result column="remark" jdbcType="VARCHAR" property="remark" />
  20. <result column="province" jdbcType="VARCHAR" property="province" />
  21. <result column="fllow_situation" jdbcType="VARCHAR" property="fllowSituation" />
  22. <result column="sex" jdbcType="INTEGER" property="sex" />
  23. <result column="customer_statue" jdbcType="VARCHAR" property="customerStatue" />
  24. <result column="customer_typ" jdbcType="INTEGER" property="customerTyp" />
  25. <result column="tel_num" jdbcType="VARCHAR" property="telNum" />
  26. </resultMap>
  27. <sql id="Example_Where_Clause">
  28. <where>
  29. <foreach collection="oredCriteria" item="criteria" separator="or">
  30. <if test="criteria.valid">
  31. <trim prefix="(" prefixOverrides="and" suffix=")">
  32. <foreach collection="criteria.criteria" item="criterion">
  33. <choose>
  34. <when test="criterion.noValue">
  35. and ${criterion.condition}
  36. </when>
  37. <when test="criterion.singleValue">
  38. and ${criterion.condition} #{criterion.value}
  39. </when>
  40. <when test="criterion.betweenValue">
  41. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  42. </when>
  43. <when test="criterion.listValue">
  44. and ${criterion.condition}
  45. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  46. #{listItem}
  47. </foreach>
  48. </when>
  49. </choose>
  50. </foreach>
  51. </trim>
  52. </if>
  53. </foreach>
  54. </where>
  55. </sql>
  56. <sql id="Update_By_Example_Where_Clause">
  57. <where>
  58. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  59. <if test="criteria.valid">
  60. <trim prefix="(" prefixOverrides="and" suffix=")">
  61. <foreach collection="criteria.criteria" item="criterion">
  62. <choose>
  63. <when test="criterion.noValue">
  64. and ${criterion.condition}
  65. </when>
  66. <when test="criterion.singleValue">
  67. and ${criterion.condition} #{criterion.value}
  68. </when>
  69. <when test="criterion.betweenValue">
  70. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  71. </when>
  72. <when test="criterion.listValue">
  73. and ${criterion.condition}
  74. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  75. #{listItem}
  76. </foreach>
  77. </when>
  78. </choose>
  79. </foreach>
  80. </trim>
  81. </if>
  82. </foreach>
  83. </where>
  84. </sql>
  85. <sql id="Base_Column_List">
  86. id, aid, company_nmae, create_time, company_industry, company_intention, adress,
  87. customer_name, customer_position, mobile, email, department, qq, wechat, remark,
  88. province, fllow_situation, sex, customer_statue
  89. </sql>
  90. <!-- 查询单个客户信息 -->
  91. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  92. select
  93. <include refid="Base_Column_List" />
  94. from customer
  95. where id = #{id,jdbcType=VARCHAR}
  96. </select>
  97. <!-- 删除用户 -->
  98. <update id="deleteByPrimaryKey" parameterType="java.lang.String">
  99. update customer set delete_flg= 1
  100. where id = #{id,jdbcType=VARCHAR}
  101. </update>
  102. <!-- 新增客户 -->
  103. <insert id="insertCustomer" parameterType="com.goafanti.common.model.Customer">
  104. insert into customer (id, aid, company_nmae,
  105. create_time, company_industry, company_intention,
  106. adress, customer_name, customer_position,
  107. mobile, email, department,
  108. qq, wechat, remark,
  109. province, fllow_situation, sex,
  110. customer_statue,customer_typ,tel_num,typ,delete_flg)
  111. values (#{id,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{companyName,jdbcType=VARCHAR},
  112. #{createTime,jdbcType=TIMESTAMP}, #{companyIndustry,jdbcType=VARCHAR}, #{companyIntention,jdbcType=VARCHAR},
  113. #{adress,jdbcType=VARCHAR}, #{customerName,jdbcType=VARCHAR}, #{customerPosition,jdbcType=VARCHAR},
  114. #{mobile,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{department,jdbcType=VARCHAR},
  115. #{qq,jdbcType=VARCHAR}, #{wechat,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
  116. #{province,jdbcType=VARCHAR}, #{fllowSituation,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER},
  117. #{customerStatue,jdbcType=VARCHAR}, #{customerTyp,jdbcType=INTEGER}, #{telNum,jdbcType=VARCHAR},0,0)
  118. </insert>
  119. <insert id="insertSelective" parameterType="com.goafanti.common.model.Customer">
  120. insert into customer
  121. <trim prefix="(" suffix=")" suffixOverrides=",">
  122. <if test="id != null">
  123. id,
  124. </if>
  125. <if test="aid != null">
  126. aid,
  127. </if>
  128. <if test="companyName != null">
  129. company_nmae,
  130. </if>
  131. <if test="createTime != null">
  132. create_time,
  133. </if>
  134. <if test="companyIndustry != null">
  135. company_industry,
  136. </if>
  137. <if test="companyIntention != null">
  138. company_intention,
  139. </if>
  140. <if test="adress != null">
  141. adress,
  142. </if>
  143. <if test="customerName != null">
  144. customer_name,
  145. </if>
  146. <if test="customerPosition != null">
  147. customer_position,
  148. </if>
  149. <if test="mobile != null">
  150. mobile,
  151. </if>
  152. <if test="email != null">
  153. email,
  154. </if>
  155. <if test="department != null">
  156. department,
  157. </if>
  158. <if test="qq != null">
  159. qq,
  160. </if>
  161. <if test="wechat != null">
  162. wechat,
  163. </if>
  164. <if test="remark != null">
  165. remark,
  166. </if>
  167. <if test="province != null">
  168. province,
  169. </if>
  170. <if test="fllowSituation != null">
  171. fllow_situation,
  172. </if>
  173. <if test="sex != null">
  174. sex,
  175. </if>
  176. <if test="customerStatue != null">
  177. customer_statue,
  178. </if>
  179. </trim>
  180. <trim prefix="values (" suffix=")" suffixOverrides=",">
  181. <if test="id != null">
  182. #{id,jdbcType=VARCHAR},
  183. </if>
  184. <if test="aid != null">
  185. #{aid,jdbcType=VARCHAR},
  186. </if>
  187. <if test="companyName != null">
  188. #{companyName,jdbcType=VARCHAR},
  189. </if>
  190. <if test="createTime != null">
  191. #{createTime,jdbcType=TIMESTAMP},
  192. </if>
  193. <if test="companyIndustry != null">
  194. #{companyIndustry,jdbcType=VARCHAR},
  195. </if>
  196. <if test="companyIntention != null">
  197. #{companyIntention,jdbcType=VARCHAR},
  198. </if>
  199. <if test="adress != null">
  200. #{adress,jdbcType=VARCHAR},
  201. </if>
  202. <if test="customerName != null">
  203. #{customerName,jdbcType=VARCHAR},
  204. </if>
  205. <if test="customerPosition != null">
  206. #{customerPosition,jdbcType=VARCHAR},
  207. </if>
  208. <if test="mobile != null">
  209. #{mobile,jdbcType=VARCHAR},
  210. </if>
  211. <if test="email != null">
  212. #{email,jdbcType=VARCHAR},
  213. </if>
  214. <if test="department != null">
  215. #{department,jdbcType=VARCHAR},
  216. </if>
  217. <if test="qq != null">
  218. #{qq,jdbcType=VARCHAR},
  219. </if>
  220. <if test="wechat != null">
  221. #{wechat,jdbcType=VARCHAR},
  222. </if>
  223. <if test="remark != null">
  224. #{remark,jdbcType=VARCHAR},
  225. </if>
  226. <if test="province != null">
  227. #{province,jdbcType=VARCHAR},
  228. </if>
  229. <if test="fllowSituation != null">
  230. #{fllowSituation,jdbcType=VARCHAR},
  231. </if>
  232. <if test="sex != null">
  233. #{sex,jdbcType=INTEGER},
  234. </if>
  235. <if test="customerStatue != null">
  236. #{customerStatue,jdbcType=VARCHAR},
  237. </if>
  238. </trim>
  239. </insert>
  240. <!-- 修改客户信息 -->
  241. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Customer">
  242. update customer
  243. <set>
  244. <if test="aid != null">
  245. aid = #{aid,jdbcType=VARCHAR},
  246. </if>
  247. <if test="companyName != null">
  248. company_nmae = #{companyName,jdbcType=VARCHAR},
  249. </if>
  250. <if test="createTime != null">
  251. create_time = #{createTime,jdbcType=TIMESTAMP},
  252. </if>
  253. <if test="companyIndustry != null">
  254. company_industry = #{companyIndustry,jdbcType=VARCHAR},
  255. </if>
  256. <if test="companyIntention != null">
  257. company_intention = #{companyIntention,jdbcType=VARCHAR},
  258. </if>
  259. <if test="adress != null">
  260. adress = #{adress,jdbcType=VARCHAR},
  261. </if>
  262. <if test="customerName != null">
  263. customer_name = #{customerName,jdbcType=VARCHAR},
  264. </if>
  265. <if test="customerPosition != null">
  266. customer_position = #{customerPosition,jdbcType=VARCHAR},
  267. </if>
  268. <if test="mobile != null">
  269. mobile = #{mobile,jdbcType=VARCHAR},
  270. </if>
  271. <if test="email != null">
  272. email = #{email,jdbcType=VARCHAR},
  273. </if>
  274. <if test="department != null">
  275. department = #{department,jdbcType=VARCHAR},
  276. </if>
  277. <if test="qq != null">
  278. qq = #{qq,jdbcType=VARCHAR},
  279. </if>
  280. <if test="wechat != null">
  281. wechat = #{wechat,jdbcType=VARCHAR},
  282. </if>
  283. <if test="remark != null">
  284. remark = #{remark,jdbcType=VARCHAR},
  285. </if>
  286. <if test="province != null">
  287. province = #{province,jdbcType=VARCHAR},
  288. </if>
  289. <if test="fllowSituation != null">
  290. fllow_situation = #{fllowSituation,jdbcType=VARCHAR},
  291. </if>
  292. <if test="sex != null">
  293. sex = #{sex,jdbcType=INTEGER},
  294. </if>
  295. <if test="customerStatue != null">
  296. customer_statue = #{customerStatue,jdbcType=VARCHAR},
  297. </if>
  298. </set>
  299. where id = #{id,jdbcType=VARCHAR}
  300. </update>
  301. <!-- 分页查询客户 -->
  302. <select id="findSearchCustomerListByPage" resultType="com.goafanti.common.model.Customer">
  303. select
  304. a.id,
  305. a.company_name as companyName ,
  306. a.customer_typ as customerTyp ,
  307. a.province ,
  308. a.tel_num as telNum ,
  309. a.customer_name as customerName ,
  310. a.customer_statue as customerStatue,
  311. a.Company_intention as CompanyIntention ,
  312. a.fllow_situation as fllowSituation
  313. from aft.customer a
  314. where a.delete_flg = 0
  315. and a.aid=#{aid,jdbcType=VARCHAR}
  316. <if test="companyName != null">
  317. a.company_name = #{companyName,jdbcType=VARCHAR},
  318. </if>
  319. <if test="telNum != null">
  320. a.tel_num = #{telNum,jdbcType=VARCHAR},
  321. </if>
  322. <if test="customerTyp != null">
  323. a.typ = #{customerTyp,jdbcType=INTEGER},
  324. </if>
  325. <if test="companyIntention != null">
  326. a.company_intention = #{companyIntention,jdbcType=VARCHAR},
  327. </if>
  328. <if test="customerName != null">
  329. a.customer_name = #{customerName,jdbcType=VARCHAR},
  330. </if>
  331. <if test="province != null">
  332. a.province = #{province,jdbcType=VARCHAR},
  333. </if>
  334. <if test="fllowSituation != null">
  335. a.fllow_situation = #{fllowSituation,jdbcType=VARCHAR},
  336. </if>
  337. <if test="customerStatue != null">
  338. a.customer_statue = #{customerStatue,jdbcType=VARCHAR},
  339. </if>
  340. <if test="page_sql != null">
  341. ${page_sql}
  342. </if>
  343. </select>
  344. <!-- 分页查询客户 -->
  345. <select id="findSearchCustomerCount" parameterType="String" resultType="java.lang.Integer">
  346. select
  347. count(1)
  348. from customer a
  349. where a.delete_flg = 0
  350. and a.aid=#{aid,jdbcType=VARCHAR}
  351. <if test="companyName != null">
  352. a.company_name = #{companyName,jdbcType=VARCHAR},
  353. </if>
  354. <if test="telNum != null">
  355. a.tel_num = #{telNum,jdbcType=VARCHAR},
  356. </if>
  357. <if test="customerTyp != null">
  358. a.typ = #{customerTyp,jdbcType=INTEGER},
  359. </if>
  360. <if test="companyIntention != null">
  361. a.company_intention = #{companyIntention,jdbcType=VARCHAR},
  362. </if>
  363. <if test="customerName != null">
  364. a.customer_name = #{customerName,jdbcType=VARCHAR},
  365. </if>
  366. <if test="province != null">
  367. a.province = #{province,jdbcType=VARCHAR},
  368. </if>
  369. <if test="fllowSituation != null">
  370. a.fllow_situation = #{fllowSituation,jdbcType=VARCHAR},
  371. </if>
  372. <if test="customerStatue != null">
  373. a.customer_statue = #{customerStatue,jdbcType=VARCHAR},
  374. </if>
  375. <if test="page_sql != null">
  376. ${page_sql}
  377. </if>
  378. </select>
  379. </mapper>