feat: 项目管理和license管理添加排序功能
This commit is contained in:
@@ -65,4 +65,10 @@ public class LicensePageReqVO extends PageParam {
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "排列字段")
|
||||
private String sortField;
|
||||
|
||||
@Schema(description = "排列顺序")
|
||||
private String sortOrder;
|
||||
}
|
||||
@@ -76,4 +76,10 @@ public class ProjectPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "客户ID", example = "111")
|
||||
private Long customerId;
|
||||
|
||||
@Schema(description = "排列字段")
|
||||
private String sortField;
|
||||
|
||||
@Schema(description = "排列顺序")
|
||||
private String sortOrder;
|
||||
}
|
||||
@@ -576,6 +576,9 @@ public class LicenseServiceImpl implements LicenseService {
|
||||
|
||||
@Override
|
||||
public PageResult<LicenseRespVO> getLicensePage(LicensePageReqVO pageReqVO) {
|
||||
if (StrUtil.isNotBlank(pageReqVO.getSortField())) {
|
||||
pageReqVO.setSortField(StrUtil.toUnderlineCase(pageReqVO.getSortField()));
|
||||
}
|
||||
IPage<LicenseRespVO> page = licenseMapper.queryPage(new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO);
|
||||
|
||||
PageResult<LicenseRespVO> voPageResult = BeanUtils.toBean(new PageResult<>(page.getRecords(), page.getTotal()), LicenseRespVO.class);
|
||||
|
||||
@@ -118,6 +118,9 @@ public class ProjectServiceImpl implements ProjectService {
|
||||
|
||||
@Override
|
||||
public PageResult<ProjectRespVO> getProjectPage(ProjectPageReqVO pageReqVO) {
|
||||
if (StrUtil.isNotBlank(pageReqVO.getSortField())) {
|
||||
pageReqVO.setSortField(StrUtil.toUnderlineCase(pageReqVO.getSortField()));
|
||||
}
|
||||
IPage<ProjectRespVO> page = projectMapper.queryPage(new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO);
|
||||
|
||||
for (ProjectRespVO record : page.getRecords()) {
|
||||
|
||||
@@ -95,7 +95,16 @@
|
||||
<if test="query.projectName != null and query.projectName != ''">
|
||||
AND p.name LIKE CONCAT('%',#{query.projectName},'%')
|
||||
</if>
|
||||
ORDER BY
|
||||
l.application_time DESC
|
||||
|
||||
<choose>
|
||||
<when test="query.sortField != null and query.sortField != '' and query.sortOrder != null and query.sortOrder != ''">
|
||||
ORDER BY
|
||||
${query.sortField} ${query.sortOrder}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY
|
||||
l.application_time DESC
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -20,14 +20,34 @@
|
||||
|
||||
<sql id="queryProjects">
|
||||
SELECT
|
||||
p.*,
|
||||
c.serial_no
|
||||
p.*
|
||||
FROM
|
||||
crm_project p
|
||||
LEFT JOIN crm_license_server c ON p.id = c.project_id
|
||||
AND c.deleted = 0
|
||||
WHERE
|
||||
p.deleted = 0
|
||||
(
|
||||
SELECT
|
||||
p.*,
|
||||
l.serial_no,
|
||||
ifnull( pc.comment_num, 0 ) comment_num,
|
||||
ifnull( pl.apply_count, 0 ) apply_count
|
||||
FROM
|
||||
crm_project p
|
||||
LEFT JOIN ( SELECT project_id, GROUP_CONCAT( serial_no ) serial_no FROM crm_license_server WHERE deleted = 0 GROUP BY project_id ) l ON p.id = l.project_id
|
||||
LEFT JOIN ( SELECT c.project_id, count( c.id ) comment_num FROM crm_comment c WHERE c.deleted = 0 GROUP BY c.project_id ) pc ON p.id = pc.project_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
l.project_id,
|
||||
count( lh.id ) + 1 apply_count
|
||||
FROM
|
||||
crm_license_server l
|
||||
LEFT JOIN crm_license_server_history lh ON l.id = lh.license_id
|
||||
AND lh.deleted = 0
|
||||
WHERE
|
||||
l.deleted = 0
|
||||
GROUP BY
|
||||
l.project_id
|
||||
) pl ON p.id = pl.project_id
|
||||
WHERE
|
||||
p.deleted = 0
|
||||
) p
|
||||
<if test="query.customerId != null">
|
||||
AND p.customer_id = #{query.customerId}
|
||||
</if>
|
||||
@@ -65,15 +85,24 @@
|
||||
AND p.env_info LIKE CONCAT('%',#{query.envInfo},'%')
|
||||
</if>
|
||||
<if test="query.serialNo != null and query.serialNo != ''">
|
||||
AND c.serial_no LIKE CONCAT('%',#{query.serialNo},'%')
|
||||
AND p.serial_no LIKE CONCAT('%',#{query.serialNo},'%')
|
||||
</if>
|
||||
<if test="query.technicalOwner != null">
|
||||
AND (p.technical_owner_a = #{query.technicalOwner}
|
||||
OR p.technical_owner_b = #{query.technicalOwner}
|
||||
OR p.technical_owner_c = #{query.technicalOwner})
|
||||
</if>
|
||||
ORDER BY
|
||||
p.create_time DESC
|
||||
<choose>
|
||||
<when test="query.sortField != null and query.sortField != '' and query.sortOrder != null and query.sortOrder != ''">
|
||||
ORDER BY
|
||||
${query.sortField} ${query.sortOrder}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY
|
||||
p.create_time DESC
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</sql>
|
||||
|
||||
<select id="getLicenseProjects" resultType="org.agt.module.license.controller.admin.project.vo.ProjectRespVO">
|
||||
|
||||
Reference in New Issue
Block a user