feat: 新表、新字段生成entity、mapper、service、enum

This commit is contained in:
yys 2026-04-17 14:29:31 +08:00
parent 5eaa4fe6df
commit d975e4fc19
23 changed files with 610 additions and 4 deletions

View File

@ -1,5 +1,6 @@
package com.ruoyi.common.core.domain.entity;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import javax.validation.constraints.Email;
@ -61,6 +62,12 @@ public class SysDept extends BaseEntity
/** Byte project */
private String project;
/** 部门余额 */
private BigDecimal balance;
/** 最大用户数 */
private Integer maxUserCount;
/** 子部门 */
private List<SysDept> children = new ArrayList<SysDept>();
@ -210,6 +217,26 @@ public class SysDept extends BaseEntity
this.project = project;
}
public BigDecimal getBalance()
{
return balance;
}
public void setBalance(BigDecimal balance)
{
this.balance = balance;
}
public Integer getMaxUserCount()
{
return maxUserCount;
}
public void setMaxUserCount(Integer maxUserCount)
{
this.maxUserCount = maxUserCount;
}
public List<SysDept> getChildren()
{
return children;
@ -234,6 +261,8 @@ public class SysDept extends BaseEntity
.append("byteApiKey", getByteApiKey())
.append("modelParm", getModelParm())
.append("project", getProject())
.append("balance", getBalance())
.append("maxUserCount", getMaxUserCount())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())

View File

@ -0,0 +1,34 @@
package com.ruoyi.common.enums;
import lombok.Getter;
/**
* 充值/退款订单状态ai_charge_refund_order.status
*/
@Getter
public enum ChargeRefundOrderStatusType {
PENDING(0, "进行中"),
SUCCESS(1, "已完成"),
FAILED(2, "失败");
private final int code;
private final String label;
ChargeRefundOrderStatusType(int code, String label) {
this.code = code;
this.label = label;
}
public static ChargeRefundOrderStatusType fromCode(Integer code) {
if (code == null) {
return null;
}
for (ChargeRefundOrderStatusType e : values()) {
if (e.code == code) {
return e;
}
}
return null;
}
}

View File

@ -0,0 +1,33 @@
package com.ruoyi.common.enums;
import lombok.Getter;
/**
* 充值/退款订单类型ai_charge_refund_order.order_type
*/
@Getter
public enum ChargeRefundOrderType {
CHARGE(0, "充值"),
REFUND(1, "退款");
private final int code;
private final String label;
ChargeRefundOrderType(int code, String label) {
this.code = code;
this.label = label;
}
public static ChargeRefundOrderType fromCode(Integer code) {
if (code == null) {
return null;
}
for (ChargeRefundOrderType e : values()) {
if (e.code == code) {
return e;
}
}
return null;
}
}

View File

@ -0,0 +1,36 @@
package com.ruoyi.common.enums;
import lombok.Getter;
/**
* 集团余额变动类型ai_group_balance_change_record.type
*/
@Getter
public enum GroupBalanceChangeType {
RECHARGE(0, "充值"),
REFUND(1, "退款"),
ISSUE(2, "下发"),
CONSUME(3, "消费"),
MANUAL_ADJUST(4, "手动修改");
private final int code;
private final String label;
GroupBalanceChangeType(int code, String label) {
this.code = code;
this.label = label;
}
public static GroupBalanceChangeType fromCode(Integer code) {
if (code == null) {
return null;
}
for (GroupBalanceChangeType e : values()) {
if (e.code == code) {
return e;
}
}
return null;
}
}

View File

@ -0,0 +1,56 @@
package com.ruoyi.ai.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
/**
* 充值/退款订单 ai_charge_refund_order
*/
@Data
@TableName("ai_charge_refund_order")
public class AiChargeRefundOrder implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Long id;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
private Long createBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private String orderNum;
private String thirdPartyOrderNum;
private Long deptId;
/** 订单类型0-充值 1-退款 */
// ChargeRefundOrderType
private Integer orderType;
private BigDecimal money;
private BigDecimal amount;
private String remark;
/** 状态0-进行中 1-已完成 2-失败 */
// ChargeRefundOrderStatusType
private Integer status;
}

View File

