金币系统后端
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.

102 lines
4.3 KiB

3 weeks ago
  1. package com.example.demo.mapper;
  2. import com.example.demo.domain.entity.*;
  3. import com.example.demo.domain.vo.ConsumeDetail;
  4. import com.example.demo.domain.vo.SumConsume;
  5. import org.apache.ibatis.annotations.*;
  6. import java.util.List;
  7. @Mapper
  8. public interface ConsumeMapper {
  9. SumConsume getSumConsume(SumConsume sumConsume);
  10. List<String> getConsume();
  11. //通过id查询user全部信息
  12. @Select({
  13. "select * from user where user_id=#{userId}"
  14. })
  15. User getByUserId(Integer userId);
  16. //通过id查询admin全部信息
  17. @Select({
  18. "select * from admin where admin_id=#{adminId}"
  19. })
  20. Admin getByadminId(@Param("adminId") Integer adminId);
  21. //新增消费记录
  22. @Insert({
  23. // "insert into detail",
  24. // "(jwcode,activity_id,recharge_way,product_id,consume_platform,consume_type,refund_type,refund_goods,contact_id,remark,recharge_coin,free_coin,task_coin,admin_id,update_type,detail_flag,create_time,refund_flag,order_code)",
  25. // "values",
  26. // "(#{jwcode},#{activityId},#{rechargeWay},#{productId},'金币系统','购买商品',#{refundType},#{refundGoods},#{contactId},#{remark},#{rechargeCoin},#{freeCoin},#{taskCoin},#{adminId},#{updateType},1,now(),1,#{orderCode})"
  27. "insert into detail_y",
  28. "(jwcode,order_code,activity_id,recharge_way,product_id,consume_platform,consume_type,refund_type,refund_goods," +
  29. "contact_id,remark,recharge_coin,free_coin,task_coin,admin_id,update_type,detail_flag,refund_flag,create_time,first_recharge,`name`,username,area,product_name)",
  30. "values ",
  31. "(#{jwcode},#{orderCode},#{activityId},#{rechargeWay},#{productId},'4','购买商品',#{refundType}" +
  32. ",#{refundGoods},#{contactId},#{remark},#{rechargeCoin}" +
  33. ",#{freeCoin},#{taskCoin},#{adminId},#{updateType},1,1,now(),#{firstRecharge},#{name},#{username},#{area},#{productName})"
  34. })
  35. // 获取自增主键
  36. @Options(useGeneratedKeys = true,keyColumn = "detaily_id",keyProperty = "detailyId")
  37. int insert(DetailY detailY);
  38. //userName
  39. //模糊分页查询,查询消费明细
  40. // @Select({
  41. // "<script>",
  42. // "select detail_y.*,admin.name as adminName,product.name as productName from detail_y ",
  43. // "left join `admin` on detail_y.admin_id=admin.admin_id ",
  44. // "left join `user` on detail_y.jwcode= user.jwcode ",
  45. // "left join product on detail_y.product_id= product.product_id ",
  46. // "<where>",
  47. //// "`detail_flag`=1 AND update_type = '1'",
  48. // "update_type=1",
  49. // "<if test='jwcode!=null'>and detail_y.jwcode =#{jwcode}</if>",
  50. // "<if test='productName!=null and productName.length>0'>and product.name = #{productName}</if>",
  51. // "<if test='consumePlatform!=null and consumePlatform.length>0'>and detail_y.consume_platform=#{consumePlatform}</if>",
  52. // "<if test='consumeType!=null and consumeType.length>0'>and detail_y.consume_type= #{consumeType}</if>",
  53. // "<if test='startDate != null and endDate != null'>AND detail_y.create_time BETWEEN #{startDate} AND #{endDate}</if>",
  54. // "<if test='area!=null and area.length>0'>and area=#{area}</if>",
  55. // "</where>",
  56. //
  57. // "<choose>",
  58. // " <!-- 优先使用前端传入的排序参数 -->",
  59. // " <when test='sortField != null or sortOrder != null'>",
  60. // " ORDER BY ${sortField} ${sortOrder}",
  61. // " </when>",
  62. // " <!-- 默认排序 -->",
  63. // " <otherwise>",
  64. // "ORDER BY detail_y.create_time DESC",
  65. // " </otherwise>",
  66. // "</choose>",
  67. // "</script>"
  68. // })
  69. List<ConsumeDetail> select(ConsumeDetail consumeDetail);
  70. //查询消费信息
  71. @Select({
  72. "select * from detail_y " ,
  73. // "inner join product on detail_y.product_id= product.product_id ",
  74. "where `detail_flag`=1 AND update_type = '1' and jwcode=#{jwcode} AND refund_flag=1"
  75. })
  76. List<Detail> getDeatil(String jwcode);
  77. //查询消费信息
  78. @Select({
  79. "select * from product",
  80. " where product_flag=1 and name=#{name}",
  81. "GROUP BY name"
  82. })
  83. List<Product> getProduct(String name);
  84. }