You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.6 KiB

  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.example.demo.mapper.coin.BeanRechargeMapper1">
  4. <insert id="add" parameterType="com.example.demo.domain.vo.bean.BeanRecharge" useGeneratedKeys="true" keyProperty="id">
  5. INSERT INTO audit
  6. <trim prefix="(" suffix=")" suffixOverrides=",">
  7. jwcode,
  8. buy_jd,
  9. free_jd,
  10. type,
  11. admin_name,
  12. remark,
  13. audit_status
  14. </trim>
  15. VALUES
  16. <trim prefix="(" suffix=")" suffixOverrides=",">
  17. #{jwcode},
  18. #{permanentBean},
  19. #{freeBean},
  20. 0,
  21. #{adminName},
  22. #{remark},
  23. 0
  24. </trim>
  25. </insert>
  26. <!--筛选查询小黄车消费数据-->
  27. <select id="selectCartBy" resultType="com.example.demo.domain.vo.bean.BeanConsumeCartVo">
  28. select
  29. co.id, co.nickname,co.jwcode,m.name AS market,pd.name AS productName,co.total_money,co.source_name,co.live_name, FROM_UNIXTIME(co.created_at) AS createdAt
  30. from cart_order co
  31. left join user u on u.jwcode = co.jwcode
  32. left join market m on m.id = u.market
  33. left join product_dict pd on pd.id = co.product_id
  34. <where>
  35. <if test="jwcode!= null and jwcode!=''">
  36. and co.jwcode =#{jwcode}
  37. </if>
  38. <if test="market!= null and market!=''">
  39. and m.id = #{market}
  40. </if>
  41. <if test="productName!= null and productName!=''">
  42. and pd.name = #{productName}
  43. </if>
  44. <if test="liveName!= null and liveName!=''">
  45. and co.live_name = #{liveName}
  46. </if>
  47. <if test="sourceName!= null and sourceName!=''">
  48. and co.source_name = #{sourceName}
  49. </if>
  50. <if test="startAt!= null and startAt!='' and endAt!=null and endAt!=''">
  51. and co.created_at between
  52. UNIX_TIMESTAMP(#{beanConsumeCartDTO.startTime}) and
  53. UNIX_TIMESTAMP(#{beanConsumeCartDTO.endTime})
  54. </if>
  55. </where>
  56. <choose>
  57. <when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
  58. ORDER BY ${sortField} ${sortOrder}
  59. </when>
  60. <otherwise>
  61. ORDER BY created_at DESC
  62. </otherwise>
  63. </choose>
  64. </select>
  65. </mapper>