Compare commits

...

4 Commits

  1. 8
      vote/.idea/.gitignore
  2. 18
      vote/.idea/compiler.xml
  3. 6
      vote/.idea/encodings.xml
  4. 20
      vote/.idea/jarRepositories.xml
  5. 12
      vote/.idea/misc.xml
  6. 6
      vote/.idea/vcs.xml
  7. 10
      vote/src/main/java/com/votesystem/ssl/config/MyWebConfiguration.java
  8. 5
      vote/src/main/java/com/votesystem/ssl/dao/ActivityDAO.java
  9. 1
      vote/src/main/java/com/votesystem/ssl/service/impl/ActivityServiceImpl.java
  10. 2
      vote/src/main/resources/application.yml

8
vote/.idea/.gitignore

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

18
vote/.idea/compiler.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="ssl" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="ssl" options="-parameters" />
</option>
</component>
</project>

6
vote/.idea/encodings.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
</component>
</project>

20
vote/.idea/jarRepositories.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

12
vote/.idea/misc.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="corretto-1.8" project-jdk-type="JavaSDK" />
</project>

6
vote/.idea/vcs.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

10
vote/src/main/java/com/votesystem/ssl/config/MyWebConfiguration.java

@ -18,14 +18,18 @@ public class MyWebConfiguration implements WebMvcConfigurer {
.allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
.allowedHeaders("*")
.maxAge(3600);
} @Override
}
@Value("${image.save-path}")
private String imagePath;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/api/file/**").addResourceLocations("file:" + imagePath + "/");
// registry.addResourceHandler(imagePath).addResourceLocations("file:" + imagePath + "/");
}
@Value("${image.save-path}")
private String imagePath;

5
vote/src/main/java/com/votesystem/ssl/dao/ActivityDAO.java

@ -57,8 +57,9 @@ public interface ActivityDAO extends JpaRepository<Activity,String>, JpaSpecific
//分页列出案例
@Query(value = " select * from tb_activity a where a.state = '2'",nativeQuery = true)
List<Activity> findByState(Pageable pageable);
//这个不对
@Query(value = "SELECT * FROM tb_activity WHERE state != '-1' ",nativeQuery = true)
//这个不对 sql上的author呢? 你没有,肯定查所有啊 这段就是我当时不会的那句 yy
@Query(value = "SELECT * FROM tb_activity WHERE state != '-1' and author = ?",nativeQuery = true)
Page<Activity> findAllByAuthor(String author ,Pageable pageable);

1
vote/src/main/java/com/votesystem/ssl/service/impl/ActivityServiceImpl.java

@ -228,6 +228,7 @@ public Result listActivityByUser(String userName,int page, int size) {
activityFromDb.setStartTime(activity.getStartTime());
activityFromDb.setEndTime(activity.getEndTime());
activityFromDb.setUpdateTime(new Date());
activityFromDb.setIpRestrict(activity.isIpRestrict());
//保存到数据库
activityDAO.save(activityFromDb);
return ResultFactory.buildSuccessResult(activityFromDb);

2
vote/src/main/resources/application.yml

@ -24,7 +24,7 @@ spring:
port: 6379
host: 127.0.0.1
password:
image.save-path: images/
image.save-path: E:/date/images
#MyBatis使用pageHelper分页
pagehelper:

Loading…
Cancel
Save