You've already forked FrameTour-BE
- 在 ProjectEntity 中添加 templateId 字段,用于绑定模板 - 在 ProjectReqQuery 和 ProjectRespVO 中添加 templateId 和 templateName 字段 - 修改 ProjectServiceImpl 中的查询方法,增加模板名称的查询和设置 - 更新 ProjectMapper.xml 中的 SQL语句,增加 template_id 相关操作
63 lines
2.3 KiB
XML
63 lines
2.3 KiB
XML
<?xml version="1.0" encoding="UTF-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, template_id, create_at, update_at)
|
|
values (#{scenicId}, #{name}, #{minPlayTime}, #{maxPlayTime}, #{status}, #{templateId}, now(), now())
|
|
</insert>
|
|
|
|
<update id="update">
|
|
update project set
|
|
`name` = #{name},
|
|
min_play_time = #{minPlayTime},
|
|
max_play_time = #{maxPlayTime},
|
|
status = #{status},
|
|
template_id = #{templateId},
|
|
update_at = now()
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="updateStatus">
|
|
update project
|
|
set status = (CASE
|
|
status
|
|
WHEN 1 THEN
|
|
0
|
|
WHEN 0 THEN
|
|
1
|
|
ELSE 1
|
|
END),
|
|
update_at = now()
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteById">
|
|
delete from project where id = #{id}
|
|
</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.template_id, p.create_at, p.update_at
|
|
from project p
|
|
<where>
|
|
<if test="scenicId != null">
|
|
and p.scenic_id = #{scenicId}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
and p.`name` like concat('%', #{name}, '%')
|
|
</if>
|
|
<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.template_id, p.create_at, p.update_at
|
|
from project p
|
|
where p.id = #{id}
|
|
</select>
|
|
</mapper> |