zhwl/zhwl-business/zhwl-check-point/target/classes/mapper/check/point/ZdyCheckPointMapper.xml
2025-07-01 17:54:58 +08:00

158 lines
5.5 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.zhwl.check.point.mapper.ZdyCheckPointMapper">
<resultMap type="ZdyCheckPoint" id="ZdyCheckPointResult">
<result property="id" column="id"/>
<result property="pointName" column="point_name"/>
<result property="freeTicketType" column="free_ticket_type"/>
<result property="age" column="age"/>
<result property="cardSegment" column="card_segment"/>
<result property="frequency" column="frequency"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="deptId" column="dept_id"/>
<result property="scenicId" column="scenic_id"/>
<result property="scenicName" column="scenic_name"/>
</resultMap>
<sql id="selectZdyCheckPointVo">
select cp.id,
cp.point_name,
cp.free_ticket_type,
cp.age,
cp.card_segment,
cp.frequency,
cp.create_time,
cp.create_by,
cp.update_time,
cp.update_by,
cp.dept_id,
cp.scenic_id,
zs.scenic_name
from zdy_check_point cp
left join zdy_scenic zs on zs.id = cp.scenic_id
</sql>
<select id="selectZdyCheckPointList" parameterType="ZdyCheckPoint" resultMap="ZdyCheckPointResult">
<include refid="selectZdyCheckPointVo"/>
left join sys_dept d on d.dept_id = cp.dept_id
<where>
<if test="pointName != null and pointName != ''">
and point_name like concat('%', #{pointName}, '%')
</if>
<if test="freeTicketType != null and freeTicketType != ''">
and free_ticket_type = #{freeTicketType}
</if>
<if test="age != null ">
and age = #{age}
</if>
<if test="cardSegment != null and cardSegment != ''">
and card_segment = #{cardSegment}
</if>
<if test="frequency != null ">
and frequency = #{frequency}
</if>
${params.dataScope}
</where>
</select>
<select id="selectZdyCheckPointById" parameterType="Long"
resultMap="ZdyCheckPointResult">
<include refid="selectZdyCheckPointVo"/>
where cp.id = #{id}
</select>
<insert id="insertZdyCheckPoint" parameterType="ZdyCheckPoint" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_check_point
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="pointName != null">point_name,
</if>
<if test="freeTicketType != null">free_ticket_type,
</if>
<if test="age != null">age,
</if>
<if test="cardSegment != null">card_segment,
</if>
<if test="frequency != null">frequency,
</if>
<if test="createBy != null">create_by,
</if>
<if test="deptId != null">dept_id,
</if>
<if test="scenicId != null">scenic_id,
</if>
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="pointName != null">#{pointName},
</if>
<if test="freeTicketType != null">#{freeTicketType},
</if>
<if test="age != null">#{age},
</if>
<if test="cardSegment != null">#{cardSegment},
</if>
<if test="frequency != null">#{frequency},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="deptId != null">#{deptId},
</if>
<if test="scenicId != null">#{scenicId},
</if>
sysdate(),
</trim>
</insert>
<update id="updateZdyCheckPoint" parameterType="ZdyCheckPoint">
update zdy_check_point
<trim prefix="SET" suffixOverrides=",">
<if test="pointName != null">point_name =
#{pointName},
</if>
<if test="freeTicketType != null">free_ticket_type =
#{freeTicketType},
</if>
<if test="age != null">age =
#{age},
</if>
<if test="cardSegment != null">card_segment =
#{cardSegment},
</if>
<if test="frequency != null">frequency =
#{frequency},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="deptId != null">dept_id =
#{deptId},
</if>
<if test="scenicId != null">scenic_id =
#{scenicId},
</if>
update_time = sysdate(),
</trim>
where id = #{id}
</update>
<delete id="deleteZdyCheckPointById" parameterType="Long">
delete
from zdy_check_point
where id = #{id}
</delete>
<delete id="deleteZdyCheckPointByIds" parameterType="String">
delete from zdy_check_point where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>