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

82 lines
3.2 KiB

11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
11 months ago
10 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
10 months ago
11 months ago
  1. package com.example.demo.mapper;
  2. import com.example.demo.domain.entity.Admin;
  3. import com.example.demo.domain.entity.Detail;
  4. import com.example.demo.domain.entity.Product;
  5. import com.example.demo.domain.entity.User;
  6. import com.example.demo.domain.vo.ConsumeDetail;
  7. import org.apache.ibatis.annotations.*;
  8. import java.util.List;
  9. @Mapper
  10. public interface ConsumeMapper {
  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. })
  28. // 获取自增主键
  29. @Options(useGeneratedKeys = true,keyColumn = "detail_id",keyProperty = "detailId")
  30. int insert(Detail detail);
  31. //userName
  32. //模糊分页查询,查询消费明细
  33. @Select({
  34. "<script>",
  35. "select detail_y.*,admin.name as adminName ,admin.area as area ,user.name as userName,product.name as productName from detail ",
  36. "inner join `admin` on detail.admin_id=admin.admin_id ",
  37. "inner join `user` on detail.jwcode= user.jwcode ",
  38. "inner join product on detail.product_id= product.product_id ",
  39. "<where>",
  40. // "`detail_flag`=1 AND update_type = '1'",
  41. "update_type=1",
  42. "<if test='jwcode!=null'>and detail.jwcode =#{jwcode}</if>",
  43. "<if test='productName!=null'>and product.name like concat('%',#{productName},'%')</if>",
  44. "<if test='consumePlatform!=null'>and detail.consume_platform like concat('%',#{consumePlatform},'%')</if>",
  45. "<if test='consumeType!=null'>and detail.consume_type like concat('%',#{consumeType},'%')</if>",
  46. "<if test='startDate != null and endDate != null'>AND detail.create_time BETWEEN #{startDate} AND #{endDate}</if>",
  47. "</where>",
  48. // "ORDER BY detail.create_time DESC",
  49. "</script>"
  50. })
  51. List<ConsumeDetail> select(ConsumeDetail consumeDetail);
  52. //查询消费信息
  53. @Select({
  54. "select * ,product.name as productName from detail " ,
  55. "inner join product on detail.product_id= product.product_id ",
  56. "where `detail_flag`=1 AND update_type = '1' and jwcode=#{jwcode} AND refund_flag=1"
  57. })
  58. List<Detail> getDeatil(Integer jwcode);
  59. //查询消费信息
  60. @Select({
  61. "select * from product",
  62. " where product_flag=1 and name=#{name}",
  63. "GROUP BY name"
  64. })
  65. List<Product> getProduct(String name);
  66. }