922 lines
47 KiB
XML
922 lines
47 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.ticket.mapper.ZdyTicketMapper">
|
|
|
|
<resultMap type = "ZdyTicket" id = "ZdyTicketResult">
|
|
<result property = "id" column = "id"/>
|
|
<result property = "name" column = "name"/>
|
|
<result property = "scenicId" column = "scenic_id"/>
|
|
<result property = "salesRice" column = "sales_rice"/>
|
|
<result property = "price" column = "price"/>
|
|
<result property = "image" column = "image"/>
|
|
<result property = "classify" column = "classify"/>
|
|
<result property = "groundingFlag" column = "grounding_flag"/>
|
|
<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 = "scenic_name"/>
|
|
<result property = "delFlag" column = "del_flag"/>
|
|
<result property = "inventory" column = "inventory"/>
|
|
<result property = "flag" column = "flag"/>
|
|
<result property = "minPrice" column = "minPrice"/>
|
|
<result property = "refundRule" column = "refund_rule"/>
|
|
<result property = "refundRuleName" column = "refundRuleName"/>
|
|
<result property = "isFee" column = "is_fee"/>
|
|
<result property = "classifyName" column = "classifyName"/>
|
|
<result property = "isOrder" column = "is_order"/>
|
|
<result property = "validityStartTime" column = "validity_start_time"/>
|
|
<result property = "validityEndTime" column = "validity_end_time"/>
|
|
<result property = "groupId" column = "group_id"/>
|
|
<result property = "bookingNotice" column = "booking_notice"/>
|
|
<result property = "beforeDay" column = "before_day"/>
|
|
<result property = "isOrderQuantity" column = "is_order_quantity"/>
|
|
<result property = "orderQuantity" column = "order_quantity"/>
|
|
<result property = "authenticationType" column = "authentication_type"/>
|
|
<result property = "verifySettings" column = "verify_settings"/>
|
|
<result property = "isPurchaseDate" column = "is_purchase_date"/>
|
|
<result property = "purchStartDate" column = "purch_start_date"/>
|
|
<result property = "purchEndDate" column = "purch_end_date"/>
|
|
<result property = "ticketValidityPeriod" column = "ticket_validity_period"/>
|
|
<result property = "buyPeriodDay" column = "buy_period_day"/>
|
|
<result property = "adjust" column = "adjust"/>
|
|
<result property = "groupName" column = "groupName"/>
|
|
<result property = "groupId" column = "group_id"/>
|
|
<result property = "classifyName" column = "classifyName"/>
|
|
<result property = "admissionAddress" column = "admission_address"/>
|
|
<result property = "admissionTime" column = "admission_time"/>
|
|
<result property = "sales" column = "sales"/>
|
|
<result property = "image11" column = "image11"/>
|
|
<result property = "image43" column = "image43"/>
|
|
<result property = "feeType" column = "fee_type"/>
|
|
<result property = "deductionFees" column = "deduction_fees"/>
|
|
<result property = "deductionFeesUnit" column = "deduction_fees_unit"/>
|
|
<result property = "refundDay" column = "refund_day"/>
|
|
<result property = "qrcodeRule" column = "qrcode_rule"/>
|
|
<result property = "isRefundCheck" column = "is_refund_check"/>
|
|
<result property = "isReservation" column = "is_reservation"/>
|
|
<result property = "applicablePeriod" column = "applicable_period"/>
|
|
<result property = "sort" column = "sort"/>
|
|
<result property = "saleResource" column = "sale_resource"/>
|
|
<result property = "isDelay" column = "is_delay"/>
|
|
<result property = "delayHour" column = "delay_hour"/>
|
|
<result property = "delayMinute" column = "delay_minute"/>
|
|
<result property = "isUnavailableTime" column = "is_unavailable_time"/>
|
|
<result property = "isSpecial" column = "is_special"/>
|
|
<result property = "specialType" column = "special_type"/>
|
|
<result property = "specialTicket" column = "special_ticket"/>
|
|
<result property = "yearOldStart" column = "year_old_start"/>
|
|
<result property = "yearOldEnd" column = "year_old_end"/>
|
|
<result property = "sex" column = "sex"/>
|
|
<result property = "specialAreaTicket" column = "special_area_ticket"/>
|
|
<result property = "deptId" column = "dept_id"/>
|
|
<result property = "isPurchaseTime" column = "is_purchase_time"/>
|
|
<result property = "purchStartTime" column = "purch_start_time"/>
|
|
<result property = "purchEndTime" column = "purch_end_time"/>
|
|
<result property = "isUnavailableHoliday" column = "is_unavailable_holiday"/>
|
|
<result property = "limitedPeople" column = "limited_people"/>
|
|
<result property = "otaResource" column = "ota_resource"/>
|
|
<result property = "agreement" column = "agreement"/>
|
|
<result property = "introduce" column = "introduce"/>
|
|
<result property = "childRestrictions" column = "child_restrictions"/>
|
|
<result property = "verificationMode" column = "verification_mode"/>
|
|
<result property = "activeMode" column = "active_mode"/>
|
|
<result property = "isLimitedActive" column = "is_limited_active"/>
|
|
<result property = "limitedActiveNum" column = "limited_active_num"/>
|
|
<result property="tags" column="tags"/>
|
|
<result property="purchaseReminder" column="purchase_reminder"/>
|
|
<result property="ticketSupplier" column="ticket_supplier"/>
|
|
<result property="pftScenicId" column="pft_scenic_id"/>
|
|
<result property="pftTicketId" column="pft_ticket_id"/>
|
|
<result property="pftSupplierId" column="pft_supplier_id"/>
|
|
<result property="pftPriceId" column="pft_price_id"/>
|
|
|
|
<collection property = "unavailableTimeList" javaType = "java.util.List" ofType = "ZdyTicketUnavailableTime"
|
|
select = "selectZdyTicketUnavailableTimeByTicketId" column = "id"/>
|
|
<collection property = "refundRuleList" javaType = "java.util.List" ofType = "ZdyTicketRefundRule"
|
|
select = "selectZdyTicketRefundRuleByTicketId" column = "id"/>
|
|
<collection property = "specialAreaList" javaType = "java.util.List" ofType = "ZdyTicketSpecialArea"
|
|
select = "selectZdyTicketSpecialAreaByTicketId" column = "id"/>
|
|
<collection property = "unavailableHolidayList" javaType = "java.util.List" ofType = "ZdyTicketUnavailableHoliday"
|
|
select = "selectZdyTicketUnavailableHolidayByTicketId" column = "id"/>
|
|
<collection property = "unavailableSpecialHolidayList" javaType = "java.util.List" ofType = "ZdyTicketUnavailableHoliday"
|
|
select = "selectUnavailableSpecialHolidayByTicketId" column = "id"/>
|
|
</resultMap>
|
|
|
|
<resultMap id = "ZdyTicketZdyTicketApplicablePeriodResult" type = "ZdyTicket" extends = "ZdyTicketResult">
|
|
<collection property = "periodList"
|
|
notNullColumn = "sub_id"
|
|
javaType = "java.util.List"
|
|
resultMap = "ZdyTicketApplicablePeriodResult"/>
|
|
</resultMap>
|
|
|
|
<resultMap type = "ZdyTicketApplicablePeriod" id = "ZdyTicketApplicablePeriodResult">
|
|
<result property = "id" column = "sub_id"/>
|
|
<result property = "ticketId" column = "sub_ticket_id"/>
|
|
<result property = "timeQuantum" column = "sub_time_quantum"/>
|
|
<result property = "inventory" column = "sub_inventory"/>
|
|
<result property = "price" column = "sub_price"/>
|
|
<result property = "isInventory" column = "sub_is_inventory"/>
|
|
<result property = "isPrice" column = "sub_is_price"/>
|
|
<result property = "playTime" column = "sub_play_time"/>
|
|
</resultMap>
|
|
|
|
<resultMap type = "ZdyTicketRefundRule" id = "ZdyTicketRefundRuleResult">
|
|
<result property = "id" column = "sub_id"/>
|
|
<result property = "ticketId" column = "sub_ticket_id"/>
|
|
<result property = "day" column = "sub_day"/>
|
|
<result property = "deductionFees" column = "sub_deduction_fees"/>
|
|
<result property = "deductionFeesUnit" column = "sub_deduction_fees_unit"/>
|
|
</resultMap>
|
|
|
|
<resultMap type = "ZdyTicketUnavailableTime" id = "ZdyTicketUnavailableTimeResult">
|
|
<result property = "id" column = "time_id"/>
|
|
<result property = "ticketId" column = "time_ticket_id"/>
|
|
<result property = "beginTime" column = "time_begin_time"/>
|
|
<result property = "endTime" column = "time_end_time"/>
|
|
</resultMap>
|
|
|
|
<resultMap type = "ZdyTicketSpecialArea" id = "ZdyTicketSpecialAreaResult">
|
|
<result property = "id" column = "area_id"/>
|
|
<result property = "ticketId" column = "area_ticket_id"/>
|
|
<result property = "provinceName" column = "area_province_name"/>
|
|
<result property = "cityName" column = "area_city_name"/>
|
|
<result property = "areaName" column = "area_area_name"/>
|
|
<result property = "provinceCode" column = "area_province_code"/>
|
|
<result property = "cityCode" column = "area_city_code"/>
|
|
<result property = "areaCode" column = "area_area_code"/>
|
|
</resultMap>
|
|
|
|
<resultMap type = "ZdyTicketUnavailableHoliday" id = "ZdyTicketUnavailableHolidayResult">
|
|
<result property = "id" column = "holiday_id"/>
|
|
<result property = "ticketId" column = "holiday_ticket_id"/>
|
|
<result property = "holidayId" column = "holiday_holiday_id"/>
|
|
<result property = "beginTime" column = "holiday_begin_time"/>
|
|
<result property = "endTime" column = "holiday_end_time"/>
|
|
<result property = "holidayName" column = "holiday_name"/>
|
|
<result property = "holidayDict" column = "holiday_holiday_dict"/>
|
|
<result property = "holidayType" column = "holiday_holiday_type"/>
|
|
</resultMap>
|
|
|
|
<select id = "selectZdyTicketUnavailableTimeByTicketId" parameterType = "Long" resultMap = "ZdyTicketUnavailableTimeResult">
|
|
select id as time_id, ticket_id as time_ticket_id, begin_time as time_begin_time, end_time as time_end_time
|
|
from zdy_ticket_unavailable_time
|
|
where ticket_id = #{id}
|
|
</select>
|
|
|
|
<select id = "selectZdyTicketRefundRuleByTicketId" parameterType = "Long" resultMap = "ZdyTicketRefundRuleResult">
|
|
select id as sub_id,
|
|
ticket_id as sub_ticket_id,
|
|
day as sub_day,
|
|
deduction_fees as sub_deduction_fees,
|
|
deduction_fees_unit as sub_deduction_fees_unit
|
|
from zdy_ticket_refund_rule
|
|
where ticket_id = #{id}
|
|
</select>
|
|
|
|
<select id = "selectZdyTicketUnavailableHolidayByTicketId" parameterType = "Long" resultMap = "ZdyTicketUnavailableHolidayResult">
|
|
select ztuh.id as holiday_id,
|
|
ztuh.holiday_id as holiday_holiday_id,
|
|
ztuh.holiday_dict as holiday_holiday_dict,
|
|
ztuh.holiday_type as holiday_holiday_type,
|
|
sdd.dict_label as holiday_name
|
|
from zdy_ticket_unavailable_holiday ztuh
|
|
left join sys_dict_data sdd on ztuh.holiday_dict = sdd.dict_value and sdd.dict_type='holiday_type'
|
|
where ztuh.ticket_id = #{id} and ztuh.holiday_type in ('1','2')
|
|
</select>
|
|
|
|
<select id = "selectUnavailableSpecialHolidayByTicketId" parameterType = "Long" resultMap = "ZdyTicketUnavailableHolidayResult">
|
|
select ztuh.id as holiday_id,
|
|
ztuh.ticket_id as holiday_ticket_id,
|
|
ztuh.holiday_id as holiday_holiday_id,
|
|
ztuh.holiday_dict as holiday_holiday_dict,
|
|
ztuh.begin_time as holiday_begin_time,
|
|
ztuh.end_time as holiday_end_time,
|
|
ztuh.holiday_type as holiday_holiday_type,
|
|
zhv.holiday_name
|
|
from zdy_ticket_unavailable_holiday ztuh
|
|
left join zdy_holiday_vacations zhv on ztuh.holiday_id = zhv.id
|
|
where ztuh.ticket_id = #{id} and ztuh.holiday_type ='3'
|
|
</select>
|
|
|
|
<select id = "selectZdyTicketSpecialAreaByTicketId" parameterType = "Long" resultMap = "ZdyTicketSpecialAreaResult">
|
|
select id as area_id,
|
|
ticket_id as area_ticket_id,
|
|
province_name as area_province_name,
|
|
city_name as area_city_name,
|
|
area_name as area_area_name,
|
|
province_code as area_province_code,
|
|
city_code as area_city_code,
|
|
area_code as area_area_code
|
|
from zdy_ticket_special_area
|
|
where ticket_id = #{id}
|
|
</select>
|
|
|
|
<sql id = "selectTicketVo">
|
|
SELECT ti.id,
|
|
ti.NAME,
|
|
gr.scenic_id,
|
|
ti.sales_rice,
|
|
ti.price,
|
|
ti.image,
|
|
ti.classify,
|
|
ti.grounding_flag,
|
|
ti.create_time,
|
|
ti.create_by,
|
|
ti.update_time,
|
|
ti.update_by,
|
|
ti.remark,
|
|
ti.del_flag,
|
|
ti.inventory,
|
|
ti.flag,
|
|
ti.refund_rule,
|
|
ti.is_fee,
|
|
scenic.scenic_name,
|
|
ti.is_order,
|
|
ti.validity_start_time,
|
|
ti.validity_end_time,
|
|
ti.booking_notice,
|
|
ti.group_id,
|
|
ti.before_day,
|
|
ti.is_order_quantity,
|
|
ti.order_quantity,
|
|
ti.authentication_type,
|
|
ti.verify_settings,
|
|
ti.is_delay,
|
|
ti.is_unavailable_time,
|
|
ti.delay_hour,
|
|
ti.delay_minute,
|
|
b.id AS sub_id,
|
|
b.ticket_id AS sub_ticket_id,
|
|
b.time_quantum AS sub_time_quantum,
|
|
b.inventory AS sub_inventory,
|
|
b.price AS sub_price,
|
|
b.is_inventory as sub_is_inventory,
|
|
b.is_price as sub_is_price,
|
|
b.play_time as sub_play_time,
|
|
ti.is_purchase_date,
|
|
ti.purch_start_date,
|
|
ti.purch_end_date,
|
|
ti.ticket_validity_period,
|
|
ti.buy_period_day,
|
|
gr.NAME AS groupName,
|
|
ti.classify,
|
|
ti.admission_address,
|
|
ti.admission_time,
|
|
ti.sales,
|
|
ti.image43,
|
|
ti.image11,
|
|
ti.fee_type,
|
|
ti.deduction_fees,
|
|
ti.deduction_fees_unit,
|
|
ti.refund_day,
|
|
ti.qrcode_rule,
|
|
ti.is_refund_check,
|
|
ti.is_reservation,
|
|
ti.applicable_period,
|
|
ti.sale_resource,
|
|
ti.sort,
|
|
ti.is_special,
|
|
ti.special_type,
|
|
ti.special_ticket,
|
|
ti.year_old_start,
|
|
ti.year_old_end,
|
|
ti.sex,
|
|
ti.special_area_ticket,
|
|
ti.dept_id,
|
|
ti.is_purchase_time,
|
|
ti.purch_start_time,
|
|
ti.purch_end_time,
|
|
ti.is_unavailable_holiday,
|
|
ti.limited_people,
|
|
ti.ota_resource,
|
|
ti.verification_mode,
|
|
ti.active_mode,
|
|
ti.is_limited_active,
|
|
ti.limited_active_num,
|
|
ti.tags,
|
|
ti.purchase_reminder,
|
|
ti.pft_ticket_flag,
|
|
ti.pft_ticket_id,
|
|
ti.pft_scenic_id,
|
|
ti.pft_supplier_id
|
|
FROM zdy_ticket ti
|
|
LEFT JOIN zdy_ticket_applicable_period b ON b.ticket_id = ti.id
|
|
LEFT JOIN zdy_ticket_group gr ON gr.id = ti.group_id
|
|
LEFT JOIN zdy_scenic scenic ON scenic.id = gr.scenic_id
|
|
</sql>
|
|
|
|
<sql id = "selectTicketPeriodVo">
|
|
SELECT ti.id,
|
|
ti.NAME,
|
|
ti.scenic_id,
|
|
ti.sales_rice,
|
|
ti.price,
|
|
ti.image,
|
|
ti.classify,
|
|
ti.grounding_flag,
|
|
ti.create_time,
|
|
ti.create_by,
|
|
ti.update_time,
|
|
ti.update_by,
|
|
ti.remark,
|
|
ti.del_flag,
|
|
ti.inventory,
|
|
ti.flag,
|
|
ti.refund_rule,
|
|
ti.is_fee,
|
|
ti.is_order,
|
|
ti.validity_start_time,
|
|
ti.validity_end_time,
|
|
ti.booking_notice,
|
|
ti.group_id,
|
|
ti.before_day,
|
|
ti.is_order_quantity,
|
|
ti.order_quantity,
|
|
ti.authentication_type,
|
|
ti.verify_settings,
|
|
ti.is_purchase_date,
|
|
ti.purch_start_date,
|
|
ti.purch_end_date,
|
|
ti.ticket_validity_period,
|
|
ti.buy_period_day,
|
|
ti.is_delay,
|
|
ti.delay_hour,
|
|
ti.delay_minute,
|
|
ti.is_unavailable_time,
|
|
ti.admission_address,
|
|
ti.admission_time,
|
|
ti.sales,
|
|
ti.image43,
|
|
ti.image11,
|
|
ti.fee_type,
|
|
ti.deduction_fees,
|
|
ti.deduction_fees_unit,
|
|
ti.refund_day,
|
|
ti.qrcode_rule,
|
|
ti.is_refund_check,
|
|
ti.is_reservation,
|
|
ti.applicable_period,
|
|
ti.sale_resource,
|
|
ti.sort,
|
|
ti.is_special,
|
|
ti.special_type,
|
|
ti.special_ticket,
|
|
ti.year_old_start,
|
|
ti.year_old_end,
|
|
ti.sex,
|
|
ti.special_area_ticket,
|
|
ti.dept_id,
|
|
ti.is_purchase_time,
|
|
ti.purch_start_time,
|
|
ti.purch_end_time,
|
|
ti.is_unavailable_holiday,
|
|
ti.limited_people,
|
|
ti.ota_resource,
|
|
ti.agreement,
|
|
ti.introduce,
|
|
ti.child_restrictions,
|
|
gr.name as groupName,
|
|
sc.scenic_name,
|
|
ti.verification_mode,
|
|
ti.active_mode,
|
|
ti.is_limited_active,
|
|
ti.limited_active_num,
|
|
ti.tags,
|
|
ti.purchase_reminder,
|
|
ti.ticket_supplier,
|
|
ti.pft_ticket_id,
|
|
ti.pft_scenic_id,
|
|
ti.pft_supplier_id,
|
|
ti.pft_price_id
|
|
FROM zdy_ticket ti
|
|
LEFT JOIN zdy_ticket_group gr ON gr.id = ti.group_id
|
|
left join zdy_scenic sc on ti.scenic_id = sc.id
|
|
</sql>
|
|
|
|
<select id = "selectZdyTicketList" parameterType = "ZdyTicket" resultMap = "ZdyTicketResult">
|
|
<include refid = "selectTicketPeriodVo"/>
|
|
left join sys_dept d on d.dept_id = ti.dept_id
|
|
<where>
|
|
ti.del_flag = 0
|
|
<if test = "ids != null and ids.size() != 0">
|
|
and ti.id in
|
|
<foreach item = "id" collection = "ids" open = "(" separator = "," close = ")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<if test = "name != null and name != ''">
|
|
and ti.name like concat('%', #{name}, '%')
|
|
</if>
|
|
<if test = "groundingFlag != null">
|
|
and ti.grounding_flag = #{groundingFlag}
|
|
</if>
|
|
<choose>
|
|
<when test = "classifyArray != null and classifyArray.length != 0">
|
|
and ti.classify in
|
|
<foreach item = "item" collection = "classifyArray" open = "(" separator = "," close = ")">
|
|
#{item}
|
|
</foreach>
|
|
</when>
|
|
<otherwise>
|
|
<if test = "classify != null and classify != ''">
|
|
and ti.classify = #{classify}
|
|
</if>
|
|
</otherwise>
|
|
</choose>
|
|
<if test = "groupId != null">
|
|
and ti.group_id = #{groupId}
|
|
</if>
|
|
<if test = "flag != null and flag != ''">
|
|
and ti.flag like concat('%', #{flag}, '%')
|
|
</if>
|
|
<if test = "isReservation != null">
|
|
and ti.is_reservation = #{isReservation}
|
|
</if>
|
|
<if test = "saleResource != null">
|
|
AND FIND_IN_SET( #{saleResource}, ti.sale_resource)
|
|
</if>
|
|
<if test = "scenicId != null">
|
|
and ti.scenic_id = #{scenicId}
|
|
</if>
|
|
<if test="playTime !=null">
|
|
and (
|
|
CASE WHEN ti.validity_end_time IS NOT NULL
|
|
THEN #{playTime} <= ti.validity_end_time
|
|
ELSE true END
|
|
)
|
|
</if>
|
|
<if test = "params.buyTime!=null">
|
|
and (ti.is_purchase_date = 0 or
|
|
(ti.purch_start_date <= DATE_FORMAT(#{params.buyTime}, '%Y-%m-%d %H:%i:%s')
|
|
and ti.purch_end_date >= DATE_FORMAT(#{params.buyTime}, '%Y-%m-%d %H:%i:%s')))
|
|
</if>
|
|
<if test="ticketSupplier !=null">
|
|
and ti.ticket_supplier = #{ticketSupplier}
|
|
</if>
|
|
${params.dataScope}
|
|
</where>
|
|
order by ti.id desc
|
|
</select>
|
|
|
|
<select id = "selectZdyTicketById" parameterType = "Long" resultMap = "ZdyTicketResult">
|
|
<include refid = "selectTicketPeriodVo"/>
|
|
where ti.id = #{id}
|
|
</select>
|
|
|
|
<insert id = "insertZdyTicket" parameterType = "ZdyTicket" useGeneratedKeys = "true" keyProperty = "id">
|
|
insert into zdy_ticket
|
|
<trim prefix = "(" suffix = ")" suffixOverrides = ",">
|
|
<if test = "name != null and name != ''">name,</if>
|
|
<if test = "scenicId != null">scenic_id,</if>
|
|
<if test = "salesRice != null">sales_rice,</if>
|
|
<if test = "price != null">price,</if>
|
|
<if test = "image != null">image,</if>
|
|
<if test = "classify != null">classify,</if>
|
|
<if test = "groundingFlag != null">grounding_flag,</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>
|
|
<if test = "delFlag != null">del_flag,</if>
|
|
<if test = "inventory != null">inventory,</if>
|
|
<if test = "flag != null">flag,</if>
|
|
<if test = "refundRule != null">refund_rule,</if>
|
|
<if test = "isFee != null">is_fee,</if>
|
|
<if test = "isOrder != null">is_order,</if>
|
|
<if test = "validityStartTime != null">validity_start_time,</if>
|
|
<if test = "validityEndTime != null">validity_end_time,</if>
|
|
<if test = "bookingNotice != null">booking_notice,</if>
|
|
<if test = "groupId != null">group_id,</if>
|
|
<if test = "beforeDay != null">before_day,</if>
|
|
<if test = "isOrderQuantity != null">is_order_quantity,</if>
|
|
<if test = "orderQuantity != null">order_quantity,</if>
|
|
<if test = "authenticationType != null">authentication_type,</if>
|
|
<if test = "verifySettings != null">verify_settings,</if>
|
|
<if test = "isPurchaseDate != null">is_purchase_date,</if>
|
|
<if test = "purchStartDate != null">purch_start_date,</if>
|
|
<if test = "purchEndDate != null">purch_end_date,</if>
|
|
<if test = "ticketValidityPeriod != null">ticket_validity_period,</if>
|
|
<if test = "buyPeriodDay != null">buy_period_day,</if>
|
|
<if test = "admissionTime != null">admission_time,</if>
|
|
<if test = "admissionAddress != null">admission_address,</if>
|
|
<if test = "sales != null">sales,</if>
|
|
<if test = "image11 != null">image11,</if>
|
|
<if test = "image43 != null">image43,</if>
|
|
<if test = "feeType != null">fee_type,</if>
|
|
<if test = "deductionFees != null">deduction_fees,</if>
|
|
<if test = "deductionFeesUnit != null">deduction_fees_unit,</if>
|
|
<if test = "refundDay != null">refund_day,</if>
|
|
<if test = "qrcodeRule != null">qrcode_rule,</if>
|
|
<if test = "isRefundCheck != null">is_refund_check,</if>
|
|
<if test = "isReservation != null">is_reservation,</if>
|
|
<if test = "applicablePeriod != null">applicable_period,</if>
|
|
<if test = "sort != null">sort,</if>
|
|
<if test = "saleResource != null">sale_resource,</if>
|
|
<if test = "isDelay != null">is_delay,</if>
|
|
<if test = "delayHour != null">delay_hour,</if>
|
|
<if test = "delayMinute != null">delay_minute,</if>
|
|
<if test = "isUnavailableTime != null">is_unavailable_time,</if>
|
|
<if test = "isSpecial != null">is_special,</if>
|
|
<if test = "specialType != null">special_type,</if>
|
|
<if test = "specialTicket != null">special_ticket,</if>
|
|
<if test = "yearOldStart != null">year_old_start,</if>
|
|
<if test = "yearOldEnd != null">year_old_end,</if>
|
|
<if test = "sex != null">sex,</if>
|
|
<if test = "specialAreaTicket != null">special_area_ticket,</if>
|
|
<if test = "deptId != null">dept_id,</if>
|
|
<if test = "isPurchaseTime != null">is_purchase_time,</if>
|
|
<if test = "purchStartTime != null">purch_start_time,</if>
|
|
<if test = "purchEndTime != null">purch_end_time,</if>
|
|
<if test = "isUnavailableHoliday != null">is_unavailable_holiday,</if>
|
|
<if test = "limitedPeople != null">limited_people,</if>
|
|
<if test = "otaResource != null">ota_resource,</if>
|
|
<if test = "agreement != null">agreement,</if>
|
|
<if test = "introduce != null">introduce,</if>
|
|
<if test = "childRestrictions != null">child_restrictions,</if>
|
|
<if test = "verificationMode != null">verification_mode,</if>
|
|
<if test = "activeMode != null">active_mode,</if>
|
|
<if test = "isLimitedActive != null">is_limited_active,</if>
|
|
<if test = "limitedActiveNum != null">limited_active_num,</if>
|
|
<if test="tags != null">tags,</if>
|
|
<if test="purchaseReminder != null and purchaseReminder != ''">purchase_reminder,</if>
|
|
<if test="ticketSupplier !=null and ticketSupplier !=''">ticket_supplier, </if>
|
|
<if test="pftTicketId !=null and pftTicketId !=''">pft_ticket_id,</if>
|
|
<if test="pftScenicId !=null and pftScenicId !=''">pft_scenic_id,</if>
|
|
<if test="pftSupplierId !=null and pftSupplierId !=''"> pft_supplier_id,</if>
|
|
<if test="pftPriceId !=null">pft_price_id,</if>
|
|
</trim>
|
|
<trim prefix = "values (" suffix = ")" suffixOverrides = ",">
|
|
<if test = "name != null and name != ''">#{name},</if>
|
|
<if test = "scenicId!= null">#{scenicId},</if>
|
|
<if test = "salesRice != null">#{salesRice},</if>
|
|
<if test = "price != null">#{price},</if>
|
|
<if test = "image != null">#{image},</if>
|
|
<if test = "classify != null">#{classify},</if>
|
|
<if test = "groundingFlag != null">#{groundingFlag},</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>
|
|
<if test = "delFlag != null">#{delFlag},</if>
|
|
<if test = "inventory != null">#{inventory},</if>
|
|
<if test = "flag != null">#{flag},</if>
|
|
<if test = "refundRule != null">#{refundRule},</if>
|
|
<if test = "isFee != null">#{isFee},</if>
|
|
<if test = "isOrder != null">#{isOrder},</if>
|
|
<if test = "validityStartTime != null">#{validityStartTime},</if>
|
|
<if test = "validityEndTime != null">#{validityEndTime},</if>
|
|
<if test = "bookingNotice != null">#{bookingNotice},</if>
|
|
<if test = "groupId != null">#{groupId},</if>
|
|
<if test = "beforeDay != null">#{beforeDay},</if>
|
|
<if test = "isOrderQuantity != null">#{isOrderQuantity},</if>
|
|
<if test = "orderQuantity != null">#{orderQuantity},</if>
|
|
<if test = "authenticationType != null">#{authenticationType},</if>
|
|
<if test = "verifySettings != null">#{verifySettings},</if>
|
|
<if test = "isPurchaseDate != null">#{isPurchaseDate},</if>
|
|
<if test = "purchStartDate != null">#{purchStartDate},</if>
|
|
<if test = "purchEndDate != null">#{purchEndDate},</if>
|
|
<if test = "ticketValidityPeriod != null">#{ticketValidityPeriod},</if>
|
|
<if test = "buyPeriodDay != null">#{buyPeriodDay},</if>
|
|
<if test = "admissionTime != null">#{admissionTime},</if>
|
|
<if test = "admissionAddress != null">#{admissionAddress},</if>
|
|
<if test = "sales != null">#{sales},</if>
|
|
<if test = "image11 != null">#{image11},</if>
|
|
<if test = "image43 != null">#{image43},</if>
|
|
<if test = "feeType != null">#{feeType},</if>
|
|
<if test = "deductionFees != null">#{deductionFees},</if>
|
|
<if test = "deductionFeesUnit != null">#{deductionFeesUnit},</if>
|
|
<if test = "refundDay != null">#{refundDay},</if>
|
|
<if test = "qrcodeRule != null">#{qrcodeRule},</if>
|
|
<if test = "isRefundCheck != null">#{isRefundCheck},</if>
|
|
<if test = "isReservation != null">#{isReservation},</if>
|
|
<if test = "applicablePeriod != null">#{applicablePeriod},</if>
|
|
<if test = "sort != null">#{sort},</if>
|
|
<if test = "saleResource != null">#{saleResource},</if>
|
|
<if test = "isDelay != null">#{isDelay},</if>
|
|
<if test = "delayHour != null">#{delayHour},</if>
|
|
<if test = "delayMinute != null">#{delayMinute},</if>
|
|
<if test = "isUnavailableTime != null">#{isUnavailableTime},</if>
|
|
<if test = "isSpecial != null">#{isSpecial},</if>
|
|
<if test = "specialType != null">#{specialType},</if>
|
|
<if test = "specialTicket != null">#{specialTicket},</if>
|
|
<if test = "yearOldStart != null">#{yearOldStart},</if>
|
|
<if test = "yearOldEnd != null">#{yearOldEnd},</if>
|
|
<if test = "sex != null">#{sex},</if>
|
|
<if test = "specialAreaTicket != null">#{specialAreaTicket},</if>
|
|
<if test = "deptId != null">#{deptId},</if>
|
|
<if test = "isPurchaseTime != null">#{isPurchaseTime},</if>
|
|
<if test = "purchStartTime != null">#{purchStartTime},</if>
|
|
<if test = "purchEndTime != null">#{purchEndTime},</if>
|
|
<if test = "isUnavailableHoliday != null">#{isUnavailableHoliday},</if>
|
|
<if test = "limitedPeople != null">#{limitedPeople},</if>
|
|
<if test = "otaResource != null">#{otaResource},</if>
|
|
<if test = "agreement != null">#{agreement},</if>
|
|
<if test = "introduce != null">#{introduce},</if>
|
|
<if test = "childRestrictions != null">#{childRestrictions},</if>
|
|
<if test = "verificationMode != null">#{verificationMode},</if>
|
|
<if test = "activeMode != null">#{activeMode},</if>
|
|
<if test = "isLimitedActive != null">#{isLimitedActive},</if>
|
|
<if test = "limitedActiveNum != null">#{limitedActiveNum},</if>
|
|
<if test="tags != null">#{tags},</if>
|
|
<if test="purchaseReminder != null and purchaseReminder != ''">#{purchaseReminder},</if>
|
|
<if test="ticketSupplier !=null and ticketSupplier !=''">#{ticketSupplier}, </if>
|
|
<if test="pftTicketId !=null and pftTicketId !=''">#{pftTicketId},</if>
|
|
<if test="pftScenicId !=null and pftScenicId !=''">#{pftScenicId},</if>
|
|
<if test="pftSupplierId !=null and pftSupplierId !=''"> #{pftSupplierId},</if>
|
|
<if test="pftPriceId !=null">#{pftPriceId},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id = "updateZdyTicket" parameterType = "ZdyTicket">
|
|
update zdy_ticket
|
|
<trim prefix = "SET" suffixOverrides = ",">
|
|
<if test = "name != null and name != ''">name = #{name},</if>
|
|
<if test = "scenicId != null">scenic_id = #{scenicId},</if>
|
|
<if test = "salesRice != null">sales_rice = #{salesRice},</if>
|
|
<if test = "price != null">price = #{price},</if>
|
|
<if test = "image != null">image = #{image},</if>
|
|
<if test = "classify != null">classify = #{classify},</if>
|
|
<if test = "groundingFlag != null">grounding_flag = #{groundingFlag},</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>
|
|
<if test = "delFlag != null">del_flag = #{delFlag},</if>
|
|
<if test = "inventory != null">inventory = #{inventory},</if>
|
|
flag = #{flag},
|
|
<if test = "refundRule != null and refundRule !='' ">refund_rule = #{refundRule},</if>
|
|
<if test = "isFee != null">is_fee = #{isFee},</if>
|
|
<if test = "isOrder != null">is_order = #{isOrder},</if>
|
|
<if test = "validityStartTime != null">validity_start_time = #{validityStartTime},</if>
|
|
<if test = "validityEndTime != null">validity_end_time = #{validityEndTime},</if>
|
|
<if test = "bookingNotice != null and bookingNotice !='' ">booking_notice = #{bookingNotice},</if>
|
|
<if test = "groupId != null">group_id = #{groupId},</if>
|
|
<if test = "beforeDay != null">before_day = #{beforeDay},</if>
|
|
<if test = "isOrderQuantity != null">is_order_quantity = #{isOrderQuantity},</if>
|
|
<if test = "orderQuantity != null">order_quantity = #{orderQuantity},</if>
|
|
<if test = "authenticationType != null">authentication_type = #{authenticationType},</if>
|
|
<if test = "verifySettings != null">verify_settings = #{verifySettings},</if>
|
|
<if test = "isPurchaseDate != null">is_purchase_date = #{isPurchaseDate},</if>
|
|
<if test = "purchStartDate != null">purch_start_date = #{purchStartDate},</if>
|
|
<if test = "purchEndDate != null">purch_end_date = #{purchEndDate},</if>
|
|
<if test = "ticketValidityPeriod != null">ticket_validity_period = #{ticketValidityPeriod},</if>
|
|
<if test = "buyPeriodDay != null">buy_period_day = #{buyPeriodDay},</if>
|
|
<if test = "admissionAddress != null">admission_address = #{admissionAddress},</if>
|
|
<if test = "admissionTime != null">admission_time = #{admissionTime},</if>
|
|
<if test = "sales != null">sales = #{sales},</if>
|
|
<if test = "image11 != null">image11 = #{image11},</if>
|
|
<if test = "image43 != null">image43 = #{image43},</if>
|
|
<if test = "feeType != null">fee_type = #{feeType},</if>
|
|
<if test = "deductionFees != null">deduction_fees = #{deductionFees},</if>
|
|
<if test = "deductionFeesUnit != null">deduction_fees_unit = #{deductionFeesUnit},</if>
|
|
<if test = "refundDay != null">refund_day = #{refundDay},</if>
|
|
<if test = "qrcodeRule != null">qrcode_rule = #{qrcodeRule},</if>
|
|
<if test = "isRefundCheck != null">is_refund_check = #{isRefundCheck},</if>
|
|
<if test = "isReservation != null">is_reservation = #{isReservation},</if>
|
|
<if test = "applicablePeriod != null">applicable_period = #{applicablePeriod},</if>
|
|
<if test = "sort != null">sort = #{sort},</if>
|
|
<if test = "saleResource != null">sale_resource = #{saleResource},</if>
|
|
<if test = "isDelay != null">is_delay =#{isDelay},</if>
|
|
<if test = "delayHour != null">delay_hour =#{delayHour},</if>
|
|
<if test = "delayMinute != null">delay_minute =#{delayMinute},</if>
|
|
<if test = "isUnavailableTime != null">is_unavailable_time =#{isUnavailableTime},</if>
|
|
<if test = "isSpecial != null">is_special =#{isSpecial},</if>
|
|
<if test = "specialType != null">special_type =#{specialType},</if>
|
|
<if test = "specialTicket != null">special_ticket =#{specialTicket},</if>
|
|
<if test = "yearOldStart != null">year_old_start =#{yearOldStart},</if>
|
|
<if test = "yearOldEnd != null">year_old_end =#{yearOldEnd},</if>
|
|
<if test = "sex != null">sex =#{sex},</if>
|
|
<if test = "specialAreaTicket != null">special_area_ticket =#{specialAreaTicket},</if>
|
|
<if test = "deptId != null">dept_id =#{deptId},</if>
|
|
<if test = "isPurchaseTime != null">is_purchase_time =#{isPurchaseTime},</if>
|
|
<if test = "purchStartTime != null">purch_start_time =#{purchStartTime},</if>
|
|
<if test = "purchEndTime != null">purch_end_time =#{purchEndTime},</if>
|
|
<if test = "isUnavailableHoliday != null">is_unavailable_holiday =#{isUnavailableHoliday},</if>
|
|
<if test = "limitedPeople != null">limited_people =#{limitedPeople},</if>
|
|
<if test = "otaResource != null">ota_resource =#{otaResource},</if>
|
|
<if test = "agreement != null">agreement =#{agreement},</if>
|
|
<if test = "introduce != null">introduce =#{introduce},</if>
|
|
<if test = "childRestrictions != null">child_restrictions = #{childRestrictions},</if>
|
|
<if test = "verificationMode != null">verification_mode = #{verificationMode},</if>
|
|
<if test = "activeMode != null">active_mode = #{activeMode},</if>
|
|
<if test = "isLimitedActive != null">is_limited_active = #{isLimitedActive},</if>
|
|
<if test = "limitedActiveNum != null">limited_active_num = #{limitedActiveNum},</if>
|
|
<if test="tags != null">tags = #{tags},</if>
|
|
<if test="purchaseReminder != null and purchaseReminder != ''">purchase_reminder = #{purchaseReminder},</if>
|
|
<if test="ticketSupplier !=null and ticketSupplier !=''">ticket_supplier = #{ticketSupplier}, </if>
|
|
<if test="pftTicketId !=null">pft_ticket_id = #{pftTicketId},</if>
|
|
<if test="pftScenicId !=null">pft_scenic_id = #{pftScenicId},</if>
|
|
<if test="pftSupplierId !=null"> pft_supplier_id = #{pftSupplierId},</if>
|
|
<if test="pftPriceId !=null"> pft_price_id = #{pftPriceId},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id = "deleteZdyTicketById" parameterType = "Long">
|
|
update zdy_ticket
|
|
set del_flag = 1
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
<delete id = "deleteZdyTicketByIds" parameterType = "String">
|
|
update zdy_ticket set del_flag = 1 where id in
|
|
<foreach item = "id" collection = "array" open = "(" separator = "," close = ")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id = "selectZdyTicketByScenicId" parameterType = "ZdyTicket" resultMap = "ZdyTicketResult">
|
|
SELECT t.id, t.NAME, t.scenic_id, t.sales_rice, t.price, t.image, t.grounding_flag, t.inventory, t.flag,
|
|
t.refund_rule, t.is_order, t.validity_start_time, t.validity_end_time, t.classify, t.before_day,
|
|
t.is_order_quantity, t.order_quantity, t.authentication_type, t.verify_settings, t.booking_notice,
|
|
t.admission_address, t.admission_time, t.sales, t.is_purchase_date, t.purch_start_date, t.purch_end_date,
|
|
t.image43, t.image11, t.refund_day, t.fee_type, t.deduction_fees, t.deduction_fees_unit, t.qrcode_rule,
|
|
sc.adjust, gr.name as groupName, t.group_id, t.is_reservation, t.applicable_period, t.sort, t.sale_resource,
|
|
t.is_delay, t.delay_hour, t.delay_minute, t.is_unavailable_time, t.dept_id, t.is_special,
|
|
t.special_type, t.special_ticket, t.year_old_start, t.year_old_end, t.sex, t.special_area_ticket,
|
|
t.is_purchase_time, t.purch_start_time, t.purch_end_time, t.is_unavailable_holiday, t.limited_people,
|
|
t.ota_resource,t.verification_mode,t.active_mode,t.is_limited_active, t.limited_active_num,t.tags,t.purchase_reminder,
|
|
t.ticket_supplier,t.pft_ticket_id,t.pft_scenic_id,t.pft_supplier_id,
|
|
sc.scenic_name
|
|
FROM zdy_ticket t LEFT JOIN zdy_ticket_group gr ON gr.id = t.group_id LEFT JOIN zdy_scenic sc ON
|
|
sc.id = gr.scenic_id
|
|
WHERE t.del_flag = 0 AND t.grounding_flag = 1 and t.classify !='6'
|
|
and (CASE WHEN t.validity_end_time IS NOT NULL THEN sysdate() <= t.validity_end_time ELSE true END)
|
|
<if test="scenicId != null and scenicId != ''">
|
|
and t.scenic_id = #{scenicId}
|
|
</if>
|
|
<if test="flag != null and flag != ''">
|
|
AND FIND_IN_SET( #{flag}, t.flag)
|
|
</if>
|
|
<if test="saleResource != null and saleResource != ''">
|
|
AND FIND_IN_SET( #{saleResource}, t.sale_resource)
|
|
</if>
|
|
<if test="authenticationType != null and authenticationType != ''">
|
|
AND t.authentication_type = #{authenticationType}
|
|
</if>
|
|
order by sort
|
|
</select>
|
|
|
|
<select id = "selectCountByScenicId" parameterType = "Long" resultType = "decimal">
|
|
SELECT IFNULL(min(ti.sales_rice), 0) AS minPrice
|
|
FROM zdy_ticket ti
|
|
LEFT JOIN zdy_ticket_group gr ON gr.id = ti.group_id
|
|
WHERE gr.scenic_id = #{scenicId}
|
|
AND ti.del_flag = 0
|
|
AND ti.grounding_flag = 1
|
|
</select>
|
|
|
|
<select id = "existsTicketNameWithGroupId" resultType = "java.lang.Integer">
|
|
SELECT EXISTS(SELECT 1 FROM zdy_ticket WHERE del_flag = 0 and group_id = #{groupId} and name = #{name}
|
|
<if test = "id != null">
|
|
and id != #{id}
|
|
</if>)
|
|
</select>
|
|
|
|
<select id = "hasTicketsInGroup" parameterType = "java.lang.Long" resultType = "java.lang.Long">
|
|
SELECT DISTINCT(group_id) FROM zdy_ticket WHERE del_flag = 0 AND group_id IN
|
|
<foreach item = "id" collection = "array" open = "(" separator = "," close = ")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id = "selectTicketByIds" resultType = "map" parameterType = "String">
|
|
SELECT ti.id , ti.`name` as ticketName, ti.image, ti.image11, ti.image43, ti.booking_notice as bookingNotice,
|
|
ti.sales_rice AS salesRice, ti.classify, ti.refund_rule as refundRule, ti.refund_day as refundDay,
|
|
ti.qrcode_rule as qrcodeRule FROM zdy_ticket ti WHERE ti.del_flag = '0' AND ti.id IN
|
|
<foreach item = "id" collection = "array" open = "(" separator = "," close = ")">
|
|
#{id}
|
|
</foreach>
|
|
order by ti.id desc
|
|
</select>
|
|
|
|
<update id = "updateZdyTicketSales" parameterType = "com.zhwl.ticket.domain.dto.TicketSalesDTO">
|
|
update zdy_ticket set sales = sales + #{sales}
|
|
<if test = "inventory != null">
|
|
,inventory = inventory - #{inventory}
|
|
</if>
|
|
where id = #{ticketId}
|
|
</update>
|
|
|
|
<!--查询是否已关联套票-->
|
|
<select id = "queryIsLinkTicket" parameterType = "Long" resultType = "Boolean">
|
|
SELECT EXISTS
|
|
(SELECT ticket_id
|
|
FROM zdy_ticket_child
|
|
WHERE child_ticket_id = #{ticketId})
|
|
</select>
|
|
|
|
<select id = "listNamesByIds" resultMap = "ZdyTicketResult">
|
|
select id, name from zdy_ticket where id in
|
|
<foreach item = "id" collection = "list" open = "(" separator = "," close = ")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id = "selectZdyTicketListByScenicId" parameterType = "long" resultMap = "ZdyTicketResult">
|
|
select id, name,grounding_flag,pft_ticket_id
|
|
from zdy_ticket
|
|
where scenic_id = #{scenicId}
|
|
and del_flag = '0'
|
|
</select>
|
|
|
|
<select id = "selectTicketListByIds" resultMap = "ZdyTicketResult">
|
|
select * from zdy_ticket
|
|
<where>
|
|
del_flag = '0'
|
|
<if test = "ids != null and ids.size() != 0">
|
|
and id in
|
|
<foreach item = "id" collection = "ids" open = "(" separator = "," close = ")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id = "getCouponTicketList" parameterType = "ZdyTicket" resultMap = "ZdyTicketResult">
|
|
<include refid = "selectTicketPeriodVo"/>
|
|
left join sys_dept d on d.dept_id = ti.dept_id
|
|
LEFT JOIN sys_user_role sur on sur.user_id=ti.create_by
|
|
LEFT JOIN sys_role sr on sur.role_id=sr.role_id
|
|
<where>
|
|
ti.del_flag = 0 and (CASE WHEN validity_end_time IS NOT NULL THEN sysdate()
|
|
<= validity_end_time ELSE true END)
|
|
and sr.role_key='yyAdmin'
|
|
<choose>
|
|
<when test = "classifyArray != null and classifyArray.length != 0">
|
|
and ti.classify in
|
|
<foreach item = "item" collection = "classifyArray" open = "(" separator = "," close = ")">
|
|
#{item}
|
|
</foreach>
|
|
</when>
|
|
<otherwise>
|
|
<if test = "classify != null and classify != ''">
|
|
and ti.classify = #{classify}
|
|
</if>
|
|
</otherwise>
|
|
</choose>
|
|
<if test="name != null and name != ''">
|
|
and ti.name like concat('%', #{name}, '%')
|
|
</if>
|
|
<if test="groupId != null">
|
|
and ti.group_id = #{groupId}
|
|
</if>
|
|
<if test="scenicId != null">
|
|
and ti.scenic_id = #{scenicId}
|
|
</if>
|
|
${params.dataScope}
|
|
group by ti.id
|
|
</where>
|
|
order by ti.id desc
|
|
</select>
|
|
|
|
|
|
<select id="queryNearScenicRecommendTicket" parameterType="ZdyTicket" resultMap = "ZdyTicketResult">
|
|
select t.*, ROUND(ST_DISTANCE_SPHERE(
|
|
POINT(substr(s.coordinate, 1, instr(s.coordinate, ',') - 1),
|
|
substr(s.coordinate, instr(s.coordinate, ',') + 1)),
|
|
POINT(#{params.longitude}, #{params.latitude})) / 1000, 2) distance
|
|
from zdy_ticket t
|
|
left join zdy_scenic s on t.scenic_id = s.id
|
|
where t.del_flag = '0'
|
|
order by ISNULL(distance),distance
|
|
</select>
|
|
<select id="selectByIdForUpdate" resultMap = "ZdyTicketResult">
|
|
select * from zdy_ticket where id in
|
|
<foreach collection="list" open="(" close=")" separator="," item="id">
|
|
#{id}
|
|
</foreach>
|
|
for update
|
|
</select>
|
|
<update id = "updateZdyTicketGroupingFlag" parameterType = "ZdyTicket">
|
|
update zdy_ticket set grounding_flag = #{groundingFlag}
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<select id="listTicketsByChildDataScope" parameterType="ZdyTicket" resultMap="ZdyTicketResult">
|
|
SELECT id,
|
|
`name`
|
|
FROM zdy_ticket zt
|
|
LEFT JOIN (SELECT DISTINCT ticket_id
|
|
FROM zdy_ticket_child ztc_tmp
|
|
LEFT JOIN zdy_ticket zt_tmp on zt_tmp.id = ztc_tmp.child_ticket_id
|
|
<where>
|
|
${params.dataScope}
|
|
</where>
|
|
) ztc on ztc.ticket_id = zt.id
|
|
<where>
|
|
classify = #{classify}
|
|
AND del_flag = 0
|
|
</where>
|
|
</select>
|
|
<select id="selectByPftTicketId" resultMap="ZdyTicketResult">
|
|
select * from zdy_ticket where pft_ticket_id = #{pftTicketId} and del_flag = 0
|
|
</select>
|
|
</mapper>
|