@@ -6,8 +6,6 @@ apimenu,apiguide,apidetail,thirdpartyapi | |||||
ALTER TABLE `voice_language` | ALTER TABLE `voice_language` | ||||
ADD COLUMN customized int(1) NOT NULL DEFAULT 0 COMMENT '是否私人定制EnumYesOrNo' AFTER `is_del`; | ADD COLUMN customized int(1) NOT NULL DEFAULT 0 COMMENT '是否私人定制EnumYesOrNo' AFTER `is_del`; | ||||
ALTER TABLE `voice_language` | |||||
ADD COLUMN customized_user_id BIGINT(11) COMMENT '私人定制所属用户' AFTER `customized`; | |||||
ALTER TABLE `user_mould_video` | ALTER TABLE `user_mould_video` | ||||
@@ -46,4 +44,24 @@ ADD COLUMN video_url varchar(300) COMMENT '视频链接'; | |||||
#wx_c_author 新增了user_name | #wx_c_author 新增了user_name | ||||
CREATE TABLE `user_person_mould` ( | |||||
`id` bigint NOT NULL COMMENT '主键ID', | |||||
`person_mould_id` bigint NOT NULL COMMENT 'PersonMould编号', | |||||
`c_user_id` bigint NOT NULL COMMENT 'WxCuserBasicInfo编码', | |||||
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |||||
`update_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间' | |||||
PRIMARY KEY (`id`) USING BTREE, | |||||
UNIQUE KEY `id_UNIQUE` (`id`) USING BTREE | |||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户定制关联模板'; | |||||
CREATE TABLE `user_voice_language` ( | |||||
`id` bigint NOT NULL COMMENT '主键ID', | |||||
`voice_language_id` bigint NOT NULL COMMENT 'VocieLanguage编码', | |||||
`c_user_id` bigint NOT NULL COMMENT 'WxCuserBasicInfo编码', | |||||
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |||||
`update_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', | |||||
PRIMARY KEY (`id`) USING BTREE, | |||||
UNIQUE KEY `id_UNIQUE` (`id`) USING BTREE | |||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户定制关联声纹'; | |||||
@@ -155,7 +155,7 @@ public class VoiceMouldController extends BaseController { | |||||
public ResultData loginVoiceTotal() { | public ResultData loginVoiceTotal() { | ||||
VoiceLanguage vl = new VoiceLanguage(); | VoiceLanguage vl = new VoiceLanguage(); | ||||
vl.setCustomizedQuery(EnumYesOrNo.YES.getCode()); | vl.setCustomizedQuery(EnumYesOrNo.YES.getCode()); | ||||
vl.setCustomizedUserId(getMemberId()); | |||||
vl.setCUserId(getMemberId()); | |||||
return new ResultData(voiceLanguageService.voiceTotal(vl)); | return new ResultData(voiceLanguageService.voiceTotal(vl)); | ||||
} | } | ||||
@@ -0,0 +1,32 @@ | |||||
package com.iformall.domain.po.sm; | |||||
import com.baomidou.mybatisplus.annotation.TableField; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.iformall.domain.po.base.BaseEntity; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.ToString; | |||||
import java.util.Date; | |||||
import java.util.List; | |||||
@TableName(value = "user_voice_language") | |||||
@Data | |||||
@ToString(callSuper = true) | |||||
@EqualsAndHashCode(callSuper = true) | |||||
public class UserVoiceLanguage extends BaseEntity { | |||||
private static final long serialVersionUID = 5153174991543978589L; | |||||
protected Long id; | |||||
@io.swagger.annotations.ApiModelProperty(value="VocieLanguage编码",name="voiceLanguageId") | |||||
private Long voiceLanguageId; | |||||
@io.swagger.annotations.ApiModelProperty(value="WxCuserBasicInfo编码",name="cUserId") | |||||
private Long cUserId; | |||||
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
private Date createDate; | |||||
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
private Date updateDate; | |||||
@TableField(exist = false) | |||||
private List<Long> cuserIds; | |||||
} |
@@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode; | |||||
import lombok.ToString; | import lombok.ToString; | ||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.List; | |||||
import java.util.Objects; | import java.util.Objects; | ||||
/** | /** | ||||
@@ -65,7 +66,10 @@ public class VoiceLanguage extends TenantEntity { | |||||
private Integer customizedQuery = 0; | private Integer customizedQuery = 0; | ||||
@io.swagger.annotations.ApiModelProperty(value="是否私人定制EnumYesOrNo",name="customized") | @io.swagger.annotations.ApiModelProperty(value="是否私人定制EnumYesOrNo",name="customized") | ||||
private Integer customized; | private Integer customized; | ||||
@io.swagger.annotations.ApiModelProperty(value="私人定制所属用户",name="customizedUserId") | |||||
private Long customizedUserId; | |||||
@TableField(exist = false) | |||||
private List<Long> customizedVocideIds; | |||||
@TableField(exist = false) | |||||
private Long cUserId; | |||||
} | } |
@@ -0,0 +1,17 @@ | |||||
package com.iformall.mapper; | |||||
import com.iformall.common.CommonMapper; | |||||
import com.iformall.domain.po.sm.UserVoiceLanguage; | |||||
import org.apache.ibatis.annotations.Param; | |||||
import java.util.List; | |||||
public interface UserVoiceLanguageMapper extends CommonMapper<UserVoiceLanguage, Long> { | |||||
List<Long> findVoiceIdList(UserVoiceLanguage record); | |||||
void deleteByCuserId(@Param("cUserId") Long cUserId); | |||||
void saveBatch(@Param("list") List<UserVoiceLanguage> list); | |||||
} |
@@ -4,8 +4,10 @@ package com.iformall.service.sm.impl; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.iformall.constant.LanguageEnums; | import com.iformall.constant.LanguageEnums; | ||||
import com.iformall.domain.po.sm.UserVoiceLanguage; | |||||
import com.iformall.domain.po.sm.VoiceLanguage; | import com.iformall.domain.po.sm.VoiceLanguage; | ||||
import com.iformall.language.LanguageDetect; | import com.iformall.language.LanguageDetect; | ||||
import com.iformall.mapper.UserVoiceLanguageMapper; | |||||
import com.iformall.mapper.VoiceLanguageMapper; | import com.iformall.mapper.VoiceLanguageMapper; | ||||
import com.iformall.service.sm.VoiceLanguageService; | import com.iformall.service.sm.VoiceLanguageService; | ||||
import com.iformall.util.DetectUtils; | import com.iformall.util.DetectUtils; | ||||
@@ -24,11 +26,27 @@ public class VoiceLanguageServiceImpl implements VoiceLanguageService { | |||||
@Autowired | @Autowired | ||||
private VoiceLanguageMapper voiceLanguageMapper; | private VoiceLanguageMapper voiceLanguageMapper; | ||||
@Autowired | |||||
private UserVoiceLanguageMapper userVoiceLanguageMapper; | |||||
@Override | @Override | ||||
public List<VoiceLanguage> voiceTotal(VoiceLanguage voiceLanguage) { | public List<VoiceLanguage> voiceTotal(VoiceLanguage voiceLanguage) { | ||||
voiceLanguage.setIsDel(0); | voiceLanguage.setIsDel(0); | ||||
voiceLanguage.setSortColumns("local asc"); | voiceLanguage.setSortColumns("local asc"); | ||||
if (null != voiceLanguage.getCUserId()) { | |||||
UserVoiceLanguage uvl = new UserVoiceLanguage(); | |||||
uvl.setCUserId(voiceLanguage.getCUserId()); | |||||
List<Long> vids = userVoiceLanguageMapper.findVoiceIdList(uvl); | |||||
if (null == vids || vids.size() <= 0) { | |||||
List<Long> vvids = new ArrayList<Long>(); | |||||
vvids.add(-1L); | |||||
voiceLanguage.setCustomizedVocideIds(vvids); | |||||
}else { | |||||
voiceLanguage.setCustomizedVocideIds(vids); | |||||
} | |||||
} | |||||
List<VoiceLanguage> languages = voiceLanguageMapper.findList(voiceLanguage); | List<VoiceLanguage> languages = voiceLanguageMapper.findList(voiceLanguage); | ||||
return CollectionUtils.isEmpty(languages) ? Lists.newArrayList() : languages; | return CollectionUtils.isEmpty(languages) ? Lists.newArrayList() : languages; | ||||
} | } | ||||
@@ -0,0 +1,56 @@ | |||||
<?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.UserVoiceLanguageMapper"> | |||||
<resultMap id="BaseResultMap" type="com.iformall.domain.po.sm.UserVoiceLanguage"> | |||||
<id column="id" jdbcType="BIGINT" property="id"/> | |||||
<result column="voice_language_id" jdbcType="BIGINT" property="voiceLanguageId"/> | |||||
<result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | |||||
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
</resultMap> | |||||
<sql id="allColumns"> | |||||
`id`, `voice_language_id`, `c_user_id`, `create_date`, `update_date` | |||||
</sql> | |||||
<sql id="dynamicWhereConditions"> | |||||
where 1 = 1 | |||||
<if test=" null != id "> | |||||
and `id` = #{id} | |||||
</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 customized desc,${sortColumns}</if> | |||||
</sql> | |||||
<select id="findVoiceIdList" parameterType="com.iformall.domain.po.sm.UserVoiceLanguage" resultType="Long"> | |||||
select voice_language_id | |||||
from user_voice_language where c_user_id = #{cUserId} | |||||
</select> | |||||
<delete id = "deleteByCuserId"> | |||||
delete from user_voice_language where c_user_id = #{cUserId} | |||||
</delete> | |||||
<insert id="saveBatch" parameterType="java.util.List"> | |||||
INSERT INTO user_voice_language (`id`, `voice_language_id`, `c_user_id`,`create_date`, `update_date`) | |||||
VALUES | |||||
<foreach collection="list" item="item" separator=","> | |||||
( | |||||
#{item.id}, | |||||
#{item.voiceLanguageId}, | |||||
#{item.cUserId}, | |||||
#{item.createDate}, | |||||
#{item.updateDate} | |||||
) | |||||
</foreach> | |||||
</insert> | |||||
</mapper> |
@@ -15,13 +15,12 @@ | |||||
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | ||||
<result column="is_del" jdbcType="INTEGER" property="isDel"/> | <result column="is_del" jdbcType="INTEGER" property="isDel"/> | ||||
<result column="customized" jdbcType="INTEGER" property="customized"/> | <result column="customized" jdbcType="INTEGER" property="customized"/> | ||||
<result column="customized_user_id" jdbcType="INTEGER" property="customizedUserId"/> | |||||
</resultMap> | </resultMap> | ||||
<sql id="allColumns"> | <sql id="allColumns"> | ||||
`id`, `tenant_id`, `parent_tenant_id`, `language`, `country`, `local`, `name`, `chinese_name`, `img`, `create_date`, | `id`, `tenant_id`, `parent_tenant_id`, `language`, `country`, `local`, `name`, `chinese_name`, `img`, `create_date`, | ||||
`update_date`, `is_del`,`customized`,`customized_user_id` | |||||
`update_date`, `is_del`,`customized` | |||||
</sql> | </sql> | ||||
<sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
@@ -39,9 +38,16 @@ | |||||
<if test=" null != isDel "> | <if test=" null != isDel "> | ||||
and `is_del` = #{isDel} | and `is_del` = #{isDel} | ||||
</if> | </if> | ||||
<if test=" 1 == customizedQuery"> | <if test=" 1 == customizedQuery"> | ||||
and ( customized = 0 or (customized = 1 and customized_user_id = #{customizedUserId}) ) | |||||
and ( customized = 0 or (customized = 1 | |||||
and id in | |||||
<foreach collection="customizedVocideIds" index="index" item="cIdItem" open="(" separator="," close=")"> | |||||
#{cIdItem} | |||||
</foreach> | |||||
)) | |||||
</if> | </if> | ||||
<if test=" 0 == customizedQuery"> | <if test=" 0 == customizedQuery"> | ||||
and customized = 0 | and customized = 0 | ||||
</if> | </if> | ||||