1.季度考核增加查询方法,增加查询dto

2.增加新增时page泛型
This commit is contained in:
zty 2024-07-09 16:42:58 +08:00
parent 45b1a6eb25
commit 993736bb64
10 changed files with 120 additions and 10 deletions

View File

@ -377,7 +377,10 @@ public class Api {
public static final String PROJECT_WEEKLY_BUDGET_DEL = PROJECT_WEEKLY_BUDGET + "/del";
public static final String PROJECT_INFO_GETPROJECTS = PROJECT_INFO;
/*
季度考核管理
*/
public static final String PROJECT_QUARTERLY_EVALUATION=PROJECT_PREFIX+"/quarterExamine";
public static final String PROJECT_INFO_GET_ACCEPT_PROJECTS = PROJECT_INFO + "/accept";
public static final String PROJECT_INFO_MODEL = PROJECT_INFO + "/model";

View File

@ -2,7 +2,13 @@ package com.xqopen.kehui.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.xqopen.kehui.project.dto.ProjectQuarterlyEvaluationListDto;
import com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author admin
@ -10,7 +16,7 @@ import com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation;
* @createDate 2024-07-09 14:45:38
* @Entity .domain.com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation
*/
@Repository
public interface ProjectQuarterlyEvaluationDao extends BaseMapper<ProjectQuarterlyEvaluation> {
List<ProjectQuarterlyEvaluationListDto> getList(Page<ProjectQuarterlyEvaluation> page, @Param("evaluation") ProjectQuarterlyEvaluation evaluation);
}

View File

@ -2,9 +2,9 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace=".mapper.ProjectQuarterlyEvaluationMapper">
<mapper namespace="com.xqopen.kehui.mapper.ProjectQuarterlyEvaluationDao">
<resultMap id="BaseResultMap" type=".domain.ProjectQuarterlyEvaluation">
<resultMap id="BaseResultMap" type="com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation">
<id property="id" column="id_" jdbcType="VARCHAR"/>
<result property="projectId" column="project_id" jdbcType="VARCHAR"/>
<result property="ext" column="ext_" jdbcType="OTHER"/>
@ -20,4 +20,17 @@
is_deleted,created_by,created_at,
updated_by,updated_at
</sql>
<resultMap id="getListAndUserInFo" type="com.xqopen.kehui.project.dto.ProjectQuarterlyEvaluationListDto">
<id property="id" column="pqe.id_"></id>
<association property="projectInfo" javaType="com.xqopen.kehui.project.entity.ProjectInfo">
<id property="id" column="pi.id_"></id>
</association>
</resultMap>
<select id="getList" resultMap="getListAndUserInFo">
select * from project_quarterly_evaluation pqe
left join project_info pi on pi.id_=cast(pqe.project_id as BIGINT)
where 1=1 and pqe.is_deleted='0'
</select>
</mapper>

View File

@ -1,4 +1,45 @@
package com.xqopen.kehui.project.action;
public class ProjectQuarterlyEvaluationController {
import com.alibaba.fastjson.support.spring.FastJsonJsonView;
import com.baomidou.mybatisplus.plugins.Page;
import com.xqopen.kehui.Api;
import com.xqopen.kehui.exception.ErrorCode;
import com.xqopen.kehui.exception.XQException;
import com.xqopen.kehui.project.api.ProjectQuarterlyEvaluationApi;
import com.xqopen.kehui.project.dto.ProjectQuarterlyEvaluationListDto;
import com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation;
import com.xqopen.kehui.project.service.ProjectQuarterlyEvaluationService;
import com.xqopen.kehui.util.ApiResponse;
import com.xqopen.kehui.util.PageNoUtil;
import com.xqopen.kehui.util.ResultListReqUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@RestController
@RequestMapping(produces = FastJsonJsonView.DEFAULT_CONTENT_TYPE)
public class ProjectQuarterlyEvaluationController implements ProjectQuarterlyEvaluationApi {
@Autowired
ProjectQuarterlyEvaluationService quarterlyEvaluationService;
@Override
@PostMapping(Api.PROJECT_QUARTERLY_EVALUATION)
public String list(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectQuarterlyEvaluation> pageNoUtil) throws XQException {
try {
Page<ProjectQuarterlyEvaluation> page = new Page<>(pageNoUtil.getPageNo(),pageNoUtil.getPageSize());
ProjectQuarterlyEvaluation evaluation = pageNoUtil.getT();
List<ProjectQuarterlyEvaluationListDto> list = quarterlyEvaluationService.getList(page, evaluation);
ResultListReqUtil<ProjectQuarterlyEvaluationListDto> listReqUtil = new ResultListReqUtil<>();
listReqUtil.setLs(list);
listReqUtil.setPages(page.getPages());
listReqUtil.setTotal(page.getTotal());
return ApiResponse.fillSuccess(listReqUtil);
}catch (Exception e){
log.error("ProjectQuarterlyEvaluationController.list", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
}
}
}

View File

@ -159,7 +159,7 @@ public class ProjectWeeklyController implements ProjectWeeklyApi {
log.error("ProjectWeeklyController.list", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
}
return null;
return ApiResponse.fillFail("获取失败!");
}

View File

@ -1,9 +1,21 @@
package com.xqopen.kehui.project.api;
import com.xqopen.kehui.exception.XQException;
import com.xqopen.kehui.project.dto.ProjectInfoListResp;
import com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation;
import com.xqopen.kehui.util.Constants;
import com.xqopen.kehui.util.PageNoUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(value = "季度考核管理", tags = Constants.MODULE_PROJECT, description = "项目模块")
public interface ProjectQuarterlyEvaluationApi {
@ApiOperation(value = "获取考核管理列表", notes = "获取考核管理列表", response = ProjectInfoListResp.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "登录标识符", required = true, paramType = "header", dataType = "String"),
})
String list(Long userId, PageNoUtil<ProjectQuarterlyEvaluation> pageNoUtil
) throws XQException;
}

View File

@ -0,0 +1,10 @@
package com.xqopen.kehui.project.dto;
import com.xqopen.kehui.project.entity.ProjectInfo;
import com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation;
import lombok.Data;
@Data
public class ProjectQuarterlyEvaluationListDto extends ProjectQuarterlyEvaluation {
private ProjectInfo projectInfo;
}

View File

@ -1,8 +1,13 @@
package com.xqopen.kehui.project.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.xqopen.kehui.project.dto.ProjectQuarterlyEvaluationListDto;
import com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author admin
@ -10,5 +15,5 @@ import com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation;
* @createDate 2024-07-09 14:45:38
*/
public interface ProjectQuarterlyEvaluationService extends IService<ProjectQuarterlyEvaluation> {
List<ProjectQuarterlyEvaluationListDto> getList(Page<ProjectQuarterlyEvaluation> page, @Param("evaluation") ProjectQuarterlyEvaluation evaluation);
}

View File

@ -1,12 +1,17 @@
package com.xqopen.kehui.project.service.impl;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.xqopen.kehui.mapper.ProjectQuarterlyEvaluationDao;
import com.xqopen.kehui.project.dto.ProjectQuarterlyEvaluationListDto;
import com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation;
import com.xqopen.kehui.project.service.ProjectQuarterlyEvaluationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author admin
* @description 针对表project_quarterly_evaluation的数据库操作Service实现
@ -15,5 +20,10 @@ import org.springframework.stereotype.Service;
@Service
public class ProjectQuarterlyEvaluationServiceImpl extends ServiceImpl<ProjectQuarterlyEvaluationDao, ProjectQuarterlyEvaluation>
implements ProjectQuarterlyEvaluationService {
@Autowired
ProjectQuarterlyEvaluationDao evaluationDao;
@Override
public List<ProjectQuarterlyEvaluationListDto> getList(Page<ProjectQuarterlyEvaluation> page, ProjectQuarterlyEvaluation evaluation) {
return evaluationDao.getList(page,evaluation);
}
}

View File

@ -0,0 +1,10 @@
package com.xqopen.kehui.util;
import lombok.Data;
@Data
public class PageNoUtil<T> {
private T t;
private Integer pageNo;
private Integer pageSize;
}