Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
46
pom.xml
46
pom.xml
@@ -23,7 +23,7 @@
|
|||||||
<mssql.version>4.0</mssql.version>
|
<mssql.version>4.0</mssql.version>
|
||||||
<oracle.version>11.2.0.3</oracle.version>
|
<oracle.version>11.2.0.3</oracle.version>
|
||||||
<druid.version>1.1.13</druid.version>
|
<druid.version>1.1.13</druid.version>
|
||||||
<quartz.version>2.3.0</quartz.version>
|
<!-- <quartz.version>2.3.0</quartz.version>-->
|
||||||
<commons.lang.version>2.6</commons.lang.version>
|
<commons.lang.version>2.6</commons.lang.version>
|
||||||
<commons.fileupload.version>1.2.2</commons.fileupload.version>
|
<commons.fileupload.version>1.2.2</commons.fileupload.version>
|
||||||
<commons.io.version>2.5</commons.io.version>
|
<commons.io.version>2.5</commons.io.version>
|
||||||
@@ -85,17 +85,17 @@
|
|||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>19.0</version>
|
<version>19.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.amazonaws</groupId>
|
<!-- <groupId>com.amazonaws</groupId>-->
|
||||||
<artifactId>aws-java-sdk</artifactId>
|
<!-- <artifactId>aws-java-sdk</artifactId>-->
|
||||||
<version>1.11.274</version>
|
<!-- <version>1.11.274</version>-->
|
||||||
<exclusions>
|
<!-- <exclusions>-->
|
||||||
<exclusion>
|
<!-- <exclusion>-->
|
||||||
<artifactId>aws-java-sdk-simpleworkflow</artifactId>
|
<!-- <artifactId>aws-java-sdk-simpleworkflow</artifactId>-->
|
||||||
<groupId>com.amazonaws</groupId>
|
<!-- <groupId>com.amazonaws</groupId>-->
|
||||||
</exclusion>
|
<!-- </exclusion>-->
|
||||||
</exclusions>
|
<!-- </exclusions>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.afterturn</groupId>
|
<groupId>cn.afterturn</groupId>
|
||||||
<artifactId>easypoi-spring-boot-starter</artifactId>
|
<artifactId>easypoi-spring-boot-starter</artifactId>
|
||||||
@@ -325,17 +325,17 @@
|
|||||||
<artifactId>druid-spring-boot-starter</artifactId>
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
<version>${druid.version}</version>
|
<version>${druid.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>org.quartz-scheduler</groupId>
|
<!-- <groupId>org.quartz-scheduler</groupId>-->
|
||||||
<artifactId>quartz</artifactId>
|
<!-- <artifactId>quartz</artifactId>-->
|
||||||
<version>${quartz.version}</version>
|
<!-- <version>${quartz.version}</version>-->
|
||||||
<exclusions>
|
<!-- <exclusions>-->
|
||||||
<exclusion>
|
<!-- <exclusion>-->
|
||||||
<groupId>com.mchange</groupId>
|
<!-- <groupId>com.mchange</groupId>-->
|
||||||
<artifactId>c3p0</artifactId>
|
<!-- <artifactId>c3p0</artifactId>-->
|
||||||
</exclusion>
|
<!-- </exclusion>-->
|
||||||
</exclusions>
|
<!-- </exclusions>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-lang</groupId>
|
<groupId>commons-lang</groupId>
|
||||||
<artifactId>commons-lang</artifactId>
|
<artifactId>commons-lang</artifactId>
|
||||||
|
|||||||
@@ -153,24 +153,6 @@ public class ShardingConfig {
|
|||||||
for (String regionTable : regionTables) {
|
for (String regionTable : regionTables) {
|
||||||
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(regionTable, String.format(regionTablesDataNode, regionTable));
|
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(regionTable, String.format(regionTablesDataNode, regionTable));
|
||||||
tableRuleConfig.setDatabaseShardingStrategyConfig(databaseShardingStrategyConfig);
|
tableRuleConfig.setDatabaseShardingStrategyConfig(databaseShardingStrategyConfig);
|
||||||
// // 设置区域表使用雪花算法生成主键
|
|
||||||
// switch (regionTable){
|
|
||||||
// case "orders":
|
|
||||||
// tableRuleConfig.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "orders_id"));
|
|
||||||
// break;
|
|
||||||
//// case "course_collect":
|
|
||||||
//// tableRuleConfig.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "course_collect_id"));
|
|
||||||
//// break;
|
|
||||||
// case "course_user":
|
|
||||||
// tableRuleConfig.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "course_user_id"));
|
|
||||||
// break;
|
|
||||||
// case "tb_user":
|
|
||||||
// tableRuleConfig.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "user_id"));
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// tableRuleConfig.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "id"));
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
sets.add(tableRuleConfig);
|
sets.add(tableRuleConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,8 +160,6 @@ public class ShardingConfig {
|
|||||||
// 定义区域表的分库规则
|
// 定义区域表的分库规则
|
||||||
StandardShardingStrategyConfiguration courseDetailsShardingStrategyConfig = new StandardShardingStrategyConfiguration(
|
StandardShardingStrategyConfiguration courseDetailsShardingStrategyConfig = new StandardShardingStrategyConfiguration(
|
||||||
courseDetailsShardingDatabaseColumn, new StandardShardingStrategyConf());
|
courseDetailsShardingDatabaseColumn, new StandardShardingStrategyConf());
|
||||||
// InlineShardingStrategyConfiguration courseDetailsShardingStrategyConfig = new InlineShardingStrategyConfiguration(
|
|
||||||
// courseDetailsShardingDatabaseColumn, courseDetailsShardingDatabaseAlgorithm);
|
|
||||||
for (String regionTable : courseDetails) {
|
for (String regionTable : courseDetails) {
|
||||||
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(regionTable, String.format(regionTablesDataNode, regionTable));
|
TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration(regionTable, String.format(regionTablesDataNode, regionTable));
|
||||||
tableRuleConfig.setDatabaseShardingStrategyConfig(courseDetailsShardingStrategyConfig);
|
tableRuleConfig.setDatabaseShardingStrategyConfig(courseDetailsShardingStrategyConfig);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.sqx.modules.app.entity;
|
package com.sqx.modules.app.entity;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.amazonaws.services.dynamodbv2.xspec.L;
|
//import com.amazonaws.services.dynamodbv2.xspec.L;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
//import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
@@ -12,7 +12,7 @@ import io.swagger.annotations.ApiModel;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
//import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|||||||
@@ -6,14 +6,15 @@ import com.sqx.modules.course.vo.CourseDetailsSetVo;
|
|||||||
import com.sqx.modules.course.vo.CourseDetailsVo;
|
import com.sqx.modules.course.vo.CourseDetailsVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
|
@CacheConfig
|
||||||
public interface CourseDetailsDao extends BaseMapper<CourseDetails> {
|
public interface CourseDetailsDao extends BaseMapper<CourseDetails> {
|
||||||
/**
|
/**
|
||||||
* @param courseId 剧的id
|
* @param courseId 剧的id
|
||||||
@@ -21,9 +22,10 @@ public interface CourseDetailsDao extends BaseMapper<CourseDetails> {
|
|||||||
* @param price 全剧价格
|
* @param price 全剧价格
|
||||||
* @param wholesalePrice 10集价格
|
* @param wholesalePrice 10集价格
|
||||||
*/
|
*/
|
||||||
List<CourseDetailsSetVo> courseSets(@Param("courseId") Long courseId, boolean isPrice, BigDecimal price, BigDecimal wholesalePrice);
|
@Cacheable(cacheNames = "courseSets" ,key = "#courseId")
|
||||||
|
List<CourseDetailsSetVo> courseSets(@Param("courseId") Long courseId, Integer isPrice, BigDecimal price, BigDecimal wholesalePrice);
|
||||||
|
|
||||||
List<CourseDetailsVo> courseDetails(@Param("courseId") Long courseId, @Param("collect") Integer collect,
|
List<CourseDetailsVo> courseDetails(@Param("courseId") Long courseId, @Param("collect") Long collect,
|
||||||
@Param("starSort") Integer starSort, @Param("endSort") Integer endSort);
|
@Param("starSort") Integer starSort, @Param("endSort") Integer endSort);
|
||||||
|
|
||||||
List<CourseDetails> findByCourseId(@Param("id") Long id, @Param("userId") Long userId);
|
List<CourseDetails> findByCourseId(@Param("id") Long id, @Param("userId") Long userId);
|
||||||
@@ -42,6 +44,7 @@ public interface CourseDetailsDao extends BaseMapper<CourseDetails> {
|
|||||||
*/
|
*/
|
||||||
Map<String, Object> countCourse(Long courseId);
|
Map<String, Object> countCourse(Long courseId);
|
||||||
|
|
||||||
|
@Cacheable(cacheNames = "courseCount" ,key = "#courseId")
|
||||||
Integer countCourseByCourseId(Long courseId);
|
Integer countCourseByCourseId(Long courseId);
|
||||||
|
|
||||||
List<CourseDetails> countByCourseId();
|
List<CourseDetails> countByCourseId();
|
||||||
|
|||||||
@@ -46,15 +46,13 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -84,6 +82,7 @@ public class CourseDetailsServiceImpl extends ServiceImpl<CourseDetailsDao, Cour
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@CacheEvict(cacheNames = {"courseSets", "courseCount"}, key = "#courseDetails.courseId")
|
||||||
public Result insert(CourseDetails courseDetails) {
|
public Result insert(CourseDetails courseDetails) {
|
||||||
if (courseDetails.getGoodNum() == null) {
|
if (courseDetails.getGoodNum() == null) {
|
||||||
courseDetails.setGoodNum(0);
|
courseDetails.setGoodNum(0);
|
||||||
@@ -93,6 +92,7 @@ public class CourseDetailsServiceImpl extends ServiceImpl<CourseDetailsDao, Cour
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@CacheEvict(cacheNames = {"courseSets", "courseCount"}, key = "#courseDetails.courseId")
|
||||||
public Result updateCourseDetails(CourseDetails courseDetails) {
|
public Result updateCourseDetails(CourseDetails courseDetails) {
|
||||||
baseMapper.updateById(courseDetails);
|
baseMapper.updateById(courseDetails);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
@@ -164,26 +164,36 @@ public class CourseDetailsServiceImpl extends ServiceImpl<CourseDetailsDao, Cour
|
|||||||
boolean freeWatch = checkFreeWatchPayCount(userId);
|
boolean freeWatch = checkFreeWatchPayCount(userId);
|
||||||
List<CourseDetailsSetVo> courseDetailsSetVos;
|
List<CourseDetailsSetVo> courseDetailsSetVos;
|
||||||
if (freeWatch || courseUser != null) {
|
if (freeWatch || courseUser != null) {
|
||||||
courseDetailsSetVos = baseMapper.courseSets(courseId, false, null, null);
|
courseDetailsSetVos = baseMapper.courseSets(courseId, 2, null, null);
|
||||||
} else {
|
} else {
|
||||||
courseDetailsSetVos = baseMapper.courseSets(courseId, true, bean.getPrice(), bean.getWholesalePrice());
|
// courseDetailsSetVos = baseMapper.courseSets(courseId, 1, bean.getPrice(), bean.getWholesalePrice());
|
||||||
|
courseDetailsSetVos = baseMapper.courseSets(courseId, 2, bean.getPrice(), bean.getWholesalePrice());
|
||||||
//查询用户是否单独购买了集
|
//查询用户是否单独购买了集
|
||||||
Set<Long> detailsId = courseUserDao.selectUserCourseDetailsId(courseId, userId);
|
Set<Long> detailsId = courseUserDao.selectUserCourseDetailsId(courseId, userId);
|
||||||
|
if (courseCollect != null) {
|
||||||
|
for (CourseDetailsSetVo s : courseDetailsSetVos) {
|
||||||
|
if (s.getCourseDetailsId().equals(courseCollect.getCourseDetailsId())) {
|
||||||
|
s.setCurrent(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
courseDetailsSetVos.get(0).setCurrent(1);
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(detailsId)) {
|
if (CollectionUtil.isNotEmpty(detailsId)) {
|
||||||
courseDetailsSetVos = courseDetailsSetVos.stream()
|
courseDetailsSetVos = courseDetailsSetVos.stream()
|
||||||
.peek(s -> {
|
.peek(s -> {
|
||||||
if (s.getCourseDetailsId().equals(courseCollect.getCourseDetailsId())) {
|
|
||||||
s.setCurrent(1);
|
|
||||||
}
|
|
||||||
if (detailsId.contains(s.getCourseDetailsId())) {
|
if (detailsId.contains(s.getCourseDetailsId())) {
|
||||||
s.setIsPrice(2);
|
s.setIsPrice(2);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter(s -> s.getCurrent() == 1 || s.getIsPrice() == 2)
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Result().put("data", courseDetailsSetVos);
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("title", bean.getTitle());
|
||||||
|
map.put("list", courseDetailsSetVos);
|
||||||
|
return new Result().put("data", map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -198,9 +208,11 @@ public class CourseDetailsServiceImpl extends ServiceImpl<CourseDetailsDao, Cour
|
|||||||
if (sort == null) {
|
if (sort == null) {
|
||||||
CourseCollect courseCollect = courseCollectDao.selectOne(new QueryWrapper<CourseCollect>().eq("course_id", courseId)
|
CourseCollect courseCollect = courseCollectDao.selectOne(new QueryWrapper<CourseCollect>().eq("course_id", courseId)
|
||||||
.eq("user_id", userId).eq("classify", 3).last("limit 1"));
|
.eq("user_id", userId).eq("classify", 3).last("limit 1"));
|
||||||
CourseDetails courseDetails = baseMapper.selectOne(new QueryWrapper<CourseDetails>()
|
if (courseCollect != null) {
|
||||||
.eq("course_details_id", courseCollect.getCourseDetailsId()).eq("course_id", courseCollect.getCourseId()).last("limit 1"));
|
CourseDetails courseDetails = baseMapper.selectOne(new QueryWrapper<CourseDetails>()
|
||||||
sort = courseDetails.getSort();
|
.eq("course_details_id", courseCollect.getCourseDetailsId()).eq("course_id", courseCollect.getCourseId()).last("limit 1"));
|
||||||
|
sort = courseDetails.getSort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (sort != null && sort > 2) {
|
if (sort != null && sort > 2) {
|
||||||
startSort = sort - 3;
|
startSort = sort - 3;
|
||||||
@@ -210,11 +222,28 @@ public class CourseDetailsServiceImpl extends ServiceImpl<CourseDetailsDao, Cour
|
|||||||
endSort = detailCount + 1;
|
endSort = detailCount + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//查询用户是否购买了整集
|
||||||
|
CourseUser courseUser = courseUserDao.selectCourseUser(courseId, userId);
|
||||||
|
boolean freeWatch = true;
|
||||||
|
if (courseUser == null) {
|
||||||
|
// 每天购买超过上限,获得免费时间段资格
|
||||||
|
freeWatch = checkFreeWatchPayCount(userId);
|
||||||
|
}
|
||||||
Integer collect = courseCollectDao.selectCount(new QueryWrapper<CourseCollect>()
|
Integer collect = courseCollectDao.selectCount(new QueryWrapper<CourseCollect>()
|
||||||
.eq("user_id", userId).eq("course_id", courseId)
|
.eq("user_id", userId).eq("course_id", courseId)
|
||||||
.eq("classify", 1).last("limit 1"));
|
.eq("classify", 1).last("limit 1"));
|
||||||
List<CourseDetailsVo> courseDetailsVos = baseMapper.courseDetails(courseId, collect, startSort, endSort);
|
Set<Long> detailsId = new HashSet<>();
|
||||||
|
//全剧免费
|
||||||
|
if ((!freeWatch)) {
|
||||||
|
detailsId = courseUserDao.selectUserCourseDetailsId(courseId, userId);
|
||||||
|
}
|
||||||
|
List<CourseDetailsVo> courseDetailsVos = baseMapper.courseDetails(courseId, collect == null ? 0L : 1L, startSort, endSort);
|
||||||
|
Set<Long> finalDetailsId = detailsId;
|
||||||
courseDetailsVos.stream().forEach(s -> {
|
courseDetailsVos.stream().forEach(s -> {
|
||||||
|
// 不免费 3集以后 (已买的不为空 并不在已买的包含)
|
||||||
|
// if (!freeWatch && s.getSort() > 3 && (CollectionUtil.isEmpty(finalDetailsId) || !finalDetailsId.contains(s.getCourseDetailsId()))) {
|
||||||
|
// s.setVideoUrl(null);
|
||||||
|
// }
|
||||||
CourseCollect isGood = courseCollectDao.selectOne(new QueryWrapper<CourseCollect>()
|
CourseCollect isGood = courseCollectDao.selectOne(new QueryWrapper<CourseCollect>()
|
||||||
.eq("user_id", userId).eq("course_details_id", s.getCourseDetailsId()).eq("classify", 2).last("limit 1"));
|
.eq("user_id", userId).eq("course_details_id", s.getCourseDetailsId()).eq("classify", 2).last("limit 1"));
|
||||||
s.setIsGood(isGood == null ? 0 : 1);
|
s.setIsGood(isGood == null ? 0 : 1);
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -149,6 +150,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, Course> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@CacheEvict(cacheNames = {"courseSets", "courseCount"}, key = "#course.courseId")
|
||||||
public Result updateCourse(Course course) {
|
public Result updateCourse(Course course) {
|
||||||
baseMapper.updateById(course);
|
baseMapper.updateById(course);
|
||||||
return Result.success("操作成功!");
|
return Result.success("操作成功!");
|
||||||
|
|||||||
@@ -13,4 +13,6 @@ public class CourseDetailsSetVo {
|
|||||||
private Integer isPrice;
|
private Integer isPrice;
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
private BigDecimal wholesalePrice;
|
private BigDecimal wholesalePrice;
|
||||||
|
private BigDecimal countPrice;
|
||||||
|
private Integer sort;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,10 @@ public class CourseDetailsVo {
|
|||||||
/**
|
/**
|
||||||
* 是否已追
|
* 是否已追
|
||||||
*/
|
*/
|
||||||
private Integer isCollect;
|
private Long isCollect;
|
||||||
/**
|
/**
|
||||||
* 是否点赞
|
* 是否点赞
|
||||||
*/
|
*/
|
||||||
private Integer isGood;
|
private Integer isGood;
|
||||||
|
private Integer sort;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ package com.sqx.modules.file;
|
|||||||
import com.aliyun.oss.OSS;
|
import com.aliyun.oss.OSS;
|
||||||
import com.aliyun.oss.OSSClientBuilder;
|
import com.aliyun.oss.OSSClientBuilder;
|
||||||
import com.aliyun.tea.TeaException;
|
import com.aliyun.tea.TeaException;
|
||||||
import com.amazonaws.services.s3.AmazonS3;
|
//import com.amazonaws.services.s3.AmazonS3;
|
||||||
import com.amazonaws.services.s3.model.CannedAccessControlList;
|
//import com.amazonaws.services.s3.model.CannedAccessControlList;
|
||||||
import com.amazonaws.services.s3.model.ObjectMetadata;
|
//import com.amazonaws.services.s3.model.ObjectMetadata;
|
||||||
import com.qcloud.cos.COSClient;
|
import com.qcloud.cos.COSClient;
|
||||||
import com.qcloud.cos.ClientConfig;
|
import com.qcloud.cos.ClientConfig;
|
||||||
import com.qcloud.cos.auth.BasicCOSCredentials;
|
import com.qcloud.cos.auth.BasicCOSCredentials;
|
||||||
@@ -56,12 +56,14 @@ public class AliFileUploadController {
|
|||||||
|
|
||||||
|
|
||||||
private final CommonInfoService commonRepository;
|
private final CommonInfoService commonRepository;
|
||||||
private AmazonS3 amazonS3;
|
// private AmazonS3 amazonS3;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public AliFileUploadController(CommonInfoService commonRepository, AmazonS3 amazonS3) {
|
public AliFileUploadController(CommonInfoService commonRepository
|
||||||
|
// , AmazonS3 amazonS3
|
||||||
|
) {
|
||||||
this.commonRepository = commonRepository;
|
this.commonRepository = commonRepository;
|
||||||
this.amazonS3 = amazonS3;
|
// this.amazonS3 = amazonS3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/getCredentials")
|
@GetMapping(value = "/getCredentials")
|
||||||
@@ -164,24 +166,24 @@ public class AliFileUploadController {
|
|||||||
cosclient.shutdown();
|
cosclient.shutdown();
|
||||||
}
|
}
|
||||||
}else if("3".equals(value)){
|
}else if("3".equals(value)){
|
||||||
String suffix = file.getOriginalFilename().substring(Objects.requireNonNull(file.getOriginalFilename()).lastIndexOf("."));
|
// String suffix = file.getOriginalFilename().substring(Objects.requireNonNull(file.getOriginalFilename()).lastIndexOf("."));
|
||||||
// 上传文件流。
|
// // 上传文件流。
|
||||||
InputStream inputStream = null;
|
// InputStream inputStream = null;
|
||||||
try {
|
// try {
|
||||||
inputStream =new ByteArrayInputStream(file.getBytes());
|
// inputStream =new ByteArrayInputStream(file.getBytes());
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
String completePath=getPath(suffix);
|
// String completePath=getPath(suffix);
|
||||||
String bucket=commonRepository.findOne(810).getValue();
|
// String bucket=commonRepository.findOne(810).getValue();
|
||||||
com.amazonaws.services.s3.model.PutObjectRequest putObjectRequest = new com.amazonaws.services.s3.model.PutObjectRequest(bucket, completePath, inputStream, new ObjectMetadata());
|
// com.amazonaws.services.s3.model.PutObjectRequest putObjectRequest = new com.amazonaws.services.s3.model.PutObjectRequest(bucket, completePath, inputStream, new ObjectMetadata());
|
||||||
|
//
|
||||||
putObjectRequest.setCannedAcl(CannedAccessControlList.PublicRead);
|
// putObjectRequest.setCannedAcl(CannedAccessControlList.PublicRead);
|
||||||
|
//
|
||||||
com.amazonaws.services.s3.model.PutObjectResult putObjectResult = amazonS3.putObject(putObjectRequest);
|
// com.amazonaws.services.s3.model.PutObjectResult putObjectResult = amazonS3.putObject(putObjectRequest);
|
||||||
|
//
|
||||||
IOUtils.closeQuietly(inputStream);
|
// IOUtils.closeQuietly(inputStream);
|
||||||
return Result.success().put("data",commonRepository.findOne(811).getValue()+"/"+completePath);
|
// return Result.success().put("data",commonRepository.findOne(811).getValue()+"/"+completePath);
|
||||||
}else if("4".equals(value)){
|
}else if("4".equals(value)){
|
||||||
String endpoint = "tos-cn-beijing.volces.com";
|
String endpoint = "tos-cn-beijing.volces.com";
|
||||||
String region = "cn-beijing";
|
String region = "cn-beijing";
|
||||||
@@ -301,24 +303,24 @@ public class AliFileUploadController {
|
|||||||
cosclient.shutdown();
|
cosclient.shutdown();
|
||||||
}
|
}
|
||||||
}else if("3".equals(value)){
|
}else if("3".equals(value)){
|
||||||
String suffix = file.getOriginalFilename().substring(Objects.requireNonNull(file.getOriginalFilename()).lastIndexOf("."));
|
// String suffix = file.getOriginalFilename().substring(Objects.requireNonNull(file.getOriginalFilename()).lastIndexOf("."));
|
||||||
// 上传文件流。
|
// // 上传文件流。
|
||||||
InputStream inputStream = null;
|
// InputStream inputStream = null;
|
||||||
try {
|
// try {
|
||||||
inputStream =new ByteArrayInputStream(file.getBytes());
|
// inputStream =new ByteArrayInputStream(file.getBytes());
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
String completePath=getPath(suffix);
|
// String completePath=getPath(suffix);
|
||||||
String bucket=commonRepository.findOne(810).getValue();
|
// String bucket=commonRepository.findOne(810).getValue();
|
||||||
com.amazonaws.services.s3.model.PutObjectRequest putObjectRequest = new com.amazonaws.services.s3.model.PutObjectRequest(bucket, completePath, inputStream, new ObjectMetadata());
|
// com.amazonaws.services.s3.model.PutObjectRequest putObjectRequest = new com.amazonaws.services.s3.model.PutObjectRequest(bucket, completePath, inputStream, new ObjectMetadata());
|
||||||
|
//
|
||||||
putObjectRequest.setCannedAcl(CannedAccessControlList.PublicRead);
|
// putObjectRequest.setCannedAcl(CannedAccessControlList.PublicRead);
|
||||||
|
//
|
||||||
com.amazonaws.services.s3.model.PutObjectResult putObjectResult = amazonS3.putObject(putObjectRequest);
|
// com.amazonaws.services.s3.model.PutObjectResult putObjectResult = amazonS3.putObject(putObjectRequest);
|
||||||
|
//
|
||||||
IOUtils.closeQuietly(inputStream);
|
// IOUtils.closeQuietly(inputStream);
|
||||||
return commonRepository.findOne(811).getValue()+"/"+completePath;
|
// return commonRepository.findOne(811).getValue()+"/"+completePath;
|
||||||
}else if("4".equals(value)){
|
}else if("4".equals(value)){
|
||||||
String endpoint = "tos-cn-beijing.volces.com";
|
String endpoint = "tos-cn-beijing.volces.com";
|
||||||
String region = "cn-beijing";
|
String region = "cn-beijing";
|
||||||
|
|||||||
@@ -1,91 +1,91 @@
|
|||||||
package com.sqx.modules.file;
|
//package com.sqx.modules.file;
|
||||||
|
//
|
||||||
import com.amazonaws.services.s3.AmazonS3;
|
//import com.amazonaws.services.s3.AmazonS3;
|
||||||
import com.amazonaws.services.s3.model.*;
|
//import com.amazonaws.services.s3.model.*;
|
||||||
import com.sqx.modules.common.service.CommonInfoService;
|
//import com.sqx.modules.common.service.CommonInfoService;
|
||||||
import org.apache.commons.io.IOUtils;
|
//import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpHeaders;
|
//import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
//import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
//import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
//import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
//import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
//import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
//import org.springframework.web.multipart.MultipartFile;
|
||||||
|
//
|
||||||
import java.io.FileInputStream;
|
//import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
//import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
//import java.io.IOException;
|
||||||
import java.io.InputStream;
|
//import java.io.InputStream;
|
||||||
import java.net.URLEncoder;
|
//import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
//import java.util.Arrays;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
@Service
|
//@Service
|
||||||
public class S3Service {
|
//public class S3Service {
|
||||||
|
//
|
||||||
@Autowired
|
// @Autowired
|
||||||
private AmazonS3 amazonS3;
|
// private AmazonS3 amazonS3;
|
||||||
@Autowired
|
// @Autowired
|
||||||
private CommonInfoService commonInfoService;
|
// private CommonInfoService commonInfoService;
|
||||||
|
//
|
||||||
private PutObjectResult upload(String filePath, String uploadKey) throws FileNotFoundException {
|
// private PutObjectResult upload(String filePath, String uploadKey) throws FileNotFoundException {
|
||||||
return upload(new FileInputStream(filePath), uploadKey);
|
// return upload(new FileInputStream(filePath), uploadKey);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private PutObjectResult upload(InputStream inputStream, String uploadKey) {
|
// private PutObjectResult upload(InputStream inputStream, String uploadKey) {
|
||||||
PutObjectRequest putObjectRequest = new PutObjectRequest(commonInfoService.findOne(810).getValue(), uploadKey, inputStream, new ObjectMetadata());
|
// PutObjectRequest putObjectRequest = new PutObjectRequest(commonInfoService.findOne(810).getValue(), uploadKey, inputStream, new ObjectMetadata());
|
||||||
|
//
|
||||||
putObjectRequest.setCannedAcl(CannedAccessControlList.PublicRead);
|
// putObjectRequest.setCannedAcl(CannedAccessControlList.PublicRead);
|
||||||
|
//
|
||||||
PutObjectResult putObjectResult = amazonS3.putObject(putObjectRequest);
|
// PutObjectResult putObjectResult = amazonS3.putObject(putObjectRequest);
|
||||||
|
//
|
||||||
IOUtils.closeQuietly(inputStream);
|
// IOUtils.closeQuietly(inputStream);
|
||||||
|
//
|
||||||
return putObjectResult;
|
// return putObjectResult;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public List<PutObjectResult> upload(MultipartFile[] multipartFiles) {
|
// public List<PutObjectResult> upload(MultipartFile[] multipartFiles) {
|
||||||
List<PutObjectResult> putObjectResults = new ArrayList<>();
|
// List<PutObjectResult> putObjectResults = new ArrayList<>();
|
||||||
|
//
|
||||||
Arrays.stream(multipartFiles)
|
// Arrays.stream(multipartFiles)
|
||||||
.filter(multipartFile -> !StringUtils.isEmpty(multipartFile.getOriginalFilename()))
|
// .filter(multipartFile -> !StringUtils.isEmpty(multipartFile.getOriginalFilename()))
|
||||||
.forEach(multipartFile -> {
|
// .forEach(multipartFile -> {
|
||||||
try {
|
// try {
|
||||||
putObjectResults.add(upload(multipartFile.getInputStream(), multipartFile.getOriginalFilename()));
|
// putObjectResults.add(upload(multipartFile.getInputStream(), multipartFile.getOriginalFilename()));
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
return putObjectResults;
|
// return putObjectResults;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public ResponseEntity<byte[]> download(String key) throws IOException {
|
// public ResponseEntity<byte[]> download(String key) throws IOException {
|
||||||
GetObjectRequest getObjectRequest = new GetObjectRequest(commonInfoService.findOne(810).getValue(), key);
|
// GetObjectRequest getObjectRequest = new GetObjectRequest(commonInfoService.findOne(810).getValue(), key);
|
||||||
|
//
|
||||||
S3Object s3Object = amazonS3.getObject(getObjectRequest);
|
// S3Object s3Object = amazonS3.getObject(getObjectRequest);
|
||||||
|
//
|
||||||
S3ObjectInputStream objectInputStream = s3Object.getObjectContent();
|
// S3ObjectInputStream objectInputStream = s3Object.getObjectContent();
|
||||||
|
//
|
||||||
byte[] bytes = IOUtils.toByteArray(objectInputStream);
|
// byte[] bytes = IOUtils.toByteArray(objectInputStream);
|
||||||
|
//
|
||||||
String fileName = URLEncoder.encode(key, "UTF-8").replaceAll("\\+", "%20");
|
// String fileName = URLEncoder.encode(key, "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
//
|
||||||
HttpHeaders httpHeaders = new HttpHeaders();
|
// HttpHeaders httpHeaders = new HttpHeaders();
|
||||||
httpHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
// httpHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||||
httpHeaders.setContentLength(bytes.length);
|
// httpHeaders.setContentLength(bytes.length);
|
||||||
httpHeaders.setContentDispositionFormData("attachment", fileName);
|
// httpHeaders.setContentDispositionFormData("attachment", fileName);
|
||||||
|
//
|
||||||
return new ResponseEntity<>(bytes, httpHeaders, HttpStatus.OK);
|
// return new ResponseEntity<>(bytes, httpHeaders, HttpStatus.OK);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public List<S3ObjectSummary> list() {
|
// public List<S3ObjectSummary> list() {
|
||||||
ObjectListing objectListing = amazonS3.listObjects(new ListObjectsRequest().withBucketName(commonInfoService.findOne(810).getValue()));
|
// ObjectListing objectListing = amazonS3.listObjects(new ListObjectsRequest().withBucketName(commonInfoService.findOne(810).getValue()));
|
||||||
|
//
|
||||||
List<S3ObjectSummary> s3ObjectSummaries = objectListing.getObjectSummaries();
|
// List<S3ObjectSummary> s3ObjectSummaries = objectListing.getObjectSummaries();
|
||||||
|
//
|
||||||
return s3ObjectSummaries;
|
// return s3ObjectSummaries;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,34 +1,34 @@
|
|||||||
package com.sqx.modules.file.config;
|
//package com.sqx.modules.file.config;
|
||||||
|
//
|
||||||
import com.amazonaws.auth.AWSCredentials;
|
//import com.amazonaws.auth.AWSCredentials;
|
||||||
import com.amazonaws.auth.AWSStaticCredentialsProvider;
|
//import com.amazonaws.auth.AWSStaticCredentialsProvider;
|
||||||
import com.amazonaws.auth.BasicAWSCredentials;
|
//import com.amazonaws.auth.BasicAWSCredentials;
|
||||||
import com.amazonaws.services.s3.AmazonS3;
|
//import com.amazonaws.services.s3.AmazonS3;
|
||||||
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
//import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
||||||
import com.sqx.modules.common.service.CommonInfoService;
|
//import com.sqx.modules.common.service.CommonInfoService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
//import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
//import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
@Configuration
|
//@Configuration
|
||||||
@Component
|
//@Component
|
||||||
public class AWSConfiguration {
|
//public class AWSConfiguration {
|
||||||
|
//
|
||||||
@Autowired
|
// @Autowired
|
||||||
private CommonInfoService commonInfoService;
|
// private CommonInfoService commonInfoService;
|
||||||
|
//
|
||||||
@Bean
|
// @Bean
|
||||||
public BasicAWSCredentials basicAWSCredentials() {
|
// public BasicAWSCredentials basicAWSCredentials() {
|
||||||
return new BasicAWSCredentials(commonInfoService.findOne(807).getValue(), commonInfoService.findOne(808).getValue());
|
// return new BasicAWSCredentials(commonInfoService.findOne(807).getValue(), commonInfoService.findOne(808).getValue());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Bean
|
// @Bean
|
||||||
public AmazonS3 amazonS3Client(AWSCredentials awsCredentials) {
|
// public AmazonS3 amazonS3Client(AWSCredentials awsCredentials) {
|
||||||
AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard();
|
// AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard();
|
||||||
builder.withCredentials(new AWSStaticCredentialsProvider(awsCredentials));
|
// builder.withCredentials(new AWSStaticCredentialsProvider(awsCredentials));
|
||||||
builder.setRegion(commonInfoService.findOne(809).getValue());
|
// builder.setRegion(commonInfoService.findOne(809).getValue());
|
||||||
AmazonS3 amazonS3 = builder.build();
|
// AmazonS3 amazonS3 = builder.build();
|
||||||
return amazonS3;
|
// return amazonS3;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
#logging:
|
||||||
|
# file:
|
||||||
|
# name: logs/duanju.log
|
||||||
|
# 日志配置
|
||||||
logging:
|
logging:
|
||||||
file:
|
config: classpath:logback.xml
|
||||||
name: logs/duanju.log
|
|
||||||
|
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
@@ -27,25 +30,6 @@ pagehelper:
|
|||||||
supportMethodsArguments: true
|
supportMethodsArguments: true
|
||||||
params:
|
params:
|
||||||
count: countSql
|
count: countSql
|
||||||
#mybatis-plus:
|
|
||||||
# mapper-locations: classpath*:/mapper/**/*.xml
|
|
||||||
# #实体扫描,多个package用逗号或者分号分隔
|
|
||||||
# typeAliasesPackage: com.sqx.modules.*.entity
|
|
||||||
# global-config:
|
|
||||||
# #数据库相关配置
|
|
||||||
# db-config:
|
|
||||||
# #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
|
|
||||||
# id-type: AUTO
|
|
||||||
# logic-delete-value: -1
|
|
||||||
# logic-not-delete-value: 0
|
|
||||||
# banner: false
|
|
||||||
# #原生配置
|
|
||||||
# configuration:
|
|
||||||
# map-underscore-to-camel-case: true
|
|
||||||
# cache-enabled: false
|
|
||||||
# call-setters-on-nulls: true
|
|
||||||
# jdbc-type-for-null: 'null'
|
|
||||||
## log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
|
||||||
|
|
||||||
sqx:
|
sqx:
|
||||||
redis:
|
redis:
|
||||||
|
|||||||
46
src/main/resources/logback.xml
Normal file
46
src/main/resources/logback.xml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<contextName>logback</contextName>
|
||||||
|
<!-- 打印控制台格式 -->
|
||||||
|
<!--%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||||
|
<property name="p_console"
|
||||||
|
value="%green(%d) | %highlight(%-5level) [%thread] %yellow(%c) %cyan([%L]) -| %X{messageId} %msg %n"/>
|
||||||
|
<!--写入文件格式-->
|
||||||
|
<property name="p_file" value="%d | %-5level [%thread] %c [%L] -| %X{messageId} %msg %n"/>
|
||||||
|
<!--输出到控制台-->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${p_console}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<!--按天生成日志-->
|
||||||
|
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>logs/duanju.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!--生成日志文件名称-->
|
||||||
|
<fileNamePattern>logs/duanju.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||||
|
<!--日志文件保留天数-->
|
||||||
|
<MaxHistory>30</MaxHistory>
|
||||||
|
<maxFileSize>100MB</maxFileSize>
|
||||||
|
</rollingPolicy>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<pattern>${p_file}</pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
<!-- 配置一些第三方包的日志过滤级别,用于避免刷屏 -->
|
||||||
|
<!-- 日志级别排序为: TRACE < DEBUG < INFO < WARN < ERROR-->
|
||||||
|
<!-- WARN [main] org.mybatis.spring.mapper.ClassPathMapperScanner-->
|
||||||
|
<!-- INFO [main] org.apache.shardingsphere.core.log.ConfigurationLogger-->
|
||||||
|
|
||||||
|
<logger name="org.springframework.context.support" level="WARN"/>
|
||||||
|
<logger name="org.apache.shardingsphere" level="WARN"/>
|
||||||
|
<logger name="org.mybatis.spring.mapper.ClassPathMapperScanner" level="ERROR"/>
|
||||||
|
<logger name="com.zaxxer.hikari" level="WARN"/>
|
||||||
|
<!-- 输出日志 -->
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
<appender-ref ref="logFile"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
@@ -3,13 +3,14 @@
|
|||||||
<mapper namespace="com.sqx.modules.course.dao.CourseDetailsDao">
|
<mapper namespace="com.sqx.modules.course.dao.CourseDetailsDao">
|
||||||
|
|
||||||
<select id="courseSets" resultType="com.sqx.modules.course.vo.CourseDetailsSetVo">
|
<select id="courseSets" resultType="com.sqx.modules.course.vo.CourseDetailsSetVo">
|
||||||
select c.course_id as courseId
|
select c.course_id as courseId
|
||||||
, c.course_details_id as courseDetailsId
|
, c.course_details_id as courseDetailsId
|
||||||
, c.course_details_name as courseDetailsName
|
, c.course_details_name as courseDetailsName
|
||||||
, c.price as countPrice
|
, c.price as countPrice
|
||||||
, ifnull(#{price}, 0, #{price}) as price
|
, c.sort as sort
|
||||||
, ifnull(#{wholesalePrice}, 0, #{wholesalePrice}) as wholesalePrice
|
, ifnull(#{price}, 0) as price
|
||||||
, IF(#{isPrice}, c.is_price, 2) AS isPrice
|
, ifnull(#{wholesalePrice}, 0) as wholesalePrice
|
||||||
|
, IF(#{isPrice} = 1, c.is_price, 2) AS isPrice
|
||||||
from course_details c
|
from course_details c
|
||||||
where c.course_id = #{courseId}
|
where c.course_id = #{courseId}
|
||||||
order by c.sort asc
|
order by c.sort asc
|
||||||
@@ -22,7 +23,8 @@
|
|||||||
, c.title_img as titleImg
|
, c.title_img as titleImg
|
||||||
, c.video_url as videoUrl
|
, c.video_url as videoUrl
|
||||||
, c.good_num as goodNum
|
, c.good_num as goodNum
|
||||||
, ifnull(#{collect}, 0, 1) as isCollect
|
, c.sort as sort
|
||||||
|
, IF(#{collect} = 1, 1, 0) AS isCollect
|
||||||
from course_details c
|
from course_details c
|
||||||
where c.course_id = #{courseId}
|
where c.course_id = #{courseId}
|
||||||
and sort > #{starSort}
|
and sort > #{starSort}
|
||||||
|
|||||||
Reference in New Issue
Block a user