xia
3 years ago
13 changed files with 192 additions and 13 deletions
-
17archives/src/main/java/com/storeroom/modules/archives/controller/ArchivesController.java
-
2archives/src/main/java/com/storeroom/modules/archives/controller/CaseController.java
-
29archives/src/main/java/com/storeroom/modules/archives/controller/TagController.java
-
40archives/src/main/java/com/storeroom/modules/archives/domain/ArchivesTag.java
-
20archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesTagRepository.java
-
2archives/src/main/java/com/storeroom/modules/archives/service/ArchivesService.java
-
10archives/src/main/java/com/storeroom/modules/archives/service/ArchivesTagService.java
-
4archives/src/main/java/com/storeroom/modules/archives/service/dto/ArchivesFileDTO.java
-
22archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java
-
22archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesTagServiceImpl.java
-
28common/src/main/java/com/storeroom/config/WebMvcConfig.java
-
3system/src/main/java/com/storeroom/modules/security/config/SpringSecurityConfig.java
-
4system/src/main/resources/application-dev.yml
@ -0,0 +1,29 @@ |
|||
package com.storeroom.modules.archives.controller; |
|||
|
|||
import com.storeroom.modules.archives.service.ArchivesTagService; |
|||
import com.storeroom.utils.ApiResponse; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "标签管理") |
|||
@RequestMapping("/api/tag") |
|||
public class TagController { |
|||
|
|||
private final ArchivesTagService archivesTagService; |
|||
|
|||
@ApiOperation("标签列表") |
|||
@GetMapping("/initTagList") |
|||
public ApiResponse<Object> initTagList( |
|||
String tid, String query,Integer isType, Pageable page |
|||
){ |
|||
return ApiResponse.success(archivesTagService.initTagList(tid,query,isType,page)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.storeroom.modules.archives.domain; |
|||
|
|||
import com.storeroom.base.BaseEntity; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.persistence.Column; |
|||
import javax.persistence.Entity; |
|||
import javax.persistence.Id; |
|||
import javax.persistence.Table; |
|||
import java.io.Serializable; |
|||
|
|||
@Entity |
|||
@Getter |
|||
@Setter |
|||
@Table(name = "archives_tag") |
|||
public class ArchivesTag extends BaseEntity implements Serializable { |
|||
|
|||
@Id |
|||
@Column(name = "tid") |
|||
private String tid; |
|||
|
|||
@Column(name = "parents_id") |
|||
@ApiModelProperty(value = "绑定id 档案id/盒id/层架位id") |
|||
private String parentsId; |
|||
|
|||
@Column(name = "title") |
|||
@ApiModelProperty(value = "标签名称") |
|||
private String title; |
|||
|
|||
@Column(name = "is_type") |
|||
@ApiModelProperty(value = "标签类别 1.档案标签 2.盒标签 3.层架位标签") |
|||
private Integer isType; |
|||
|
|||
@Column(name = "eas") |
|||
@ApiModelProperty(value = "报警状态 1.报警 0.不报警") |
|||
private Integer eas; |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.storeroom.modules.archives.repository; |
|||
|
|||
import com.storeroom.modules.archives.domain.ArchivesTag; |
|||
import org.springframework.data.domain.Page; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.data.jpa.repository.JpaRepository; |
|||
import org.springframework.data.jpa.repository.Modifying; |
|||
import org.springframework.data.jpa.repository.Query; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface ArchivesTagRepository extends JpaRepository<ArchivesTag, String>{ |
|||
|
|||
@Query(nativeQuery = true, |
|||
value = "select * from archives_tag where if(?1 is null,1=1,tid like ?1) and if(?2 is null,1=1,title like ?2) and if(?3 is null,1=1,is_type = ?3)") |
|||
// @Query("") |
|||
Page<ArchivesTag> initTagList(String tid, String query,Integer isType, Pageable page); |
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.storeroom.modules.archives.service; |
|||
|
|||
import org.springframework.data.domain.Pageable; |
|||
|
|||
public interface ArchivesTagService { |
|||
|
|||
|
|||
Object initTagList(String tid, String query,Integer isType, Pageable page); |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.storeroom.modules.archives.service.impl; |
|||
|
|||
import com.storeroom.modules.archives.repository.ArchivesTagRepository; |
|||
import com.storeroom.modules.archives.service.ArchivesTagService; |
|||
import com.storeroom.utils.StringUtils; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
@Service |
|||
@RequiredArgsConstructor |
|||
public class ArchivesTagServiceImpl implements ArchivesTagService { |
|||
|
|||
private final ArchivesTagRepository archivesTagRepository; |
|||
|
|||
@Override |
|||
public Object initTagList(String tid, String query, Integer isType, Pageable page) { |
|||
tid = null != tid ? "%"+tid+"%" : null; |
|||
query = null != query ? "%"+query+"%" : null; |
|||
return archivesTagRepository.initTagList(tid,query,isType,page); |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.storeroom.config; |
|||
|
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
|||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
|||
|
|||
@Configuration |
|||
public class WebMvcConfig implements WebMvcConfigurer { |
|||
|
|||
@Value("${accessFile.resourceHandler}") |
|||
private String resourceHandler; //匹配url 中的资源映射 |
|||
|
|||
@Value("${accessFile.location}") |
|||
private String location; //上传文件保存的本地目录 |
|||
|
|||
/** |
|||
* 配置静态资源映射 |
|||
* |
|||
* @param registry |
|||
*/ |
|||
@Override |
|||
public void addResourceHandlers(ResourceHandlerRegistry registry) { |
|||
//匹配到resourceHandler,将URL映射至location,也就是本地文件夹 |
|||
registry.addResourceHandler(resourceHandler).addResourceLocations("file:///" + location); |
|||
} |
|||
|
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue