项目列表操作,

包括个人项目列表获取,个人项目总数,所有类获得
master
yang.yongquan 2022-06-30 18:03:20 +08:00
parent afe0bc3c2e
commit 51c0e2a1bf
4 changed files with 70 additions and 48 deletions

View File

@ -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("*");
}
*/
}

View File

@ -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);
}
}

View File

@ -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();
}

View File

@ -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));
}
}