@ -0,0 +1,42 @@
package com.ruoyi.ai.domain;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
/**
* 部门方舟配置 ai_dept_ark_config
*/
@Data
@TableName("ai_dept_ark_config")
public class AiDeptArkConfig implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Long id;
private Long deptId;
/** 模型参数 JSON */
private String modelParm;
private String project;
private String byteApiKey;
private Long createBy;
private Long updateBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}

View File

@ -0,0 +1,49 @@
package com.ruoyi.ai.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
/**
* 集团余额变动记录 ai_group_balance_change_record
*/
@Data
@TableName("ai_group_balance_change_record")
public class AiGroupBalanceChangeRecord implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Long id;
/** 关联订单号 */
private String relationOrderNo;
private Long deptId;
/** 类型0-充值 1-退款 2-下发 3-消费 4-手动修改 */
// GroupBalanceChangeType
private Integer type;
private BigDecimal changeAmount;
private BigDecimal resultAmount;
private String remark;
private Long createBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}

View File

@ -44,6 +44,10 @@ public class AiOrder extends BaseEntity {
@Excel(name = "用户ID")
private Long userId;
/** 部门ID */
@Excel(name = "部门ID")
private Long deptId;
/** AI类型 */
@Excel(name = "AI类型")
private String type;

View File

@ -0,0 +1,50 @@
package com.ruoyi.ai.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
/**
* 视频报表数据 ai_video_report_data
*/
@Data
@TableName("ai_video_report_data")
public class AiVideoReportData implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(type = IdType.AUTO)
private Long id;
/** 统计日期键varchar */
private String dateKey;
/** 部门ID */
private Long deptId;
/** 用户ID */
private Long userId;
/** 积分/分数统计 */
private BigDecimal scoreCount;
/** 订单数 */
private Long orderCount;
/** 消耗 tokens */
private Long useTokens;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}

View File

@ -0,0 +1,10 @@
package com.ruoyi.ai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ai.domain.AiChargeRefundOrder;
/**
* 充值/退款订单 Mapper
*/
public interface AiChargeRefundOrderMapper extends BaseMapper<AiChargeRefundOrder> {
}

View File

@ -0,0 +1,10 @@
package com.ruoyi.ai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ai.domain.AiDeptArkConfig;
/**
* 部门方舟配置 Mapper
*/
public interface AiDeptArkConfigMapper extends BaseMapper<AiDeptArkConfig> {
}

View File

@ -0,0 +1,10 @@
package com.ruoyi.ai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ai.domain.AiGroupBalanceChangeRecord;
/**
* 集团余额变动记录 Mapper
*/
public interface AiGroupBalanceChangeRecordMapper extends BaseMapper<AiGroupBalanceChangeRecord> {
}

View File

@ -0,0 +1,10 @@
package com.ruoyi.ai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ai.domain.AiVideoReportData;
/**
* 视频报表数据 Mapper
*/
public interface AiVideoReportDataMapper extends BaseMapper<AiVideoReportData> {
}

View File

@ -0,0 +1,17 @@
package com.ruoyi.ai.service;
import com.ruoyi.ai.domain.AiChargeRefundOrder;
/**
* 充值/退款订单 Service
*/
public interface IAiChargeRefundOrderService {
AiChargeRefundOrder selectById(Long id);
int insert(AiChargeRefundOrder entity);
int updateById(AiChargeRefundOrder entity);
int deleteById(Long id);
}

View File

@ -0,0 +1,17 @@
package com.ruoyi.ai.service;
import com.ruoyi.ai.domain.AiDeptArkConfig;
/**
* 部门方舟配置 Service
*/
public interface IAiDeptArkConfigService {
AiDeptArkConfig selectById(Long id);
int insert(AiDeptArkConfig entity);
int updateById(AiDeptArkConfig entity);
int deleteById(Long id);
}

View File

@ -0,0 +1,17 @@
package com.ruoyi.ai.service;
import com.ruoyi.ai.domain.AiGroupBalanceChangeRecord;
/**
* 集团余额变动记录 Service
*/
public interface IAiGroupBalanceChangeRecordService {
AiGroupBalanceChangeRecord selectById(Long id);
int insert(AiGroupBalanceChangeRecord entity);
int updateById(AiGroupBalanceChangeRecord entity);
int deleteById(Long id);
}

