Commit 1babf734 by 涂亚平

年前上线版本

1 parent 8515b4a4
Showing with 318 additions and 144 deletions
......@@ -23,7 +23,7 @@ public class RedisPrefixConstant {
public static final String SUBSIDY_TELEPHONE_PREFIX = "subsidySmsCode:";
/**
* subsidySettings_companyId:ClassHourDictDO 公司操作设置
* subsidySettings:companyId:ClassHourDictDO 公司操作设置
*/
public static final String SUBSIDY_SETTINGS_PREFIX = "subsidySettings:";
......
......@@ -139,7 +139,6 @@ public class AdministerController {
@PostMapping("getMemberPapers")
@ApiOperation("获取某个成员某个卷子的做题历史 memberId paperId")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getMemberPapers(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){
return ResponseData.generateCreatedResponse(0,administerService.getMemberPapers(exerciseDoneResultDO));
}
......
......@@ -40,8 +40,8 @@ public class ClassHourDictController {
}
@PostMapping("updateSetting")
@ApiOperation("修改当天设置时长 id 主键 classHour status interrupt interruptStatus repeatTime repeatStatus")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
@ApiOperation("修改当天设置时长 companyId 主键 classHour status interrupt interruptStatus repeatTime repeatStatus")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateSetting(@RequestBody ClassHourDictDO classHourDictDO){
return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(classHourDictDO));
}
......
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.field.QueryFieldsDTO;
import com.subsidy.model.FieldDictDO;
import com.subsidy.service.FieldDictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -16,7 +25,34 @@ import io.swagger.annotations.Api;
*/
@RestController
@Api(tags = "行业字典表")
@RequestMapping("/field-dict-do")
@RequestMapping("/fieldDict")
public class FieldDictController {
@Autowired
private FieldDictService fieldDictService;
@PostMapping("addField")
@ApiOperation("添加行业 fieldName 行业名称")
public ResponseVO addField(@RequestBody FieldDictDO fieldDictDO){
return ResponseData.generateCreatedResponse(0,fieldDictService.addField(fieldDictDO));
}
@PostMapping("updateField")
@ApiOperation("修改行业 id fieldName 行业名称")
public ResponseVO updateField(@RequestBody FieldDictDO fieldDictDO){
return ResponseData.generateCreatedResponse(0,fieldDictService.updateField(fieldDictDO));
}
@PostMapping("deleteField")
@ApiOperation("删除行业 id")
public ResponseVO deleteField(@RequestBody FieldDictDO fieldDictDO){
return ResponseData.generateCreatedResponse(0,fieldDictService.deleteField(fieldDictDO));
}
@PostMapping("queryFields")
@ApiOperation("查询行业 pageSize pageNum fieldName")
public ResponseVO queryFields(@RequestBody QueryFieldsDTO queryFieldsDTO){
return ResponseData.generateCreatedResponse(0,fieldDictService.queryFields(queryFieldsDTO));
}
}
......@@ -47,7 +47,7 @@ public class SignInRecordController {
@PostMapping("classStudyHistory")
@ApiOperation("校区学习记录 id 校区id className courseName pageSize pageNum")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO classSignInfo(@RequestBody ClassSignInfoDTO classSignInfoDTO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.classSignInfo(classSignInfoDTO));
}
......
package com.subsidy.dto.field;
import lombok.Data;
@Data
public class QueryFieldsDTO {
private Integer pageSize;
private Integer pageNum;
private String fieldName;
}
......@@ -46,7 +46,7 @@ public interface ExerciseDoneResultMapper extends BaseMapper<ExerciseDoneResultD
/**
* 查看某个人某个卷子完成的最好成绩
*/
ExerciseDoneResultDO getMaxScorePaper(Long paperId,Long memberId);
List<ExerciseDoneResultDO> getMaxScorePaper(Long paperId,Long memberId);
/**
* 测试成绩 最高成绩 测试测试 总评价
......
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.field.QueryFieldsDTO;
import com.subsidy.model.FieldDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
......@@ -12,7 +14,9 @@ import org.springframework.stereotype.Repository;
* @author DengMin
* @since 2022-01-20
*/
@Repository
@Repository
public interface FieldDictMapper extends BaseMapper<FieldDictDO> {
IPage<FieldDictDO> queryFields(IPage ipage, String fieldName);
}
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.field.QueryFieldsDTO;
import com.subsidy.model.FieldDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tencentcloudapi.vpc.v20170312.models.Ip6Rule;
/**
* <p>
......@@ -13,4 +16,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface FieldDictService extends IService<FieldDictDO> {
String addField(FieldDictDO fieldDictDO);
String updateField(FieldDictDO fieldDictDO);
String deleteField(FieldDictDO fieldDictDO);
IPage queryFields(QueryFieldsDTO queryFieldsDTO);
}
......@@ -11,6 +11,7 @@ import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.ClassHourDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.MyBeanUtils;
import com.subsidy.util.RedisUtil;
import com.subsidy.vo.hour.PollingGetVO;
import org.springframework.beans.BeanUtils;
......@@ -21,6 +22,7 @@ import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
......@@ -46,15 +48,16 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
private RedisUtil redisUtil;
public ClassHourDictDO getSetting(ClassHourDictDO classHourDictDO) {
return (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId());
return (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId());
}
@Async
public String updateSetting(ClassHourDictDO classHourDictDO) {
ClassHourDictDO classHourDictDO1 = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId());
BeanUtils.copyProperties(classHourDictDO, classHourDictDO1);
redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId(), classHourDictDO1);
classHourDictDO.setId(classHourDictDO1.getId());
String[] nullParams = MyBeanUtils.getNullPropertyNames(classHourDictDO);
BeanUtils.copyProperties(classHourDictDO, classHourDictDO1,nullParams);
redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId(), classHourDictDO1);
return ConstantUtils.SET_SUCCESS;
}
......
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.field.QueryFieldsDTO;
import com.subsidy.model.FieldDictDO;
import com.subsidy.mapper.FieldDictMapper;
import com.subsidy.model.FileDictDO;
import com.subsidy.service.FieldDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import org.springframework.stereotype.Service;
/**
......@@ -17,4 +24,42 @@ import org.springframework.stereotype.Service;
@Service
public class FieldDictServiceImpl extends ServiceImpl<FieldDictMapper, FieldDictDO> implements FieldDictService {
public String addField(FieldDictDO fieldDictDO) {
Integer count = this.baseMapper.selectCount(new QueryWrapper<FieldDictDO>()
.lambda()
.eq(FieldDictDO::getFieldName, fieldDictDO.getFieldName()));
if (count > 0) {
throw new HttpException(11001);
}
this.baseMapper.insert(fieldDictDO);
return ConstantUtils.ADD_SUCCESS;
}
public String updateField(FieldDictDO fieldDictDO) {
Integer count = this.baseMapper.selectCount(new QueryWrapper<FieldDictDO>()
.lambda()
.eq(FieldDictDO::getFieldName, fieldDictDO.getFieldName())
.ne(FieldDictDO::getId, fieldDictDO.getId()));
if (count > 0) {
throw new HttpException(11001);
}
this.baseMapper.updateById(fieldDictDO);
return ConstantUtils.SET_SUCCESS;
}
public String deleteField(FieldDictDO fieldDictDO){
this.baseMapper.deleteById(fieldDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public IPage queryFields(QueryFieldsDTO queryFieldsDTO){
Page pager = new Page(queryFieldsDTO.getPageNum(), queryFieldsDTO.getPageSize());
return this.baseMapper.queryFields(pager,queryFieldsDTO.getFieldName());
}
}
......@@ -50,6 +50,7 @@ import com.subsidy.vo.member.GetAllVO;
import com.subsidy.vo.member.GetStudyInfoVO;
import com.subsidy.vo.member.MemberStudyPageVO;
import com.subsidy.vo.member.MemberVO;
import com.subsidy.vo.member.MemberVodVO;
import com.subsidy.vo.member.MyCoursesVO;
import com.subsidy.vo.member.StudyPageVO;
import com.subsidy.vo.paper.QueryPapersVO;
......@@ -231,7 +232,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
public UserRoleVO login(VerifyCodeDTO verifyCodeDTO) {
UserRoleVO userRoleVO = new UserRoleVO();
//TODO 先从redis里拿 ???
//先从redis里拿 还得从数据库先查公司。。还是直接查人快
MemberDO memberDO = this.baseMapper.selectOne(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getTelephone, verifyCodeDTO.getTelephone()));
......@@ -316,6 +317,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
if (memberDO.getPassword().equals(passwordLoginDTO.getPassword()) && 1 == memberDO.getFirstLogin() && !"冻结".equals(memberDO.getStatus())) {
MemberVO memberVO = new MemberVO();
BeanUtils.copyProperties(memberDO, memberVO);
memberVO.setCompanyName(companyDictDO.getCompanyName());
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
......@@ -432,7 +434,19 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
for (CourseContentDO courseContentDO : courseContentDOS) {
ContentVodVO contentVodVO = new ContentVodVO();
contentVodVO.setContent(courseContentDO.getContent());
contentVodVO.setMemberVodVOS(courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId()));
List<MemberVodVO> memberVodVOS = courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId());
int playCount = 0;
for (MemberVodVO memberVodVO : memberVodVOS){
if (100 == memberVodVO.getPercent()){
playCount++;
}
}
contentVodVO.setPlayVods(playCount);
contentVodVO.setMemberVodVOS(memberVodVOS);
contentVodVO.setTotalVods(memberVodVOS.size());
contentVodVOS.add(contentVodVO);
}
contentVodNewVO.setContentVodVOS(contentVodVOS);
......@@ -479,32 +493,26 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//查看该班级下的测试卷子(有效卷子)
ClassDictDO classDictDO = classDictMapper.selectById(contentMemberDTO.getClassId());
List<QueryPapersVO> queryPapersVOS = paperDictMapper.queryPapers(contentMemberDTO.getCourseId(), null, 1);
ExecutorService executorService = Executors.newCachedThreadPool();
for (QueryPapersVO queryPapersVO : queryPapersVOS) {
executorService.execute(() -> getCourseTestTask(queryPapersVO, contentMemberDTO.getMemberId(), classDictDO));
//多少人已完成
Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId());
queryPapersVO.setCompleteCnt(cnt);
//自己成绩
List<ExerciseDoneResultDO> exerciseDoneResultDOS = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), contentMemberDTO.getMemberId());
if (exerciseDoneResultDOS.size()>0) {
queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts());
queryPapersVO.setTotalCount(exerciseDoneResultDOS.get(0).getTotalCounts());
queryPapersVO.setResult(exerciseDoneResultDOS.get(0).getResult());
} else {
queryPapersVO.setResult("待完成");
}
//截止时间
queryPapersVO.setEndDate(classDictDO.getEndDate());
}
executorService.shutdown();
return queryPapersVOS;
}
public void getCourseTestTask(QueryPapersVO queryPapersVO, Long memberId, ClassDictDO classDictDO) {
//多少人已完成
Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId());
queryPapersVO.setCompleteCnt(cnt);
//自己成绩
ExerciseDoneResultDO exerciseDoneResultDO = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), memberId);
if (null != exerciseDoneResultDO) {
queryPapersVO.setRightCounts(exerciseDoneResultDO.getRightCounts());
queryPapersVO.setTotalCount(exerciseDoneResultDO.getTotalCounts());
queryPapersVO.setResult(exerciseDoneResultDO.getResult());
} else {
queryPapersVO.setResult("待完成");
}
//截止时间
queryPapersVO.setEndDate(classDictDO.getEndDate());
}
public List<ExerciseDoneResultDO> getPaperDoneDetail(ExerciseDoneResultDO exerciseDoneResultDO) {
return exerciseDoneResultMapper.selectList(new QueryWrapper<ExerciseDoneResultDO>()
.lambda()
......
......@@ -20,6 +20,7 @@ import com.subsidy.service.SignInRecordService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.MathUtil;
import com.subsidy.util.MyBeanUtils;
import com.subsidy.util.RedisUtil;
import com.subsidy.vo.member.GetMemberSignInfoVO;
import com.subsidy.vo.sign.ClassSignInfoVO;
......@@ -87,24 +88,19 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
IPage<ClassSignInfoVO> classSignInfoVOIPage = this.baseMapper.classSignInfo(pager, classSignInfoDTO.getClassName(), classSignInfoDTO.getCourseName(), classSignInfoDTO.getCompanyId());
List<ClassSignInfoVO> classSignInfoVOS = classSignInfoVOIPage.getRecords();
final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
for (ClassSignInfoVO classSignInfoVO : classSignInfoVOS) {
newCachedThreadPool.execute(()->classSignInfoTask(classSignInfoVO));
ClassSignInfoVO classSignInfoVO1 = vodPlayHistoryMapper.classStudyHistory(classSignInfoVO.getClassId());
String[] nullParams = MyBeanUtils.getNullPropertyNames(classSignInfoVO1);
BeanUtils.copyProperties(classSignInfoVO1,classSignInfoVO,nullParams);
//平均签到数 向下取整
long signCount = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*:classId:" + classSignInfoVO.getClassId() + ":*").stream().count();
classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSignInfoVO1.getMemberCount()));
}
newCachedThreadPool.shutdown();
classSignInfoVOIPage.setRecords(classSignInfoVOS);
return classSignInfoVOIPage;
}
public void classSignInfoTask(ClassSignInfoVO classSignInfoVO){
ClassSignInfoVO classSignInfoVO1 = vodPlayHistoryMapper.classStudyHistory(classSignInfoVO.getClassId());
BeanUtils.copyProperties(classSignInfoVO1,classSignInfoVO);
//平均签到数 向下取整
long signCount = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*:classId:" + classSignInfoVO.getClassId() + ":*").stream().count();
classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSignInfoVO1.getMemberCount()));
}
public SignInStatusVO signInStatus(SignInRecordDO signInRecordDO) {
......@@ -117,7 +113,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
long size = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + signInRecordDO.getMemberId() + "*:" + DateFormatUtil.format(new Date(), "yyyyMMdd")+"*").stream().count();
if (size != count) {
signInStatusVO.setStatus(flag);
signInStatusVO.setStatus(false);
}
return signInStatusVO;
......@@ -134,7 +130,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//预写公司设置数据
List<ClassHourDictDO> classHourDictDOS = classHourDictMapper.selectList(null);
for (ClassHourDictDO classHourDictDO : classHourDictDOS) {
redisUtil.set("subsidySettings:" + classHourDictDO.getCompanyId(), classHourDictDO);
redisUtil.set("subsidySettings:"+ classHourDictDO.getCompanyId(), classHourDictDO);
}
//预写学生账号数据
......
......@@ -16,7 +16,7 @@ public abstract class BaseModel {
* 创建时间
*/
@JsonIgnore
// @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "create_date", fill = FieldFill.INSERT)
@TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "create_date", fill = FieldFill.INSERT)
private LocalDateTime createDate;
/**
......
package com.subsidy.util;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import java.beans.PropertyDescriptor;
import java.util.HashSet;
import java.util.Set;
public class MyBeanUtils {
public static String[] getNullPropertyNames (Object source) {
final BeanWrapper src = new BeanWrapperImpl(source);
PropertyDescriptor[] pds = src.getPropertyDescriptors();
Set<String> emptyNames = new HashSet<>();
for(PropertyDescriptor pd : pds) {
Object srcValue = src.getPropertyValue(pd.getName());
// 此处判断可根据需求修改
if (srcValue == null) {
emptyNames.add(pd.getName());
}
}
String[] result = new String[emptyNames.size()];
return emptyNames.toArray(result);
}
}
......@@ -562,9 +562,9 @@ public class RedisUtil {
// * @param pattern
// * @return
// */
//public Set keys(String pattern){
// return redisTemplate.keys(pattern);
//}
public Set keys(String pattern){
return redisTemplate.keys(pattern);
}
/**
* 模糊查询
......@@ -574,7 +574,7 @@ public class RedisUtil {
public Set scan(String pattern) {
return redisTemplate.execute((RedisCallback<Set<String>>) redisConnection -> {
Set keys = new HashSet<>();
Cursor<byte[]> cursor = redisConnection.scan(new ScanOptions.ScanOptionsBuilder().match(pattern).count(1000).build());
Cursor<byte[]> cursor = redisConnection.scan(new ScanOptions.ScanOptionsBuilder().match(pattern).count(Integer.MAX_VALUE).build());
while (cursor.hasNext()) {
keys.add(new String(cursor.next()));
}
......
......@@ -5,12 +5,18 @@ import lombok.Data;
@Data
public class GetMemberPapersVO {
private Long id;
private Long paperId;
private String score;
private Integer cnt;
private Integer result;
private Integer rightCounts;
private Integer totalCounts;
private String result;
}
......@@ -9,6 +9,10 @@ public class ContentVodVO {
private String content;
private Integer totalVods;
private Integer playVods;
private List<MemberVodVO> memberVodVOS;
}
......@@ -16,4 +16,6 @@ public class MemberVO {
private String image;
private Integer firstLogin;
private String companyName;
}
......@@ -12,6 +12,8 @@ public class MyCoursesVO {
private Long classId;
private String className;
private String courseName;
private String endDate;
......
......@@ -42,3 +42,4 @@ meishu.code-message[90001]=该类目已存在
meishu.code-message[10001]=导入失败
meishu.code-message[11001]=该行业已存在
\ No newline at end of file
......@@ -45,70 +45,70 @@
<select id="contentVodProcess" resultType="com.subsidy.vo.member.MemberVodVO">
SELECT
t3.id,
t3.vod_url,
t3.vod_name,
t3.vod_type,
t3.vod_length,
t3.play_record,
IF
( t3.vod_length - t3.sumPlay > 0, t3.vod_length - t3.sumPlay, 0 ) AS leftLength,
round( t3.sumPlay * 100 / t3.vod_length, 0 ) AS percent
FROM
(
SELECT
t.id,
t.vod_url,
t.vod_name,
t.vod_type,
t.vod_length,
t.order_no,
ifnull( t2.sumPlay, 0 ) AS sumPlay,
t4.play_record
FROM
vod_dict t
LEFT JOIN (
SELECT
t.vod_id,
t.member_id,
sum( t.play_length ) AS sumPlay
FROM
vod_play_history t
WHERE
t.member_id = #{memberId}
GROUP BY
t.vod_id,
t.member_id
) t2 ON t.id = t2.vod_id
LEFT JOIN (
SELECT
t.member_id,
t.vod_id,
t2.play_record
FROM
(
SELECT
t.member_id,
t.vod_id,
max( t.create_date ) AS create_date
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
GROUP BY
t.member_id,
t.vod_id
) t
LEFT JOIN vod_play_history t2 ON t.vod_id = t2.vod_id
AND t.member_id = t2.member_id
AND t.create_date = t2.create_date
) t4 ON t2.vod_id = t4.vod_id
WHERE
t.content_id = #{contentId}
) t3
ORDER BY
t3.order_no
t3.id,
t3.vod_url,
t3.vod_name,
t3.vod_type,
t3.vod_length,
t3.play_record,
IF
( t3.vod_length - t3.sumPlay > 0, t3.vod_length - t3.sumPlay, 0 ) AS leftLength,
if(round( t3.sumPlay * 100 / t3.vod_length, 0 ) &lt; 100,round( t3.sumPlay * 100 / t3.vod_length, 0 ),100) AS percent
FROM
(
SELECT
t.id,
t.vod_url,
t.vod_name,
t.vod_type,
t.vod_length,
t.order_no,
ifnull( t2.sumPlay, 0 ) AS sumPlay,
t4.play_record
FROM
vod_dict t
LEFT JOIN (
SELECT
t.vod_id,
t.member_id,
sum( t.play_length ) AS sumPlay
FROM
vod_play_history t
WHERE
t.member_id = #{memberId}
GROUP BY
t.vod_id,
t.member_id
) t2 ON t.id = t2.vod_id
LEFT JOIN (
SELECT
t.member_id,
t.vod_id,
t2.play_record
FROM
(
SELECT
t.member_id,
t.vod_id,
max( t.create_date ) AS create_date
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
GROUP BY
t.member_id,
t.vod_id
) t
LEFT JOIN vod_play_history t2 ON t.vod_id = t2.vod_id
AND t.member_id = t2.member_id
AND t.create_date = t2.create_date
) t4 ON t2.vod_id = t4.vod_id
WHERE
t.content_id = #{contentId}
) t3
ORDER BY
t3.order_no
</select>
<select id="contentFiles" parameterType="long" resultType="com.subsidy.model.FileDictDO">
......
......@@ -95,16 +95,25 @@
<select id="getMaxScorePaper" resultType="com.subsidy.model.ExerciseDoneResultDO">
SELECT
max( t.score ),
t.right_counts,
t.total_counts,
t.result
t2.right_counts,
t2.total_counts,
t2.result,
t2.score
FROM
exercise_done_result t
(
SELECT
max( t.score ) AS score
FROM
exercise_done_result t
WHERE
t.delete_date IS NULL
AND t.paper_id = #{paperId}
AND t.member_id = #{memberId}
) t1
LEFT JOIN exercise_done_result t2 ON t1.score = t2.score
WHERE
t.delete_date IS NULL
AND t.paper_id = #{paperId}
AND t.member_id = #{memberId}
t2.paper_id = #{paperId}
AND t2.member_id = #{memberId}
</select>
<select id="testScoreInfo" resultType="com.subsidy.vo.done.TestScoreInfoVO">
......
......@@ -19,4 +19,15 @@
id, field_name
</sql>
<select id="queryFields" resultType="com.subsidy.model.FieldDictDO">
SELECT
t.id,
t.field_name
FROM
field_dict t
WHERE
t.delete_date IS NULL
AND t.field_name LIKE concat('%',#{fieldName} ,'%')
</select>
</mapper>
......@@ -64,6 +64,7 @@
SELECT
t3.id AS courseId,
t2.id AS classId,
t2.class_name,
t3.course_name,
t2.end_date,
t4.cnt AS totalCnt,
......
......@@ -47,8 +47,7 @@
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.member_id = #{member_id}
AND t.member_id = #{memberId}
GROUP BY
t.vod_id,
t.member_id
......@@ -231,21 +230,14 @@
<select id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO">
SELECT
t2.id,
ifnull(t1.play_record,0) as play_record
t2.play_record,
t2.vod_id
FROM
(
SELECT
t.vod_id,
max( t.create_date ) AS create_date,
t.play_record
FROM
vod_play_history t
WHERE
t.member_id = #{memberId}
AND t.class_id = #{classId}
) t1
LEFT JOIN vod_dict t2 ON t1.vod_id = t2.id
( SELECT max( t.create_date ) AS create_date FROM vod_play_history t WHERE t.delete_date is null and t.member_id = #{memberId} AND t.class_id = #{classId} ) t
LEFT JOIN vod_play_history t2 ON t.create_date = t2.create_date
WHERE
t2.member_id = #{memberId}
AND t2.class_id = #{classId}
</select>
......@@ -303,7 +295,7 @@
<select id="memberVodTotalLength" resultType="integer">
SELECT
sum( t.play_length )
ifnull(sum( t.play_length ),0)
FROM
vod_play_history t
WHERE
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!