parent
afe0bc3c2e
commit
51c0e2a1bf
|
@ -1,48 +0,0 @@
|
|||
package cn.edu.hfut.rmdjzz.projectmanagement.config;
|
||||
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.interceptor.CorsInterceptor;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.interceptor.TokenInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* @author 张韬
|
||||
* created at 2022/6/28 19:44
|
||||
*/
|
||||
@Configuration
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
@Bean
|
||||
public CorsInterceptor getCorsInterceptor() {
|
||||
return new CorsInterceptor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TokenInterceptor getTokenInterceptor() {
|
||||
return new TokenInterceptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(getCorsInterceptor()).addPathPatterns("/**");
|
||||
registry.addInterceptor(getTokenInterceptor())
|
||||
.addPathPatterns("/**")
|
||||
.excludePathPatterns("/staff/login")
|
||||
.excludePathPatterns("/hello")
|
||||
.excludePathPatterns("/error")
|
||||
.excludePathPatterns("/staff/timetest");
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOriginPatterns("*")
|
||||
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
|
||||
.allowedHeaders("token")
|
||||
.allowCredentials(true)
|
||||
.maxAge(3600)
|
||||
.allowedHeaders("*");
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package cn.edu.hfut.rmdjzz.projectmanagement.controller;
|
||||
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectType;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectTypeService;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.utils.response.ResponseList;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.utils.response.ResponseMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 阳勇权
|
||||
* @since 2022/6/30 16:36
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/projectType")
|
||||
public class ProjectTypeController {
|
||||
@Autowired
|
||||
private IProjectTypeService projectTypeServiceImpl;
|
||||
|
||||
@GetMapping
|
||||
public ResponseList<ProjectType> getAllProjectType() {
|
||||
List<ProjectType> res = projectTypeServiceImpl.findAllProjectType();
|
||||
return ResponseList.ofSuccess("获得所有类成功", res);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package cn.edu.hfut.rmdjzz.projectmanagement.service;
|
||||
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectType;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 阳勇权
|
||||
* @since 2022/6/30 16:27
|
||||
*/
|
||||
public interface IProjectTypeService extends IService<ProjectType> {
|
||||
List<ProjectType> findAllProjectType();
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package cn.edu.hfut.rmdjzz.projectmanagement.service.impl;
|
||||
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectType;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectMapper;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectTypeMapper;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectTypeService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 阳勇权
|
||||
* @since 2022/6/30 16:28
|
||||
*/
|
||||
@Service
|
||||
public class ProjectTypeServiceImpl extends ServiceImpl<ProjectTypeMapper, ProjectType> implements IProjectTypeService {
|
||||
|
||||
@Override
|
||||
public List<ProjectType> findAllProjectType() {
|
||||
return baseMapper.selectList(Wrappers.<ProjectType>lambdaQuery().ne(ProjectType::getProjectClassId, 0));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue