2026-01-04 14:45:09 +08:00
|
|
|
package com.gunshi.project.ss.mapper;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
|
|
|
import com.gunshi.project.ss.model.DocCategory;
|
|
|
|
|
import com.gunshi.project.ss.model.DocCenter;
|
|
|
|
|
import org.apache.ibatis.annotations.Mapper;
|
2026-02-02 16:48:43 +08:00
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
|
|
import org.apache.ibatis.annotations.Select;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
2026-01-04 14:45:09 +08:00
|
|
|
|
|
|
|
|
@Mapper
|
|
|
|
|
public interface DocCenterMapper extends BaseMapper<DocCenter> {
|
2026-02-02 16:48:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@Select("""
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT *,
|
|
|
|
|
ROW_NUMBER() OVER (
|
|
|
|
|
PARTITION BY group_id
|
|
|
|
|
ORDER BY doc_number DESC
|
|
|
|
|
) AS rn
|
|
|
|
|
FROM doc_center
|
|
|
|
|
WHERE doc_category_id = #{docCategoryId}
|
|
|
|
|
) AS ranked
|
|
|
|
|
WHERE rn = 1;
|
|
|
|
|
""")
|
|
|
|
|
List<DocCenter> latestDocCenter(@Param("docCategoryId") Long docCategoryId);
|
|
|
|
|
|
2026-01-04 14:45:09 +08:00
|
|
|
}
|