项目列表操作
parent
fc601ba7a8
commit
534f2f7f24
|
@ -0,0 +1,38 @@
|
||||||
|
package cn.edu.hfut.rmdjzz.projectmanagement.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 阳勇权
|
||||||
|
* @since 2022/6/29 16:04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Project {
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Integer projectId;
|
||||||
|
private String projectName;
|
||||||
|
private LocalDate projectStartTime;
|
||||||
|
private LocalDate projectOnlineTime;
|
||||||
|
private LocalDate projectFirstTestTime;
|
||||||
|
private LocalDate projectFinalTestTime;
|
||||||
|
private LocalDate projectEndTime;
|
||||||
|
private String projectAbbreviation;
|
||||||
|
private Integer projectClassId;
|
||||||
|
private Integer projectSubclassId;
|
||||||
|
private String projectImportance;
|
||||||
|
private Long contractAmount;
|
||||||
|
private Short expectedCompletion;
|
||||||
|
private Short financialCode;
|
||||||
|
private String projectDepartment;
|
||||||
|
private String projectArea;
|
||||||
|
private String projectCompany;
|
||||||
|
private String projectDescription;
|
||||||
|
private Boolean completed;
|
||||||
|
@TableLogic
|
||||||
|
private Boolean deleted;
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package cn.edu.hfut.rmdjzz.projectmanagement.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 阳勇权
|
||||||
|
* @since 2022/6/29 20:54
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("project_type")
|
||||||
|
public class ProjectType {
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
Integer projectClassId;
|
||||||
|
String projectClassName;
|
||||||
|
Integer classFatherId;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cn.edu.hfut.rmdjzz.projectmanagement.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 阳勇权
|
||||||
|
* @since 2022/6/29 20:45
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class ResultProject {
|
||||||
|
Integer projectId;
|
||||||
|
String projectName;
|
||||||
|
Long contractAmount;
|
||||||
|
String projectImportance;
|
||||||
|
String projectClassName;
|
||||||
|
String projectSubClassName;
|
||||||
|
// 带加的进度 Double projectProcess;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package cn.edu.hfut.rmdjzz.projectmanagement.mapper;
|
||||||
|
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.apache.ibatis.annotations.*;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 阳勇权
|
||||||
|
* @since 2022/6/29 17:07
|
||||||
|
*/
|
||||||
|
public interface ProjectMapper extends BaseMapper<Project> {
|
||||||
|
@Select("SELECT COUNT(*) FROM project WHERE project_id IN " +
|
||||||
|
"(SELECT DISTINCT project_id FROM project_group WHERE staff_id = #{id})")
|
||||||
|
Long getProjectTotalNum(@Param("id") Integer staffId);
|
||||||
|
@Select("SELECT * FROM project WHERE project_id IN " +
|
||||||
|
"(SELECT DISTINCT project_id FROM project_group WHERE staff_id = #{id})")
|
||||||
|
@Results({
|
||||||
|
@Result(column = "project_id", property = "projectId", id = true),
|
||||||
|
@Result(column = "project_name", property = "projectName"),
|
||||||
|
@Result(column = "contract_amount", property = "contractAmount"),
|
||||||
|
@Result(column = "project_importance", property = "projectImportance"),
|
||||||
|
@Result(column = "{id = project_class_id}", property = "projectClassName", javaType = String.class,
|
||||||
|
one = @One(select = "cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectTypeMapper.findClassNameById")),
|
||||||
|
@Result(column = "{id = project_subclass_id}", property = "projectSubClassName", javaType = String.class,
|
||||||
|
one = @One(select = "cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectTypeMapper.findClassNameById"))
|
||||||
|
})
|
||||||
|
Page<ResultProject> findMyProject(Page<ResultProject> pg, @Param("id") Integer staffId);
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cn.edu.hfut.rmdjzz.projectmanagement.mapper;
|
||||||
|
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectType;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 阳勇权
|
||||||
|
* @since 2022/6/29 20:56
|
||||||
|
*/
|
||||||
|
public interface ProjectTypeMapper extends BaseMapper<ProjectType> {
|
||||||
|
@Select("SELECT project_class_name FROM project_type WHERE project_class_id = #{id}")
|
||||||
|
String findClassNameById(@Param("id") Integer projectClassId);
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package cn.edu.hfut.rmdjzz.projectmanagement.service;
|
||||||
|
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.utils.response.ResponseMap;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 阳勇权
|
||||||
|
* @since 2022/6/29 17:08
|
||||||
|
*/
|
||||||
|
public interface IProjectService extends IService<Project> {
|
||||||
|
Page<ResultProject> getOnePageProject(String toke) throws TokenException;
|
||||||
|
Long getProjectTotalNum(String token) throws TokenException;
|
||||||
|
Boolean setProjectCompleted(String token, Project project) throws TokenException;
|
||||||
|
Boolean makeANewProject(Project project) throws TokenException;
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package cn.edu.hfut.rmdjzz.projectmanagement.service.impl;
|
||||||
|
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ResultProject;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.exception.TokenException;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectMapper;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService;
|
||||||
|
import cn.edu.hfut.rmdjzz.projectmanagement.utils.TokenUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.sql.Wrapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 阳勇权
|
||||||
|
* @since 2022/6/29 19:36
|
||||||
|
*/
|
||||||
|
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements IProjectService {
|
||||||
|
@Autowired
|
||||||
|
TokenUtils tokenUtils;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<ResultProject> getOnePageProject(String token) throws TokenException {
|
||||||
|
Integer staffId = tokenUtils.getStaffId(token);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getProjectTotalNum(String token) throws TokenException{
|
||||||
|
Integer staffId = tokenUtils.getStaffId(token);
|
||||||
|
return baseMapper.getProjectTotalNum(staffId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean setProjectCompleted(String token, Project project) throws TokenException{
|
||||||
|
Integer staffId = tokenUtils.getStaffId(token);
|
||||||
|
Project targetProject = baseMapper.selectOne(Wrappers.<Project>lambdaQuery().eq(Project::getProjectId, project.getProjectId()));
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean makeANewProject(Project project) throws TokenException{
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue