2024年2月6日09:34:45
parent
01d4ae4bf3
commit
04a0abc2a6
5
pom.xml
5
pom.xml
|
|
@ -166,7 +166,10 @@
|
|||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>${commons-beanutils.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.zhangmeng.fiction.server.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.GenericToStringSerializer;
|
||||
|
||||
|
||||
/**
|
||||
* @author zhangmeng
|
||||
* @version 1.0
|
||||
* @date 2020年11月16日14:33:38
|
||||
*/
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@Bean("redisTemplate")
|
||||
public RedisTemplate redisTemplate(@Lazy RedisConnectionFactory connectionFactory) {
|
||||
RedisTemplate redis = new RedisTemplate();
|
||||
GenericToStringSerializer<String> keySerializer = new GenericToStringSerializer<String>(String.class);
|
||||
redis.setKeySerializer(keySerializer);
|
||||
redis.setHashKeySerializer(keySerializer);
|
||||
GenericJackson2JsonRedisSerializer valueSerializer = new GenericJackson2JsonRedisSerializer();
|
||||
redis.setValueSerializer(valueSerializer);
|
||||
redis.setHashValueSerializer(valueSerializer);
|
||||
redis.setConnectionFactory(connectionFactory);
|
||||
return redis;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.zhangmeng.fiction.server.dao;
|
||||
|
||||
import com.zhangmeng.db.tk.base.AbstractBaseMapper;
|
||||
import com.zhangmeng.fiction.server.entity.FictionCategory;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FictionCategoryDao extends AbstractBaseMapper<FictionCategory> {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.zhangmeng.fiction.server.dao;
|
||||
|
||||
|
||||
import com.zhangmeng.db.tk.base.AbstractBaseMapper;
|
||||
import com.zhangmeng.fiction.server.entity.FictionChapter;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FictionChapterDao extends AbstractBaseMapper<FictionChapter> {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.zhangmeng.fiction.server.dao;
|
||||
|
||||
|
||||
import com.zhangmeng.db.tk.base.AbstractBaseMapper;
|
||||
import com.zhangmeng.fiction.server.entity.FictionCollection;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FictionCollectionDao extends AbstractBaseMapper<FictionCollection> {
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.zhangmeng.fiction.server.dao;
|
||||
|
||||
import com.zhangmeng.db.tk.base.AbstractBaseMapper;
|
||||
import com.zhangmeng.fiction.server.entity.Fiction;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
@Mapper
|
||||
public interface FictionDao extends AbstractBaseMapper<Fiction> {
|
||||
|
||||
|
||||
@Select("select * from fiction obj where obj.bookName = #{bookName}")
|
||||
Fiction finbByBookName(String bookName);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.zhangmeng.fiction.server.dao;
|
||||
|
||||
|
||||
import com.zhangmeng.db.tk.base.AbstractBaseMapper;
|
||||
import com.zhangmeng.fiction.server.entity.FictionDetails;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FictionDetailsDao extends AbstractBaseMapper<FictionDetails> {
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.zhangmeng.fiction.server.service.impl;
|
||||
|
||||
|
||||
import com.zhangmeng.fiction.server.entity.FictionChapter;
|
||||
|
||||
import com.zhangmeng.fiction.server.service.FictionChapterService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tk.mybatis.mapper.entity.Condition;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FictionChapterServiceImpl extends AbstractBaseServiceImpl<FictionChapter> implements FictionChapterService {
|
||||
@Override
|
||||
public FictionChapter findByChapterName(String title,Long fiction_id) {
|
||||
|
||||
Condition condition = new Condition(FictionChapter.class);
|
||||
Example.Criteria criteria = condition.createCriteria();
|
||||
criteria.andEqualTo("title",title);
|
||||
criteria.andEqualTo("fiction_id",fiction_id);
|
||||
List<FictionChapter> fictionChapters = this.findByCondition(condition);
|
||||
if (fictionChapters.size() > 0){
|
||||
return fictionChapters.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FictionChapter> getByFictionId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ spring:
|
|||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
url: jdbc:mysql://123.57.75.116:13306/mystyle-blog?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
|
||||
url: jdbc:mysql://127.0.0.1:3306/mystyle-blog?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
password: root
|
||||
jpa:
|
||||
|
|
|
|||
Loading…
Reference in New Issue