2组颜值担当在9月八日23.44推的后台
parent
938ef7dab5
commit
e08d8e7f23
|
@ -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;
|
||||
}
|
|
@ -64,11 +64,14 @@ public class Myapi extends BaseEntity{
|
|||
*/
|
||||
@Schema(description = "请求方式",type = "String")
|
||||
private String mode;
|
||||
<<<<<<< HEAD
|
||||
/**
|
||||
* 购买字段
|
||||
*/
|
||||
@Schema(description = "购买字段(当修改成功触发)",type = "Integer")
|
||||
private int auth;
|
||||
=======
|
||||
>>>>>>> 8c53524 (2组颜值担当在9月八日23.44推的后台)
|
||||
/*
|
||||
API类型
|
||||
*/
|
||||
|
@ -79,6 +82,14 @@ public class Myapi extends BaseEntity{
|
|||
*/
|
||||
@Schema(description = "API返回报文",type = "String")
|
||||
private String msgresp;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
/*
|
||||
购买触发
|
||||
*/
|
||||
@Schema(description = "购买触发",type = "Integer")
|
||||
private Integer buy;
|
||||
>>>>>>> 8c53524 (2组颜值担当在9月八日23.44推的后台)
|
||||
|
||||
private String createBy;
|
||||
private Date createTime;
|
||||
|
@ -96,7 +107,10 @@ public class Myapi extends BaseEntity{
|
|||
.apiName( myapiSaveReq.getApiName())
|
||||
.ip( myapiSaveReq.getIp())
|
||||
.mode( myapiSaveReq.getMode())
|
||||
<<<<<<< HEAD
|
||||
.auth( myapiSaveReq.getAuth() )
|
||||
=======
|
||||
>>>>>>> 8c53524 (2组颜值担当在9月八日23.44推的后台)
|
||||
.type( myapiSaveReq.getType())
|
||||
.msgresp(myapiSaveReq.getMsgresp())
|
||||
.build();
|
||||
|
@ -115,7 +129,10 @@ public class Myapi extends BaseEntity{
|
|||
.apiName( myapiUpdReq.getApiName())
|
||||
.ip( myapiUpdReq.getIp())
|
||||
.mode( myapiUpdReq.getMode())
|
||||
<<<<<<< HEAD
|
||||
.auth( myapiUpdReq.getAuth() )
|
||||
=======
|
||||
>>>>>>> 8c53524 (2组颜值担当在9月八日23.44推的后台)
|
||||
.type( myapiUpdReq.getType())
|
||||
.msgresp(myapiUpdReq.getMsgresp())
|
||||
.build();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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> {
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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 );
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue