@@ -131,10 +131,10 @@ public class VideoController extends BaseController { | |||
@AuthIgnore | |||
@PostMapping("/avatarList") | |||
@ApiOperation(value = "视频模板列表", notes = "{\"username\",\"string\",\"code\",\"string\"}") | |||
public WxCVideoTable avatarList(@RequestBody Map<String, String> params){ | |||
public ResultData avatarList(@RequestBody Map<String, String> params){ | |||
String username = params.get("username"); | |||
WxCVideoTable TemplateVideo = wxCVideoService.findByUserName(username); | |||
return TemplateVideo; | |||
return wxCVideoService.findByUserName(username); | |||
} | |||
} |
@@ -11,7 +11,7 @@ import lombok.ToString; | |||
import java.util.ArrayList; | |||
import java.util.Date; | |||
@TableName(value ="wx_c_avatar") | |||
@TableName(value ="wx_c_author") | |||
@Data | |||
@ToString(callSuper = true) | |||
@EqualsAndHashCode(callSuper = true) | |||
@@ -22,27 +22,25 @@ public class WxCVideoTable extends TenantEntityWithoutFinalTenantId { | |||
@TableField(exist = false) | |||
private String currentTime; | |||
@TableField(exist = false) | |||
private ArrayList<WxCVideoTable> authorList; | |||
private String expireTime; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人id",name="id") | |||
private int id; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人名称",name="name") | |||
private String name; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人封面图片链接",name="image") | |||
private String image; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人样例视频链接",name="demo") | |||
private String demo; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人模板预处理信息文件链接",name="preInfo") | |||
private String preInfo; | |||
//public class Author extends TenantEntityWithoutFinalTenantId{ | |||
@io.swagger.annotations.ApiModelProperty(value="数字人id",name="id") | |||
private int id; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人名称",name="name") | |||
private String name; | |||
@TableField(exist = false) | |||
@io.swagger.annotations.ApiModelProperty(value="权限过期时间",name="expire_time") | |||
private Date expireTime; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人封面图片链接",name="image") | |||
private String image; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人样例视频链接",name="demo") | |||
private String demo; | |||
@io.swagger.annotations.ApiModelProperty(value="数字人模板预处理信息文件链接",name="preInfo") | |||
private String preInfo; | |||
// } | |||
} |
@@ -5,8 +5,10 @@ import com.iformall.domain.po.WxCUserTags; | |||
import com.iformall.domain.po.WxCVideoTable; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
public interface WxCVideoMapper extends CommonMapper<WxCVideoTable, String> { | |||
WxCVideoTable findByUserName(@Param("username") String username); | |||
List<WxCVideoTable> findByUserName(@Param("username") String username); | |||
} |
@@ -1,9 +1,10 @@ | |||
package com.iformall.service; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.WxCVideoTable; | |||
public interface WxCVideoService { | |||
WxCVideoTable findByUserName(String username); | |||
ResultData findByUserName(String username); | |||
} |
@@ -1,6 +1,9 @@ | |||
package com.iformall.service.impl; | |||
import cn.afterturn.easypoi.handler.inter.IExcelExportServer; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.iformall.common.ResultData; | |||
import com.iformall.domain.po.WxCUserBasicInfo; | |||
import com.iformall.domain.po.WxCVideoTable; | |||
import com.iformall.domain.vo.WxCUserBasicInfoVo; | |||
@@ -13,9 +16,7 @@ import org.slf4j.LoggerFactory; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
@Service | |||
@@ -31,9 +32,31 @@ public class WxCVideoServiceImpl implements WxCVideoService,IExcelExportServer { | |||
@Autowired | |||
WxCVideoMapper wxCVideoMapper; | |||
@Override | |||
public WxCVideoTable findByUserName(String username) { | |||
WxCVideoTable TemplateVideo = wxCVideoMapper.findByUserName(username); | |||
return TemplateVideo; | |||
public ResultData findByUserName(String username) { | |||
List<WxCVideoTable> TemplateVideo = wxCVideoMapper.findByUserName(username); | |||
System.out.println("TemplateVideo = " + TemplateVideo); | |||
Map<String,Object> resultMap = new HashMap(); | |||
Map<String,Object> data = new HashMap(); | |||
data.put("username",username); | |||
data.put("current_time",new Date(System.currentTimeMillis())); | |||
//Map<String,Object> authorlist = new HashMap(); | |||
List authorlist = new ArrayList(); | |||
for (WxCVideoTable wxCVideoTable : TemplateVideo) { | |||
Map<String,Object> avatar = new HashMap(); | |||
avatar.put("avatar_id",wxCVideoTable.getId()); | |||
avatar.put("avatar_name",wxCVideoTable.getName()); | |||
avatar.put("avatar_image",wxCVideoTable.getImage()); | |||
avatar.put("avatar_demo",wxCVideoTable.getDemo()); | |||
avatar.put("avatar_preinfo",wxCVideoTable.getPreInfo()); | |||
avatar.put("expire_time",wxCVideoTable.getExpireTime()); | |||
authorlist.add(avatar); | |||
resultMap.put("authorlist",authorlist); | |||
} | |||
resultMap.put("data",data); | |||
return new ResultData(resultMap); | |||
} | |||
@Override | |||
@@ -7,21 +7,21 @@ | |||
<result column="user_name" jdbcType="VARCHAR" property="userName"/> | |||
<result column="name" jdbcType="VARCHAR" property="name"/> | |||
<result column="image" jdbcType="VARCHAR" property="image"/> | |||
<result column="demo" jdbcType="INTEGER" property="demo"/> | |||
<result column="demo" jdbcType="VARCHAR" property="demo"/> | |||
<result column="preinfo" jdbcType="VARCHAR" property="preInfo"/> | |||
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/> | |||
</resultMap> | |||
<select id="findByUserName" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
SELECT | |||
wca.user_name,expire_time,wcav.id,wcav.name,wcav.image,wcav.model,wcav.preinfo | |||
from wx_c_author wca | |||
left join | |||
wx_c_avatar wcav | |||
on wcav.id =wca.resource_id where | |||
wca.resource_id in | |||
(select wca.resource_id from wx_c_author wca | |||
WHERE wca.user_name = #{username} AND wca.type = 0 ) | |||
</select> | |||
<!--<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCVideoTable"> | |||
<result column="user_name" jdbcType="VARCHAR" property="username"/> | |||
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/> | |||
</resultMap>--> | |||
<select id="findByUserName" resultMap="BaseResultMap"> | |||
SELECT wca.user_name,expire_time,wcav.id,wcav.name,wcav.image,wcav.model,wcav.preinfo,wcav.demo from wx_c_author wca left join wx_c_avatar wcav on wcav.id =wca.resource_id where wca.resource_id in (select wca.resource_id from wx_c_author wca WHERE wca.user_name = '13930071765' AND wca.type = 0 ) | |||
</select> | |||
</mapper> | |||
</mapper> |