@@ -0,0 +1,52 @@ | |||
package com.iformall.domain.po; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.iformall.domain.po.base.TenantEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.ToString; | |||
import java.util.Date; | |||
@TableName(value = "level_package") | |||
@Data | |||
@ToString(callSuper = true) | |||
@EqualsAndHashCode(callSuper = true) | |||
public class LevelPackage extends TenantEntity { | |||
protected Long id; | |||
@io.swagger.annotations.ApiModelProperty(value="等级",name="level") | |||
private Integer level; | |||
@io.swagger.annotations.ApiModelProperty(value="名称",name="name") | |||
private String name; | |||
@io.swagger.annotations.ApiModelProperty(value="",name="en_name") | |||
private String en_name; | |||
@io.swagger.annotations.ApiModelProperty(value="套餐色",name="color") | |||
private String color; | |||
@io.swagger.annotations.ApiModelProperty(value="",name="priceDollar") | |||
private Integer priceDollar; | |||
@io.swagger.annotations.ApiModelProperty(value="",name="priceRmb") | |||
private Integer priceRmb; | |||
@io.swagger.annotations.ApiModelProperty(value="套餐积分",name="credit") | |||
private Integer credit; | |||
@io.swagger.annotations.ApiModelProperty(value="套餐时长",name="validityDuration") | |||
private Integer validityDuration; | |||
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
private Date createDate; | |||
@io.swagger.annotations.ApiModelProperty(value="",name="updateDate") | |||
private Date updateDate; | |||
@TableField(exist = false) | |||
private Date startDate; | |||
@TableField(exist = false) | |||
private Date endDate; | |||
} |
@@ -0,0 +1,121 @@ | |||
package com.iformall.domain.po; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.iformall.domain.po.base.TenantEntity; | |||
import com.iformall.enums.sm.EnumAiTemplateType; | |||
import com.iformall.enums.sm.EnumLanguageType; | |||
import com.iformall.enums.sm.EnumSoundType; | |||
import com.iformall.enums.sm.EnumVideoFormatType; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.ToString; | |||
import java.util.Date; | |||
@TableName(value = "project_package_detail") | |||
@Data | |||
@ToString(callSuper = true) | |||
@EqualsAndHashCode(callSuper = true) | |||
public class ProjectPackageDetail extends TenantEntity { | |||
protected Long id; | |||
@io.swagger.annotations.ApiModelProperty(value="项目",name="projectType") | |||
private Integer projectType; | |||
@io.swagger.annotations.ApiModelProperty(value="套餐ID",name="packageId") | |||
private Long packageId; | |||
@io.swagger.annotations.ApiModelProperty(value="邀请用户加积分数量",name="inviteUserCredit") | |||
private Integer inviteUserCredit; | |||
@io.swagger.annotations.ApiModelProperty(value="ai生成照片价格",name="aiPhotoPrice") | |||
private Integer aiPhotoPrice; | |||
@io.swagger.annotations.ApiModelProperty(value="ai生成脚本价格",name="aiScriptPrice") | |||
private Integer aiScriptPrice; | |||
@io.swagger.annotations.ApiModelProperty(value="生成视频价格",name="videoPrice") | |||
private Integer videoPrice; | |||
@io.swagger.annotations.ApiModelProperty(value="是否有水印",name="isVideoWatermark") | |||
private Integer isVideoWatermark; | |||
@io.swagger.annotations.ApiModelProperty(value="EnumLanguageType",name="language") | |||
private Integer language; | |||
@TableField(exist = false) | |||
private String languageDesc; | |||
public String getLanguageDesc(){ | |||
if(this.language != null){ | |||
EnumLanguageType languageEnum = EnumLanguageType.getEnum(language); | |||
if(languageEnum != null){ | |||
languageDesc = languageEnum.getMessage(); | |||
} | |||
} | |||
return languageDesc; | |||
} | |||
@io.swagger.annotations.ApiModelProperty(value="EnumSoundType",name="sound") | |||
private Integer sound; | |||
@TableField(exist = false) | |||
private String soundDesc; | |||
public String getSoundDesc(){ | |||
if(this.sound != null){ | |||
EnumSoundType soundEnum = EnumSoundType.getEnum(sound); | |||
if(soundEnum != null){ | |||
soundDesc = soundEnum.getMessage(); | |||
} | |||
} | |||
return soundDesc; | |||
} | |||
@io.swagger.annotations.ApiModelProperty(value="生成视频最大时长(s)",name="videoTime") | |||
private Integer videoTime; | |||
@io.swagger.annotations.ApiModelProperty(value="可生成照片的次数",name="aiPhoto") | |||
private Integer aiPhoto; | |||
@io.swagger.annotations.ApiModelProperty(value="是否可唱歌",name="isSing") | |||
private Integer isSing; | |||
@io.swagger.annotations.ApiModelProperty(value="可生成脚本的次数",name="aiScript") | |||
private Integer aiScript; | |||
@io.swagger.annotations.ApiModelProperty(value="EnumVideoFormatType",name="videoFormat") | |||
private Integer videoFormat; | |||
@TableField(exist = false) | |||
private String videoFormatDesc; | |||
public String getVideoFormatDesc(){ | |||
if(this.videoFormat != null){ | |||
EnumVideoFormatType videoFormatEnum = EnumVideoFormatType.getEnum(videoFormat); | |||
if(videoFormatEnum != null){ | |||
videoFormatDesc = videoFormatEnum.getMessage(); | |||
} | |||
} | |||
return videoFormatDesc; | |||
} | |||
@io.swagger.annotations.ApiModelProperty(value="EnumAiTemplateType",name="template") | |||
private Integer template; | |||
@TableField(exist = false) | |||
private String templateDesc; | |||
public String getTemplateDesc(){ | |||
if(this.template != null){ | |||
EnumAiTemplateType templateEnum = EnumAiTemplateType.getEnum(template); | |||
if(templateEnum != null){ | |||
templateDesc = templateEnum.getMessage(); | |||
} | |||
} | |||
return templateDesc; | |||
} | |||
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
private Date createDate; | |||
@io.swagger.annotations.ApiModelProperty(value="",name="updateDate") | |||
private Date updateDate; | |||
@TableField(exist = false) | |||
private Date startDate; | |||
@TableField(exist = false) | |||
private Date endDate; | |||
} |
@@ -0,0 +1,52 @@ | |||
package com.iformall.domain.po; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.iformall.domain.po.base.TenantEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.ToString; | |||
import java.util.Date; | |||
@TableName(value = "user_level_package") | |||
@Data | |||
@ToString(callSuper = true) | |||
@EqualsAndHashCode(callSuper = true) | |||
public class UserLevelPackage extends TenantEntity { | |||
protected Long id; | |||
@io.swagger.annotations.ApiModelProperty(value="套餐ID",name="packageId") | |||
private Long packageId; | |||
@io.swagger.annotations.ApiModelProperty(value="套餐等级",name="packageLevel") | |||
private Integer packageLevel; | |||
@io.swagger.annotations.ApiModelProperty(value="套餐色",name="packageColor") | |||
private String packageColor; | |||
@io.swagger.annotations.ApiModelProperty(value="用户总积分",name="userCredits") | |||
private Integer userCredits; | |||
@io.swagger.annotations.ApiModelProperty(value="剩余积分",name="residueCredits") | |||
private Integer residueCredits; | |||
@io.swagger.annotations.ApiModelProperty(value="到期时间",name="expiresDate") | |||
private Date expiresDate; | |||
@io.swagger.annotations.ApiModelProperty(value="",name="createDate") | |||
private Date createDate; | |||
@io.swagger.annotations.ApiModelProperty(value="",name="updateDate") | |||
private Date updateDate; | |||
@TableField(exist = false) | |||
private Integer addCredits; | |||
@TableField(exist = false) | |||
private Integer addSumCredits; | |||
@TableField(exist = false) | |||
private Integer reduceCredits; | |||
} |
@@ -0,0 +1,34 @@ | |||
package com.iformall.enums.sm; | |||
/** | |||
* 数字人模板 | |||
*/ | |||
public enum EnumAiTemplateType { | |||
FREE(1, "免费"), | |||
VIP(2, "VIP"); | |||
public static EnumAiTemplateType getEnum(Integer code) { | |||
for (EnumAiTemplateType value : values()) { | |||
if (value.getCode().equals(code)) { | |||
return value; | |||
} | |||
} | |||
return null; | |||
} | |||
private Integer code; | |||
private String message; | |||
EnumAiTemplateType(Integer code, String message) { | |||
this.code = code; | |||
this.message = message; | |||
} | |||
public Integer getCode() { | |||
return code; | |||
} | |||
public String getMessage() { | |||
return message; | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
package com.iformall.enums.sm; | |||
/** | |||
* 数字人模板 | |||
*/ | |||
public enum EnumTemplateType { | |||
FREE(1, "免费"), | |||
VIP(2, "VIP"); | |||
public static EnumTemplateType getEnum(Integer code) { | |||
for (EnumTemplateType value : values()) { | |||
if (value.getCode().equals(code)) { | |||
return value; | |||
} | |||
} | |||
return null; | |||
} | |||
private Integer code; | |||
private String message; | |||
EnumTemplateType(Integer code, String message) { | |||
this.code = code; | |||
this.message = message; | |||
} | |||
public Integer getCode() { | |||
return code; | |||
} | |||
public String getMessage() { | |||
return message; | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
package com.iformall.enums.sm; | |||
/** | |||
* 分辨率 | |||
*/ | |||
public enum EnumVideoFormatType { | |||
VIDEOFORMAT_720P(1, "720p"), | |||
VIDEOFORMAT_1080P(2, "1080p"); | |||
public static EnumVideoFormatType getEnum(Integer code) { | |||
for (EnumVideoFormatType value : values()) { | |||
if (value.getCode().equals(code)) { | |||
return value; | |||
} | |||
} | |||
return null; | |||
} | |||
private Integer code; | |||
private String message; | |||
EnumVideoFormatType(Integer code, String message) { | |||
this.code = code; | |||
this.message = message; | |||
} | |||
public Integer getCode() { | |||
return code; | |||
} | |||
public String getMessage() { | |||
return message; | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
package com.iformall.mapper; | |||
import com.iformall.common.CommonMapper; | |||
import com.iformall.domain.po.LevelPackage; | |||
import java.util.List; | |||
public interface LevelPackageMapper extends CommonMapper<LevelPackage, Long>{ | |||
List<LevelPackage> findList(LevelPackage record); | |||
} |
@@ -0,0 +1,12 @@ | |||
package com.iformall.mapper; | |||
import com.iformall.common.CommonMapper; | |||
import com.iformall.domain.po.ProjectPackageDetail; | |||
import java.util.List; | |||
public interface ProjectPackageDetailMapper extends CommonMapper<ProjectPackageDetail, Long>{ | |||
List<ProjectPackageDetail> findList(ProjectPackageDetail record); | |||
} |
@@ -0,0 +1,12 @@ | |||
package com.iformall.mapper; | |||
import com.iformall.common.CommonMapper; | |||
import com.iformall.domain.po.UserLevelPackage; | |||
import java.util.List; | |||
public interface UserLevelPackageMapper extends CommonMapper<UserLevelPackage, Long>{ | |||
List<UserLevelPackage> findList(UserLevelPackage record); | |||
} |
@@ -0,0 +1,69 @@ | |||
<?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="com.iformall.mapper.LevelPackageMapper"> | |||
<resultMap id="BaseResultMap" type="com.iformall.domain.po.LevelPackage"> | |||
<id column="id" jdbcType="BIGINT" property="id" /> | |||
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | |||
<result column="level" jdbcType="INTEGER" property="level" /> | |||
<result column="name" jdbcType="VARCHAR" property="name" /> | |||
<result column="en_name" jdbcType="VARCHAR" property="enName"/> | |||
<result column="color" jdbcType="VARCHAR" property="color"/> | |||
<result column="price_dollar" jdbcType="INTEGER" property="priceDollar" /> | |||
<result column="price_rmb" jdbcType="INTEGER" property="priceRmb" /> | |||
<result column="credit" jdbcType="INTEGER" property="credit" /> | |||
<result column="validity_duration" jdbcType="INTEGER" property="validityDuration" /> | |||
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
</resultMap> | |||
<sql id="allColumns"> | |||
`id`,`tenant_id`,`parent_tenant_id`, | |||
`level`,`name`,`en_name`,`color`, | |||
`price_dollar`,`price_rmb`,`credit`,`validity_duration`, | |||
`create_date`,`update_date` | |||
</sql> | |||
<sql id="dynamicWhereConditions"> | |||
where is_del = 0 | |||
<if test=" null != id "> and `id` = #{id} </if> | |||
<if test=" null != tenantId and '' != tenantId"> | |||
and `tenant_id` = #{tenantId} | |||
</if> | |||
<if test=" null != parentTenantId and '' != parentTenantId"> | |||
and `parent_tenant_id` = #{parentTenantId} | |||
</if> | |||
<if test=" null != level "> and `level` = #{level} </if> | |||
<if test=" null != name and '' != name"> | |||
and `name` like concat('%', #{name},'%') | |||
</if> | |||
<if test=" null != enName and '' != enName"> | |||
and `en_name` like concat('%', #{enName},'%') | |||
</if> | |||
<if test=" null != startDate "> | |||
and `create_date` >= #{startDate} | |||
</if> | |||
<if test=" null != endDate"> | |||
and `create_date` <= #{endDate} | |||
</if> | |||
<if test=" null != ids "> | |||
and id in | |||
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
#{idItem} | |||
</foreach> | |||
</if> | |||
<if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
</sql> | |||
<select id="findList" parameterType="com.iformall.domain.po.LevelPackage" resultMap="BaseResultMap"> | |||
select <include refid="allColumns" /> | |||
from level_package | |||
<include refid="dynamicWhereConditions" /> | |||
</select> | |||
</mapper> |
@@ -0,0 +1,75 @@ | |||
<?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="com.iformall.mapper.ProjectPackageDetailMapper"> | |||
<resultMap id="BaseResultMap" type="com.iformall.domain.po.ProjectPackageDetail"> | |||
<id column="id" jdbcType="BIGINT" property="id" /> | |||
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | |||
<result column="project_type" jdbcType="INTEGER" property="projectType" /> | |||
<result column="package_id" jdbcType="BIGINT" property="packageId" /> | |||
<result column="invite_user_credit" jdbcType="INTEGER" property="inviteUserCredit" /> | |||
<result column="ai_photo_price" jdbcType="INTEGER" property="aiPhotoPrice" /> | |||
<result column="ai_script_price" jdbcType="INTEGER" property="aiScriptPrice" /> | |||
<result column="video_price" jdbcType="INTEGER" property="videoPrice" /> | |||
<result column="is_video_watermark" jdbcType="INTEGER" property="isVideoWatermark" /> | |||
<result column="language" jdbcType="INTEGER" property="language" /> | |||
<result column="sound" jdbcType="INTEGER" property="sound" /> | |||
<result column="video_time" jdbcType="INTEGER" property="videoTime" /> | |||
<result column="ai_photo" jdbcType="INTEGER" property="aiPhoto" /> | |||
<result column="is_sing" jdbcType="INTEGER" property="isSing" /> | |||
<result column="ai_script" jdbcType="INTEGER" property="aiScript" /> | |||
<result column="video_format" jdbcType="INTEGER" property="videoFormat" /> | |||
<result column="template" jdbcType="INTEGER" property="template" /> | |||
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
</resultMap> | |||
<sql id="allColumns"> | |||
`id`,`tenant_id`,`parent_tenant_id`,`project_type`,`package_id`, | |||
`invite_user_credit`,`ai_photo_price`,`ai_script_price`,`video_price`, | |||
`is_video_watermark`,`language`,`sound`, | |||
`video_time`,`ai_photo`,`is_sing`,`ai_script`,`video_format`,`template`, | |||
`create_date`,`update_date` | |||
</sql> | |||
<sql id="dynamicWhereConditions"> | |||
where is_del = 0 | |||
<if test=" null != id "> and `id` = #{id} </if> | |||
<if test=" null != tenantId and '' != tenantId"> | |||
and `tenant_id` = #{tenantId} | |||
</if> | |||
<if test=" null != parentTenantId and '' != parentTenantId"> | |||
and `parent_tenant_id` = #{parentTenantId} | |||
</if> | |||
<if test=" null != projectType "> and `project_type` = #{projectType} </if> | |||
<if test=" null != packageId"> | |||
and `package_id` = #{packageId} | |||
</if> | |||
<if test=" null != startDate "> | |||
and `create_date` >= #{startDate} | |||
</if> | |||
<if test=" null != endDate"> | |||
and `create_date` <= #{endDate} | |||
</if> | |||
<if test=" null != ids "> | |||
and id in | |||
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
#{idItem} | |||
</foreach> | |||
</if> | |||
<if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
</sql> | |||
<select id="findList" parameterType="com.iformall.domain.po.ProjectPackageDetail" resultMap="BaseResultMap"> | |||
select <include refid="allColumns" /> | |||
from project_package_detail | |||
<include refid="dynamicWhereConditions" /> | |||
</select> | |||
</mapper> |
@@ -0,0 +1,71 @@ | |||
<?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="com.iformall.mapper.UserLevelPackageMapper"> | |||
<resultMap id="BaseResultMap" type="com.iformall.domain.po.UserLevelPackage"> | |||
<id column="id" jdbcType="BIGINT" property="id" /> | |||
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | |||
<result column="package_id" jdbcType="BIGINT" property="packageId" /> | |||
<result column="package_level" jdbcType="INTEGER" property="packageLevel" /> | |||
<result column="package_color" jdbcType="VARCHAR" property="packageColor" /> | |||
<result column="user_credits" jdbcType="INTEGER" property="userCredits" /> | |||
<result column="residue_credits" jdbcType="INTEGER" property="residueCredits" /> | |||
<result column="expires_date" jdbcType="TIMESTAMP" property="expiresDate"/> | |||
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
</resultMap> | |||
<sql id="allColumns"> | |||
`id`,`tenant_id`,`parent_tenant_id`, | |||
`package_id`,`package_level`,`package_color`, | |||
`user_credits`,`residue_credits`, | |||
`expires_date`, `create_date`, `update_date` | |||
</sql> | |||
<sql id="dynamicWhereConditions"> | |||
where 1 = 1 | |||
<if test=" null != id "> and `id` = #{id} </if> | |||
<if test=" null != tenantId and '' != tenantId"> | |||
and `tenant_id` = #{tenantId} | |||
</if> | |||
<if test=" null != parentTenantId and '' != parentTenantId"> | |||
and `parent_tenant_id` = #{parentTenantId} | |||
</if> | |||
<if test=" null != packageId "> and `package_id` = #{packageId} </if> | |||
<if test=" null != packageLevel "> and `package_level` = #{packageLevel} </if> | |||
<if test=" null != ids "> | |||
and id in | |||
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
#{idItem} | |||
</foreach> | |||
</if> | |||
<if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
</sql> | |||
<select id="findList" parameterType="com.iformall.domain.po.UserLevelPackage" resultMap="BaseResultMap"> | |||
select <include refid="allColumns" /> | |||
from user_level_package | |||
<include refid="dynamicWhereConditions" /> | |||
</select> | |||
<update id="addUserCredits" parameterType="com.iformall.domain.po.UserLevelPackage"> | |||
update user_level_package | |||
set `update_date` = #{updateDate} | |||
<if test=" null != addSumCredits "> | |||
,`user_credits` = user_credits+#{addSumCredits} | |||
</if> | |||
,`residue_credits` = residue_credits+#{addCredits} | |||
where id = #{id} | |||
</update> | |||
<update id="reduceUserCredits" parameterType="com.iformall.domain.po.UserLevelPackage"> | |||
update user_level_package | |||
set `update_date` = #{updateDate} | |||
,`residue_credits` = residue_credits+#{reduceCredits} | |||
where id = #{id} | |||
and residue_credits+#{reduceCredits} >= 0 | |||
</update> | |||
</mapper> |