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

86 lines
3.6 KiB

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