View File

@ -0,0 +1,17 @@
package com.ruoyi.ai.service;
import com.ruoyi.ai.domain.AiVideoReportData;
/**
* 视频报表数据 Service
*/
public interface IAiVideoReportDataService {
AiVideoReportData selectById(Long id);
int insert(AiVideoReportData entity);
int updateById(AiVideoReportData entity);
int deleteById(Long id);
}

View File

@ -0,0 +1,38 @@
package com.ruoyi.ai.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ai.domain.AiChargeRefundOrder;
import com.ruoyi.ai.mapper.AiChargeRefundOrderMapper;
import com.ruoyi.ai.service.IAiChargeRefundOrderService;
/**
* 充值/退款订单 Service 实现
*/
@Service
public class AiChargeRefundOrderServiceImpl implements IAiChargeRefundOrderService {
@Autowired
private AiChargeRefundOrderMapper aiChargeRefundOrderMapper;
@Override
public AiChargeRefundOrder selectById(Long id) {
return aiChargeRefundOrderMapper.selectById(id);
}
@Override
public int insert(AiChargeRefundOrder entity) {
return aiChargeRefundOrderMapper.insert(entity);
}
@Override
public int updateById(AiChargeRefundOrder entity) {
return aiChargeRefundOrderMapper.updateById(entity);
}
@Override
public int deleteById(Long id) {
return aiChargeRefundOrderMapper.deleteById(id);
}
}

View File

@ -0,0 +1,38 @@
package com.ruoyi.ai.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ai.domain.AiDeptArkConfig;
import com.ruoyi.ai.mapper.AiDeptArkConfigMapper;
import com.ruoyi.ai.service.IAiDeptArkConfigService;
/**
* 部门方舟配置 Service 实现
*/
@Service
public class AiDeptArkConfigServiceImpl implements IAiDeptArkConfigService {
@Autowired
private AiDeptArkConfigMapper aiDeptArkConfigMapper;
@Override
public AiDeptArkConfig selectById(Long id) {
return aiDeptArkConfigMapper.selectById(id);
}
@Override
public int insert(AiDeptArkConfig entity) {
return aiDeptArkConfigMapper.insert(entity);
}
@Override
public int updateById(AiDeptArkConfig entity) {
return aiDeptArkConfigMapper.updateById(entity);
}
@Override
public int deleteById(Long id) {
return aiDeptArkConfigMapper.deleteById(id);
}
}

View File

@ -0,0 +1,38 @@
package com.ruoyi.ai.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ai.domain.AiGroupBalanceChangeRecord;
import com.ruoyi.ai.mapper.AiGroupBalanceChangeRecordMapper;
import com.ruoyi.ai.service.IAiGroupBalanceChangeRecordService;
/**
* 集团余额变动记录 Service 实现
*/
@Service
public class AiGroupBalanceChangeRecordServiceImpl implements IAiGroupBalanceChangeRecordService {
@Autowired
private AiGroupBalanceChangeRecordMapper aiGroupBalanceChangeRecordMapper;
@Override
public AiGroupBalanceChangeRecord selectById(Long id) {
return aiGroupBalanceChangeRecordMapper.selectById(id);
}
@Override
public int insert(AiGroupBalanceChangeRecord entity) {
return aiGroupBalanceChangeRecordMapper.insert(entity);
}
@Override
public int updateById(AiGroupBalanceChangeRecord entity) {
return aiGroupBalanceChangeRecordMapper.updateById(entity);
}
@Override
public int deleteById(Long id) {
return aiGroupBalanceChangeRecordMapper.deleteById(id);
}
}

View File

@ -0,0 +1,38 @@
package com.ruoyi.ai.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ai.domain.AiVideoReportData;
import com.ruoyi.ai.mapper.AiVideoReportDataMapper;
import com.ruoyi.ai.service.IAiVideoReportDataService;
/**
* 视频报表数据 Service 实现
*/
@Service
public class AiVideoReportDataServiceImpl implements IAiVideoReportDataService {
@Autowired
private AiVideoReportDataMapper aiVideoReportDataMapper;
@Override
public AiVideoReportData selectById(Long id) {
return aiVideoReportDataMapper.selectById(id);
}
@Override
public int insert(AiVideoReportData entity) {
return aiVideoReportDataMapper.insert(entity);
}
@Override
public int updateById(AiVideoReportData entity) {
return aiVideoReportDataMapper.updateById(entity);
}
@Override
public int deleteById(Long id) {
return aiVideoReportDataMapper.deleteById(id);
}
}

