Files
FrameTour-BE/src/main/resources/mapper/PriceConfigMapper.xml
Jerry Yan 5a89a7c60a feat(service): 批量获取景区和设备信息
- 在 DeviceRepository 中添加批量获取设备信息的方法
- 在 ScenicRepository 中添加批量获取景区信息的方法
- 修改 OrderServiceImpl,使用批量方法获取景区名称
- 移除多个 mapper 文件中冗余的景区信息查询
2025-09-07 01:42:38 +08:00

66 lines
2.4 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.PriceConfigMapper">
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
insert into price_config (scenic_id, type, goods_ids, price, slash_price, create_time, update_time)
values (#{scenicId}, #{type}, #{goodsIds}, #{price}, #{slashPrice}, now(), now())
</insert>
<update id="update">
update price_config
<set>
<if test="scenicId != null">scenic_id = #{scenicId},</if>
<if test="type != null">type = #{type},</if>
<if test="goodsIds != null">goods_ids = #{goodsIds},</if>
<if test="price != null">price = #{price},</if>
<if test="slashPrice != null">slash_price = #{slashPrice},</if>
update_time = now()
</set>
where id = #{id}
</update>
<update id="updateStatus">
update price_config
set `status` = IF(`status` = 0, 1, 0),
update_time = now()
where id = #{id}
</update>
<delete id="deleteById">
delete from price_config where id = #{id}
</delete>
<select id="getById" resultType="com.ycwl.basic.model.pc.price.resp.PriceConfigRespVO">
select p.* from price_config p
where p.id = #{id}
</select>
<select id="listByCondition" resultType="com.ycwl.basic.model.pc.price.resp.PriceConfigRespVO">
select p.* from price_config p
<where>
<if test="req.scenicId != null">
and p.scenic_id = #{req.scenicId}
</if>
<if test="req.type != null">
and p.type = #{req.type}
</if>
<if test="req.goodsId != null">
and p.goods_ids like concat('%', #{req.goodsId}, '%')
</if>
<if test="req.status != null">
and p.status = #{req.status}
</if>
</where>
</select>
<select id="getPriceByScenicTypeGoods" resultType="com.ycwl.basic.model.pc.price.entity.PriceConfigEntity">
select * from price_config
where scenic_id = #{scenicId}
and type = #{type} and status = 1
<if test="goodsId != null and goodsId != ''">
and goods_ids like concat('%', #{goodsId}, '%')
</if>
</select>
</mapper>