WXMMUserSearchMapper.xml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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.wxmini.WXMMUserSearchDao">
  4. <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.wxmini.WXMMUserSearch">
  5. <id column="id" property="id" jdbcType="INTEGER"/>
  6. <result column="wmu_openid" property="wmu_openid" jdbcType="VARCHAR"/>
  7. <result column="wmu_phone" property="wmu_phone" jdbcType="VARCHAR"/>
  8. <result column="wmu_city" property="wmu_city" jdbcType="VARCHAR"/>
  9. <result column="wmu_date" property="wmu_date" jdbcType="DATE"/>
  10. </resultMap>
  11. <!--获取所有数据-->
  12. <select id="getWXMMUserSearchs" resultType="com.ygj.yuemum.domain.wxmini.WXMMUserSearch" parameterType="java.lang.String">
  13. select
  14. *
  15. from wx_mm_user_search
  16. where wmu_openid = #{wmu_openid,jdbcType=VARCHAR}
  17. order by id asc
  18. </select>
  19. <select id="queryWXMMUserSearchs" resultType="com.ygj.yuemum.domain.wxmini.WXMMUserSearch" parameterType="com.ygj.yuemum.domain.wxmini.WXMMUserSearch">
  20. select
  21. id,
  22. wmu_openid,
  23. wmu_phone,
  24. wmu_city,
  25. wmu_date,
  26. fgetbranches_name(wmu_city) wmu_city_name
  27. from wx_mm_user_search
  28. where 1=1
  29. <if test="wmu_openid != null and wmu_openid != ''">
  30. and wmu_openid like "%"#{wmu_openid,jdbcType=VARCHAR}"%"
  31. </if>
  32. <if test="wmu_phone != null and wmu_phone != ''">
  33. and wmu_phone = #{wmu_phone,jdbcType=INTEGER}
  34. </if>
  35. <if test="wmu_city != null and wmu_city != ''">
  36. and wmu_city = #{wmu_city,jdbcType=INTEGER}
  37. </if>
  38. <if test="wmu_date != null and wmu_date != ''">
  39. and DATE_FORMAT(wmu_date,'%Y-%m-%d') = DATE_FORMAT(#{wmu_date,jdbcType=DATE},'%Y-%m-%d')
  40. </if>
  41. order by id desc
  42. </select>
  43. <insert id="insertWXMMUserSearch" parameterType="com.ygj.yuemum.domain.wxmini.WXMMUserSearch" >
  44. insert into wx_mm_user_search
  45. <trim prefix="(" suffix=")" suffixOverrides="," >
  46. <if test="wmu_openid != null" >
  47. wmu_openid,
  48. </if>
  49. <if test="wmu_phone != null" >
  50. wmu_phone,
  51. </if>
  52. <if test="wmu_city != null" >
  53. wmu_city,
  54. </if>
  55. <if test="wmu_date != null" >
  56. wmu_date
  57. </if>
  58. </trim>
  59. <trim prefix="values (" suffix=")" suffixOverrides="," >
  60. <if test="wmu_openid != null" >
  61. #{wmu_openid,jdbcType=VARCHAR},
  62. </if>
  63. <if test="wmu_phone != null" >
  64. #{wmu_phone,jdbcType=VARCHAR},
  65. </if>
  66. <if test="wmu_city != null" >
  67. #{wmu_city,jdbcType=VARCHAR},
  68. </if>
  69. <if test="wmu_date != null" >
  70. #{wmu_date,jdbcType=DATE}
  71. </if>
  72. </trim>
  73. </insert>
  74. <select id="getWXMMUserSearchId" resultType="java.lang.Integer" >
  75. SELECT auto_increment
  76. FROM information_schema.tables
  77. where table_schema="yuemum"
  78. and table_name="wx_mm_user_search";
  79. </select>
  80. </mapper>