zhwl/zhwl-business/zhwl-ticket/target/classes/mapper/ticket/ZdyTicketGroupMapper.xml

201 lines
7.0 KiB
XML
Raw Normal View History

2025-07-01 17:54:58 +08:00
<?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.ticket.mapper.ZdyTicketGroupMapper">
<resultMap type="ZdyTicketGroup" id="ZdyTicketGroupResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="scenicId" column="scenic_id"/>
<result property="orgCode" column="org_code"/>
<result property="classify" column="classify"/>
<result property="delFlag" column="del_flag"/>
<result property="sort" column="sort"/>
<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="remark" column="remark"/>
<result property="scenicName" column="scenicName"/>
<result property="deptId" column="dept_id"/>
</resultMap>
<sql id="selectZdyTicketGroupVo">
SELECT
gr.id,
gr.dept_id,
gr.NAME,
gr.scenic_id,
gr.org_code,
gr.classify,
gr.del_flag,
gr.sort,
gr.create_time,
gr.create_by,
gr.update_time,
gr.update_by,
gr.remark,
sc.scenic_name AS scenicName
FROM
zdy_ticket_group gr
LEFT JOIN zdy_scenic sc ON sc.id = gr.scenic_id
left join sys_dept d on gr.dept_id = d.dept_id
</sql>
<select id="selectZdyTicketGroupList" parameterType="ZdyTicketGroup" resultMap="ZdyTicketGroupResult">
<include refid="selectZdyTicketGroupVo"/>
<where>
gr.del_flag = 0
<if test="name != null and name != ''">
and gr.name like concat('%', #{name}, '%')
</if>
<if test="scenicId != null ">
and gr.scenic_id = #{scenicId}
</if>
<if test="orgCode != null and orgCode != ''">
and gr.org_code = #{orgCode}
</if>
<if test="classify != null and classify != ''">
and gr.classify = #{classify}
</if>
<if test="sort != null ">
and gr.sort = #{sort}
</if>
${params.dataScope}
</where>
<if test="params.orderby != null and params.orderway != null">
order by gr.${params.orderby} ${params.orderway}
</if>
</select>
<select id="selectZdyTicketGroupById" parameterType="Long"
resultMap="ZdyTicketGroupResult">
<include refid="selectZdyTicketGroupVo"/>
where gr.id = #{id}
</select>
<insert id="insertZdyTicketGroup" parameterType="ZdyTicketGroup" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_ticket_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,
</if>
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="scenicId != null">scenic_id,
</if>
<if test="orgCode != null">org_code,
</if>
<if test="classify != null">classify,
</if>
<if test="delFlag != null">del_flag,
</if>
<if test="sort != null">sort,
</if>
<if test="createTime != null">create_time,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="remark != null">remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},
</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="scenicId != null">#{scenicId},
</if>
<if test="orgCode != null">#{orgCode},
</if>
<if test="classify != null">#{classify},
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="sort != null">#{sort},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="remark != null">#{remark},
</if>
</trim>
</insert>
<update id="updateZdyTicketGroup" parameterType="ZdyTicketGroup">
update zdy_ticket_group
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name =
#{name},
</if>
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="scenicId != null">scenic_id =
#{scenicId},
</if>
<if test="orgCode != null">org_code =
#{orgCode},
</if>
<if test="classify != null">classify =
#{classify},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="sort != null">sort =
#{sort},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="remark != null">remark =
#{remark},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyTicketGroupById" parameterType="Long">
update
zdy_ticket_group
set del_flag = '1'
where id = #{id}
</delete>
<delete id="deleteZdyTicketGroupByIds" parameterType="String">
update
zdy_ticket_group
set del_flag = '1'
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="existsTicketGroupWithScenicId" resultType="java.lang.Integer">
SELECT EXISTS(SELECT 1 FROM zdy_ticket_group WHERE del_flag = '0' and scenic_id = #{scenicId} and name = #{name}
<if test="id != null">
and id != #{id}
</if>)
</select>
<select id="selectByScenicId" resultMap="ZdyTicketGroupResult">
SELECT * FROM zdy_ticket_group where scenic_id = #{scenicId}
</select>
</mapper>