CustomerBookingMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.ygj.yuemum.dao.customer.CustomerBookingDao" >
  4. <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.customer.CustomerBooking" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="bk_phone" property="bk_phone" jdbcType="VARCHAR" />
  7. <result column="bk_duedate" property="bk_duedate" jdbcType="DATE" />
  8. <result column="bk_date" property="bk_date" jdbcType="DATE" />
  9. <result column="bk_type" property="bk_type" jdbcType="INTEGER" />
  10. <result column="bk_desc" property="bk_desc" jdbcType="VARCHAR" />
  11. <result column="bk_typedesc" property="bk_typedesc" jdbcType="VARCHAR" />
  12. <result column="bk_introducer_phone" property="bk_introducer_phone" jdbcType="VARCHAR" />
  13. <result column="bk_introducer_consultant" property="bk_introducer_consultant" jdbcType="VARCHAR" />
  14. <result column="bk_branches_id" property="bk_branches_id" jdbcType="INTEGER" />
  15. </resultMap>
  16. <sql id="Base_Column_List" >
  17. id, bk_phone,bk_duedate,bk_date,bk_type,bk_desc,bk_branches_id
  18. </sql>
  19. <!-- 此处添加查询信息-->
  20. <select id="selectCustomerBooking" resultMap="BaseResultMap" parameterType="java.lang.String" >
  21. select
  22. id, bk_phone,bk_duedate,bk_date,bk_type,bk_desc,bk_introducer_phone,bk_introducer_consultant,bk_branches_id
  23. from customer_booking
  24. where bk_phone = #{bk_phone,jdbcType=VARCHAR}
  25. order by bk_date desc
  26. </select>
  27. <select id="selectAll" resultMap="BaseResultMap" parameterType="com.ygj.yuemum.domain.customer.CustomerBooking">
  28. select
  29. id, bk_phone,bk_duedate,bk_date,bk_type,bk_desc,bk_introducer_phone,bk_introducer_consultant,bk_branches_id
  30. case bk_type when 1 then '套餐预约' WHEN 2 then '月嫂预约' WHEN 3 then '设备租赁' WHEN 4 then '顾问预约' WHEN 5 then '设备归还' End as bk_typedesc
  31. from customer_booking
  32. where 1=1
  33. <if test="bk_phone != null and bk_phone != ''">
  34. and bk_phone = #{bk_phone,jdbcType=INTEGER}
  35. </if>
  36. <if test="bk_date != null and bk_date != ''">
  37. and bk_date = #{bk_date,jdbcType=INTEGER}
  38. </if>
  39. <if test="bk_type != null and bk_type != ''">
  40. and bk_type = #{bk_type,jdbcType=INTEGER}
  41. </if>
  42. <if test="bk_introducer_phone != null and bk_introducer_phone != ''">
  43. and bk_introducer_phone = #{bk_introducer_phone,jdbcType=INTEGER}
  44. </if>
  45. <if test="bk_introducer_consultant != null and bk_introducer_consultant != ''">
  46. and bk_introducer_consultant like "%"#{bk_introducer_consultant,jdbcType=VARCHAR}"%"
  47. </if>
  48. <if test="bk_type != null and bk_type != ''">
  49. and bk_type = #{bk_type,jdbcType=INTEGER}
  50. </if>
  51. <if test="bk_duedate != null and bk_duedate != ''">
  52. and bk_duedate = #{bk_duedate,jdbcType=INTEGER}
  53. </if>
  54. order by 1 desc
  55. </select>
  56. <select id="checkBooking" resultType="java.lang.Integer" parameterType="com.ygj.yuemum.domain.customer.CustomerBooking">
  57. select
  58. count(1)
  59. from customer_booking
  60. where 1=1
  61. <if test="bk_phone != null and bk_phone != ''">
  62. and bk_phone = #{bk_phone,jdbcType=INTEGER}
  63. </if>
  64. <if test="bk_date != null and bk_date != ''">
  65. and bk_date = #{bk_date,jdbcType=INTEGER}
  66. </if>
  67. <if test="bk_type != null and bk_type != ''">
  68. and bk_type = #{bk_type,jdbcType=INTEGER}
  69. </if>
  70. </select>
  71. <!-- 插入一条培训信息 -->
  72. <insert id="insertCustomerBooking" parameterType="com.ygj.yuemum.domain.customer.CustomerBooking" >
  73. insert into customer_booking
  74. <trim prefix="(" suffix=")" suffixOverrides="," >
  75. <if test="bk_phone != null" >
  76. bk_phone,
  77. </if>
  78. <if test="bk_duedate != null" >
  79. bk_duedate,
  80. </if>
  81. <if test="bk_date != null" >
  82. bk_date,
  83. </if>
  84. <if test="bk_type != null" >
  85. bk_type,
  86. </if>
  87. <if test="bk_introducer_phone != null" >
  88. bk_introducer_phone,
  89. </if>
  90. <if test="bk_introducer_consultant != null" >
  91. bk_introducer_consultant,
  92. </if>
  93. <if test="bk_desc != null" >
  94. bk_desc,
  95. </if>
  96. <if test="bk_branches_id != null" >
  97. bk_branches_id
  98. </if>
  99. </trim>
  100. <trim prefix="values (" suffix=")" suffixOverrides="," >
  101. <if test="bk_phone != null" >
  102. #{bk_phone,jdbcType=VARCHAR},
  103. </if>
  104. <if test="bk_duedate != null" >
  105. #{bk_duedate,jdbcType=DATE},
  106. </if>
  107. <if test="bk_date != null" >
  108. #{bk_date,jdbcType=DATE},
  109. </if>
  110. <if test="bk_type != null" >
  111. #{bk_type,jdbcType=INTEGER},
  112. </if>
  113. <if test="bk_introducer_phone != null" >
  114. #{bk_introducer_phone,jdbcType=INTEGER},
  115. </if>
  116. <if test="bk_introducer_consultant != null" >
  117. #{bk_introducer_consultant,jdbcType=INTEGER},
  118. </if>
  119. <if test="bk_desc != null" >
  120. #{bk_desc,jdbcType=VARCHAR},
  121. </if>
  122. <if test="bk_branches_id != null" >
  123. #{bk_branches_id,jdbcType=INTEGER}
  124. </if>
  125. </trim>
  126. </insert>
  127. </mapper>