Merge remote-tracking branch 'origin/master'

master
liyuxin 2024-09-09 15:41:01 +08:00
commit 5801c295a0
9 changed files with 343 additions and 19 deletions

View File

@ -0,0 +1,109 @@
package com.muyu.market.admain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.web.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.math.BigDecimal;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName(value = "market_belong",autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
public class Belong extends BaseEntity {
/**
*
*/
@TableId(value = "belong_id",type = IdType.AUTO)
private Long belongId;
/**
*
*/
@Schema(type = "String",description = "接口名称")
private String name;
/**
* /
*/
@Schema(type = "BigDecimal",description = "价钱/次")
private BigDecimal price;
/**
*
*/
@Schema(type = "String",description = "介绍")
private String test;
/**
*
*/
@Schema(type = "String",description = "我的数据")
private String data;
/**
*
*/
@Schema(type = "String",description = "接口名称")
private String apiName;
/**
*
*/
@Schema(type = "String",description = "接口地址")
private String ip;
/**
*
*/
@Schema(type = "String",description = "请求方式")
private String mode;
/**
* API
*/
@Schema(type = "String",description = "API类型")
private String type;
/**
*
*/
@Schema(type = "String",description = "返回报文")
private String msgresp;
/**
*
*/
@Schema(type = "String",description = "1")
private String createBy;
/**
*
*/
@Schema(type = "Date",description = "1")
private Date createTime;
/**
*
*/
@Schema(type = "String",description = "1")
private String updateBy;
/**
*
*/
@Schema(type = "Date",description = "sb")
private Date updateTime;
/**
*
*/
@Schema(type = "String",description = "备注")
private String remark;
/**
*
*/
@Schema(type = "Integer",description = "购买人信息")
private Integer userId;
/**
* 使
*/
@Schema(type = "Integer",description = "剩余使用次数")
private Integer num;
}

View File

@ -64,11 +64,6 @@ public class Myapi extends BaseEntity{
*/
@Schema(description = "请求方式",type = "String")
private String mode;
/**
*
*/
@Schema(description = "购买字段(当修改成功触发)",type = "Integer")
private int auth;
/*
API
*/
@ -79,7 +74,11 @@ public class Myapi extends BaseEntity{
*/
@Schema(description = "API返回报文",type = "String")
private String msgresp;
/*
*/
@Schema(description = "购买触发",type = "Integer")
private Integer buy;
private String createBy;
private Date createTime;
private String updateBy;
@ -96,7 +95,6 @@ public class Myapi extends BaseEntity{
.apiName( myapiSaveReq.getApiName())
.ip( myapiSaveReq.getIp())
.mode( myapiSaveReq.getMode())
.auth( myapiSaveReq.getAuth() )
.type( myapiSaveReq.getType())
.msgresp(myapiSaveReq.getMsgresp())
.build();
@ -115,7 +113,6 @@ public class Myapi extends BaseEntity{
.apiName( myapiUpdReq.getApiName())
.ip( myapiUpdReq.getIp())
.mode( myapiUpdReq.getMode())
.auth( myapiUpdReq.getAuth() )
.type( myapiUpdReq.getType())
.msgresp(myapiUpdReq.getMsgresp())
.build();

View File

@ -59,11 +59,6 @@ public class MyapiSaveReq {
*/
@Schema(description = "请求方式",type = "String")
private String mode;
/**
*
*/
@Schema(description = "购买字段(当修改成功触发)",type = "Integer")
private int auth;
/*
API
*/

View File

@ -0,0 +1,130 @@
package com.muyu.market.admain.response;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.muyu.market.admain.Belong;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.math.BigDecimal;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Tag( name = "响应数据",description = "用于展示购买的列表数据")
public class BelongResp {
/**
*
*/
@TableId(value = "belong_id",type = IdType.AUTO)
private Long belongId;
/**
*
*/
@Schema(type = "String",description = "接口名称")
private String name;
/**
* /
*/
@Schema(type = "BigDecimal",description = "价钱/次")
private BigDecimal price;
/**
*
*/
@Schema(type = "String",description = "介绍")
private String test;
/**
*
*/
@Schema(type = "String",description = "我的数据")
private String data;
/**
*
*/
@Schema(type = "String",description = "接口名称")
private String apiName;
/**
*
*/
@Schema(type = "String",description = "接口地址")
private String ip;
/**
*
*/
@Schema(type = "String",description = "请求方式")
private String mode;
/**
* API
*/
@Schema(type = "String",description = "API类型")
private String type;
/**
*
*/
@Schema(type = "String",description = "返回报文")
private String msgresp;
/**
*
*/
@Schema(type = "String",description = "1")
private String createBy;
/**
*
*/
@Schema(type = "Date",description = "1")
private Date createTime;
/**
*
*/
@Schema(type = "String",description = "1")
private String updateBy;
/**
*
*/
@Schema(type = "Date",description = "sb")
private Date updateTime;
/**
*
*/
@Schema(type = "String",description = "备注")
private String remark;
/**
*
*/
@Schema(type = "Integer",description = "购买人信息")
private Integer userId;
/**
* 使
*/
@Schema(type = "Integer",description = "剩余使用次数")
private Integer num;
public static BelongResp setBelongList(Belong belong){
return BelongResp.
builder()
.belongId(belong.getBelongId())
.name( belong.getName() )
.price(belong.getPrice())
.test( belong.getTest() )
.data( belong.getData() )
.apiName(belong.getApiName())
.ip(belong.getIp())
.mode(belong.getMode())
.type(belong.getType())
.msgresp(belong.getMsgresp())
.createBy(belong.getCreateBy())
.createTime(belong.getCreateTime())
.updateBy(belong.getUpdateBy())
.updateTime(belong.getUpdateTime())
.remark(belong.getRemark())
.userId(belong.getUserId())
.num(belong.getNum())
.build();
}
}

View File

@ -60,11 +60,6 @@ public class MyapiListResp {
*/
@Schema(description = "请求方式",type = "String")
private String mode;
/**
*
*/
@Schema(description = "购买字段(当修改成功触发)",type = "Integer")
private int auth;
/*
API
*/
@ -96,7 +91,6 @@ public class MyapiListResp {
.apiName( myapi.getApiName())
.ip( myapi.getIp())
.mode( myapi.getMode())
.auth( myapi.getAuth())
.type( myapi.getType())
.msgresp( myapi.getMsgresp() )
.build();

View File

@ -0,0 +1,29 @@
package com.muyu.market.server.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.common.system.domain.LoginUser;
import com.muyu.market.admain.Belong;
import com.muyu.market.server.service.BelongService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@Tag( name = "购物车控制层",description = "查询登录人购买操作")
public class BelongController {
@Autowired
private BelongService belongService;
@PostMapping("/selectBelongByUser")
public Result selectBelongByUser(){
LoginUser loginUser = SecurityUtils.getLoginUser();
Integer userid = Math.toIntExact( loginUser.getUserid() );
System.out.println(loginUser);
List<Belong> belongListByUserId = belongService.findBelongListByUserId( userid );
return Result.success(belongListByUserId);
}
}

View File

@ -0,0 +1,10 @@
package com.muyu.market.server.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.market.admain.Belong;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BelongMapper extends BaseMapper<Belong> {
}

View File

@ -0,0 +1,22 @@
package com.muyu.market.server.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.market.admain.Belong;
import java.util.List;
public interface BelongService extends IService<Belong> {
/**
*
*
* @param userId
* @return
*/
List<Belong>findBelongListByUserId(Integer userId);
/**
*
* @param belong
*/
void addBelong(Belong belong);
}

View File

@ -0,0 +1,38 @@
package com.muyu.market.server.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.common.system.domain.LoginUser;
import com.muyu.market.admain.Belong;
import com.muyu.market.server.mapper.BelongMapper;
import com.muyu.market.server.service.BelongService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class BelongServiceImpl extends ServiceImpl<BelongMapper, Belong> implements BelongService {
@Autowired
private BelongMapper belongMapper;
//展示个人购买数据
@Override
public List<Belong> findBelongListByUserId(Integer userId) {
LambdaQueryWrapper<Belong> belongRespLambdaQueryWrapper = new LambdaQueryWrapper<>();
LambdaQueryWrapper<Belong> eq = belongRespLambdaQueryWrapper.eq( Belong::getUserId, userId );
List<Belong> list = this.list( eq );
return list;
}
/**
*
* @param belong
*/
@Override
public void addBelong(Belong belong) {
belongMapper.insert( belong );
}
}