Ver código fonte

feat:后端项目,新增用户调用接口关系对应的实体,mapper,service

yang yi 10 meses atrás
pai
commit
9770bd4c8a

+ 18 - 0
src/main/java/space/anyi/openAPI/mapper/UserInterfaceInfoMapper.java

@@ -0,0 +1,18 @@
+package space.anyi.openAPI.mapper;
+
+import space.anyi.openAPI.model.userInterfaceInfo.UserInterfaceInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author 杨逸
+* @description 针对表【user_interface_info(用户调用接口关系表)】的数据库操作Mapper
+* @createDate 2025-11-06 09:45:23
+* @Entity space.anyi.openAPI.model.userInterfaceInfo.UserInterfaceInfo
+*/
+public interface UserInterfaceInfoMapper extends BaseMapper<UserInterfaceInfo> {
+
+}
+
+
+
+

+ 125 - 0
src/main/java/space/anyi/openAPI/model/userInterfaceInfo/UserInterfaceInfo.java

@@ -0,0 +1,125 @@
+package space.anyi.openAPI.model.userInterfaceInfo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * 用户调用接口关系表
+ * @TableName user_interface_info
+ */
+@TableName(value ="user_interface_info")
+@Data
+public class UserInterfaceInfo implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 调用用户Id
+     */
+    private Long userId;
+
+    /**
+     * 接口Id
+     */
+    private Long interfaceInfoId;
+
+    /**
+     * 总调用次数
+     */
+    private Integer totalNum;
+
+    /**
+     * 剩余调用次数
+     */
+    private Integer leftNum;
+
+    /**
+     * 0-正常 ,1-禁用
+     */
+    private Integer status;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 是否删除(0-未删, 1-已删)
+     */
+    private Integer deleteFlag;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        UserInterfaceInfo other = (UserInterfaceInfo) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
+            && (this.getInterfaceInfoId() == null ? other.getInterfaceInfoId() == null : this.getInterfaceInfoId().equals(other.getInterfaceInfoId()))
+            && (this.getTotalNum() == null ? other.getTotalNum() == null : this.getTotalNum().equals(other.getTotalNum()))
+            && (this.getLeftNum() == null ? other.getLeftNum() == null : this.getLeftNum().equals(other.getLeftNum()))
+            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
+            && (this.getDeleteFlag() == null ? other.getDeleteFlag() == null : this.getDeleteFlag().equals(other.getDeleteFlag()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
+        result = prime * result + ((getInterfaceInfoId() == null) ? 0 : getInterfaceInfoId().hashCode());
+        result = prime * result + ((getTotalNum() == null) ? 0 : getTotalNum().hashCode());
+        result = prime * result + ((getLeftNum() == null) ? 0 : getLeftNum().hashCode());
+        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
+        result = prime * result + ((getDeleteFlag() == null) ? 0 : getDeleteFlag().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", userId=").append(userId);
+        sb.append(", interfaceInfoId=").append(interfaceInfoId);
+        sb.append(", totalNum=").append(totalNum);
+        sb.append(", leftNum=").append(leftNum);
+        sb.append(", status=").append(status);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append(", deleteFlag=").append(deleteFlag);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 13 - 0
src/main/java/space/anyi/openAPI/service/UserInterfaceInfoService.java

@@ -0,0 +1,13 @@
+package space.anyi.openAPI.service;
+
+import space.anyi.openAPI.model.userInterfaceInfo.UserInterfaceInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author 杨逸
+* @description 针对表【user_interface_info(用户调用接口关系表)】的数据库操作Service
+* @createDate 2025-11-06 09:45:23
+*/
+public interface UserInterfaceInfoService extends IService<UserInterfaceInfo> {
+
+}

+ 22 - 0
src/main/java/space/anyi/openAPI/service/impl/UserInterfaceInfoServiceImpl.java

@@ -0,0 +1,22 @@
+package space.anyi.openAPI.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import space.anyi.openAPI.model.userInterfaceInfo.UserInterfaceInfo;
+import space.anyi.openAPI.service.UserInterfaceInfoService;
+import space.anyi.openAPI.mapper.UserInterfaceInfoMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author 杨逸
+* @description 针对表【user_interface_info(用户调用接口关系表)】的数据库操作Service实现
+* @createDate 2025-11-06 09:45:23
+*/
+@Service
+public class UserInterfaceInfoServiceImpl extends ServiceImpl<UserInterfaceInfoMapper, UserInterfaceInfo>
+    implements UserInterfaceInfoService{
+
+}
+
+
+
+

+ 24 - 0
src/main/resources/mapper/UserInterfaceInfoMapper.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="space.anyi.openAPI.mapper.UserInterfaceInfoMapper">
+
+    <resultMap id="BaseResultMap" type="space.anyi.openAPI.model.userInterfaceInfo.UserInterfaceInfo">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="userId" column="user_id" jdbcType="BIGINT"/>
+            <result property="interfaceInfoId" column="interface_info_id" jdbcType="BIGINT"/>
+            <result property="totalNum" column="total_num" jdbcType="INTEGER"/>
+            <result property="leftNum" column="left_num" jdbcType="INTEGER"/>
+            <result property="status" column="status" jdbcType="INTEGER"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+            <result property="deleteFlag" column="delete_flag" jdbcType="TINYINT"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,user_id,interface_info_id,
+        total_num,left_num,status,
+        create_time,update_time,delete_flag
+    </sql>
+</mapper>