feat(project): 增加项目模板关联功能

- 在 ProjectEntity 中添加 templateId 字段,用于绑定模板
- 在 ProjectReqQuery 和 ProjectRespVO 中添加 templateId 和 templateName 字段
- 修改 ProjectServiceImpl 中的查询方法,增加模板名称的查询和设置
- 更新 ProjectMapper.xml 中的 SQL语句,增加 template_id 相关操作
This commit is contained in:
2025-09-16 01:27:40 +08:00
parent f8c7cc2db6
commit dcd5a8f930
5 changed files with 86 additions and 7 deletions

View File

@@ -2,8 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycwl.basic.mapper.ProjectMapper">
<insert id="add">
insert into project(scenic_id, `name`, min_play_time, max_play_time, status, create_at, update_at)
values (#{scenicId}, #{name}, #{minPlayTime}, #{maxPlayTime}, #{status}, now(), now())
insert into project(scenic_id, `name`, min_play_time, max_play_time, status, template_id, create_at, update_at)
values (#{scenicId}, #{name}, #{minPlayTime}, #{maxPlayTime}, #{status}, #{templateId}, now(), now())
</insert>
<update id="update">
@@ -12,6 +12,7 @@
min_play_time = #{minPlayTime},
max_play_time = #{maxPlayTime},
status = #{status},
template_id = #{templateId},
update_at = now()
where id = #{id}
</update>
@@ -35,7 +36,7 @@
</delete>
<select id="list" resultType="com.ycwl.basic.model.pc.project.resp.ProjectRespVO">
select p.id, p.scenic_id, p.`name`, p.min_play_time, p.max_play_time, p.status, p.create_at, p.update_at
select p.id, p.scenic_id, p.`name`, p.min_play_time, p.max_play_time, p.status, p.template_id, p.create_at, p.update_at
from project p
<where>
<if test="scenicId != null">
@@ -47,12 +48,15 @@
<if test="status != null">
and p.`status` = #{status}
</if>
<if test="templateId != null">
and p.template_id = #{templateId}
</if>
</where>
order by p.create_at desc
</select>
<select id="getById" resultType="com.ycwl.basic.model.pc.project.resp.ProjectRespVO">
select p.id, p.scenic_id, p.`name`, p.min_play_time, p.max_play_time, p.status, p.create_at, p.update_at
select p.id, p.scenic_id, p.`name`, p.min_play_time, p.max_play_time, p.status, p.template_id, p.create_at, p.update_at
from project p
where p.id = #{id}
</select>