查询有招聘会的日期列表

This commit is contained in:
2026-01-13 17:22:08 +08:00
parent beeaa0e6b3
commit 2d11855b56
6 changed files with 32 additions and 42 deletions

View File

@@ -74,23 +74,19 @@
--- ---
## 3. 按年份查询每日招聘会数量 ## 3. 查询有招聘会的日期列表
根据年份查询该年每天的招聘会数量,支持跨天招聘会统计如招聘会时间为1月12日-14日则12、13、14日都会统计)。 获取所有有招聘会的日期列表支持跨天招聘会如招聘会时间为1月12日-14日则12、13、14日都会返回)。
**请求方式:** `GET` **请求方式:** `GET`
**请求路径:** `/dailyCount/{year}` **请求路径:** `/dates`
**路径参数:** **请求参数:**
| 参数名 | 类型 | 必填 | 说明 |
|-------|------|-----|------|
| year | Integer | 是 | 年份,如 2026 |
**请求示例:** **请求示例:**
``` ```
GET /app/jobfair/public/jobfair/dailyCount/2026 GET /app/jobfair/public/jobfair/dates
``` ```
**响应示例:** **响应示例:**
@@ -99,26 +95,23 @@ GET /app/jobfair/public/jobfair/dailyCount/2026
"code": 200, "code": 200,
"msg": "操作成功", "msg": "操作成功",
"data": [ "data": [
{ "date": "2026-01-03", "count": 1 }, "2026-01-03",
{ "date": "2026-01-05", "count": 1 }, "2026-01-05",
{ "date": "2026-01-07", "count": 2 }, "2026-01-07",
{ "date": "2026-01-15", "count": 1 }, "2026-01-11",
{ "date": "2026-01-16", "count": 1 }, "2026-01-15",
{ "date": "2026-02-05", "count": 1 }, "2026-01-16",
{ "date": "2026-02-12", "count": 1 }, "2026-01-25",
{ "date": "2026-02-13", "count": 1 }, "2026-01-26",
{ "date": "2026-02-14", "count": 1 } "2026-02-05",
"2026-02-10",
"2026-02-12",
"2026-02-13",
"2026-02-14"
] ]
} }
``` ```
**响应字段说明:**
| 字段名 | 类型 | 说明 |
|-------|------|------|
| date | String | 日期,格式 yyyy-MM-dd |
| count | Integer | 当天招聘会数量 |
--- ---
## 公共字段说明 ## 公共字段说明

View File

@@ -82,12 +82,12 @@ public class PublicJobFairController extends BaseController {
} }
/** /**
* 按年份查询每日招聘会数量 * 查询有招聘会的日期列表
*/ */
@BussinessLog(title = "按年份查询每日招聘会数量") @BussinessLog(title = "查询有招聘会的日期列表")
@ApiOperation("按年份查询每日招聘会数量") @ApiOperation("查询有招聘会的日期列表")
@GetMapping("/dailyCount/{year}") @GetMapping("/dates")
public AjaxResult dailyCountByYear(@ApiParam("年份") @PathVariable Integer year) { public AjaxResult getJobFairDates() {
return success(publicJobFairService.getDailyCountByYear(year)); return success(publicJobFairService.getJobFairDates());
} }
} }

View File

@@ -48,9 +48,9 @@ public interface PublicJobFairMapper extends BaseMapper<PublicJobFair> {
List<PublicJobFair> getCurrentMonthFairs(); List<PublicJobFair> getCurrentMonthFairs();
/** /**
* 按年份查询每日招聘会数量 * 查询有招聘会的日期列表
*/ */
List<JobFairDailyCountVO> getDailyCountByYear(@Param("year") Integer year); List<String> getJobFairDates();
// ========== CMS后台管理接口 ========== // ========== CMS后台管理接口 ==========

View File

@@ -35,9 +35,9 @@ public interface IPublicJobFairService {
List<PublicJobFair> getCurrentMonthFairs(); List<PublicJobFair> getCurrentMonthFairs();
/** /**
* 按年份查询每日招聘会数量 * 查询有招聘会的日期列表
*/ */
List<JobFairDailyCountVO> getDailyCountByYear(Integer year); List<String> getJobFairDates();
// ========== CMS后台管理接口 ========== // ========== CMS后台管理接口 ==========

View File

@@ -114,8 +114,8 @@ public class PublicJobFairServiceImpl implements IPublicJobFairService {
} }
@Override @Override
public List<JobFairDailyCountVO> getDailyCountByYear(Integer year) { public List<String> getJobFairDates() {
return publicJobFairMapper.getDailyCountByYear(year); return publicJobFairMapper.getJobFairDates();
} }
// ========== CMS后台管理接口实现 ========== // ========== CMS后台管理接口实现 ==========

View File

@@ -251,9 +251,8 @@
order by job_fair_start_time desc order by job_fair_start_time desc
</select> </select>
<select id="getDailyCountByYear" resultType="com.ruoyi.cms.domain.rc.JobFairDailyCountVO"> <select id="getJobFairDates" resultType="java.lang.String">
SELECT TO_CHAR(d.date, 'YYYY-MM-DD') AS date, SELECT DISTINCT TO_CHAR(d.date, 'YYYY-MM-DD') AS date
COUNT(*) AS count
FROM public_job_fair f, FROM public_job_fair f,
generate_series( generate_series(
DATE_TRUNC('day', f.job_fair_start_time), DATE_TRUNC('day', f.job_fair_start_time),
@@ -261,8 +260,6 @@
'1 day'::interval '1 day'::interval
) AS d(date) ) AS d(date)
WHERE f.del_flag = '0' WHERE f.del_flag = '0'
AND TO_CHAR(d.date, 'YYYY') = CAST(#{year} AS VARCHAR)
GROUP BY TO_CHAR(d.date, 'YYYY-MM-DD')
ORDER BY date ORDER BY date
</select> </select>