View File

@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="thirdPartyOrderNum" column="third_party_order_num" />
<result property="orderNum" column="order_num" />
<result property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="type" column="type" />
<result property="preDeductAmount" column="pre_deduct_amount" />
<result property="amount" column="amount" />
@ -37,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectAiOrderVo">
select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.third_party_order_num, ao.user_id, ao.type, ao.pre_deduct_amount, ao.amount, ao.total_usage, ao.result, ao.status, ao.source, ao.text, ao.is_top, ao.img1, ao.img2, ao.mode, ao.duration, ao.resolution, ao.ratio, ao.model, ao.video_params, au.user_id uuid, ao.ext_status, ao.is_backfilled, ao.video_gen_request_id from ai_order ao
select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.third_party_order_num, ao.user_id, ao.dept_id, ao.type, ao.pre_deduct_amount, ao.amount, ao.total_usage, ao.result, ao.status, ao.source, ao.text, ao.is_top, ao.img1, ao.img2, ao.mode, ao.duration, ao.resolution, ao.ratio, ao.model, ao.video_params, au.user_id uuid, ao.ext_status, ao.is_backfilled, ao.video_gen_request_id from ai_order ao
left join ai_user au on au.id = ao.user_id
</sql>
@ -47,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderNum != null and orderNum != ''"> and ao.order_num like concat('%', #{orderNum}, '%')</if>
<if test="text != null and text != ''"> and ao.text like concat('%', #{text}, '%')</if>
<if test="userId != null "> and ao.user_id = #{userId}</if>
<if test="deptId != null "> and ao.dept_id = #{deptId}</if>
<if test="uuid != null "> and au.user_id = #{uuid}</if>
<if test="isTop != null "> and ao.is_top = #{isTop}</if>
<if test="type != null "> and ao.type = #{type}</if>
@ -109,6 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark,</if>
<if test="orderNum != null">order_num,</if>
<if test="userId != null">user_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="type != null">type,</if>
<if test="amount != null">amount,</if>
<if test="result != null">result,</if>
@ -126,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">#{remark},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="userId != null">#{userId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="type != null">#{type},</if>
<if test="amount != null">#{amount},</if>
<if test="result != null">#{result},</if>
@ -147,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark = #{remark},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="type != null">type = #{type},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="result != null">result = #{result},</if>

View File

@ -23,10 +23,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="project" column="project" />
<result property="balance" column="balance" />
<result property="maxUserCount" column="max_user_count" />
</resultMap>
<sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.byte_api_key, d.status, d.del_flag, d.create_by, d.create_time, d.project
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.byte_api_key, d.status, d.del_flag, d.create_by, d.create_time, d.project, d.balance, d.max_user_count
from sys_dept d
</sql>
@ -62,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.byte_api_key, d.model_parm, d.status, d.project,
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.byte_api_key, d.model_parm, d.status, d.project, d.balance, d.max_user_count,
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
from sys_dept d
where d.dept_id = #{deptId}
@ -107,6 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="byteApiKey != null">byte_api_key,</if>
<if test="modelParm != null">model_parm,</if>
<if test="project != null">project,</if>
<if test="balance != null">balance,</if>
<if test="maxUserCount != null">max_user_count,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
@ -122,6 +126,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="byteApiKey != null">#{byteApiKey},</if>
<if test="modelParm != null">#{modelParm},</if>
<if test="project != null">#{project},</if>
<if test="balance != null">#{balance},</if>
<if test="maxUserCount != null">#{maxUserCount},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
@ -141,6 +147,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="byteApiKey != null">byte_api_key = #{byteApiKey},</if>
<if test="modelParm != null">model_parm = #{modelParm},</if>
<if test="project != null">project = #{project},</if>
<if test="balance != null">balance = #{balance},</if>
<if test="maxUserCount != null">max_user_count = #{maxUserCount},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()