sadjv3_java/src/main/resources/mapper/bl/order/UserPackageDao.xml

153 lines
4.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.sqx.modules.bl.order.dao.UserPackageDao">
<select id="findList" resultType="com.sqx.modules.bl.order.entity.UserPackage">
select
id,
user_id,
package_id,
orders_id,
orders_no,
create_time,
status,
title,
type,
old_price,
price,
package_img,
content,
content_img,
labels,
city,
classify_id
from bl_user_package
where orders_id = #{ordersId}
order by id
</select>
<select id="findListByMapping" resultType="com.sqx.modules.bl.order.entity.UserPackage">
select
a.id,
a.title,
a.type,
a.old_price,
a.price,
a.package_img,
a.content,
a.content_img,
a.labels,
a.city,
a.classify_id
from bl_massage_package a inner join bl_user_package_order_mapping b on a.id = b.package_id
where b.orders_id = #{ordersId}
order by a.id
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="com.sqx.modules.bl.order.entity.UserPackage">
insert into bl_user_package(
user_id,
package_id,
orders_id,
orders_no,
create_time,
title,
type,
old_price,
price,
package_img,
content,
content_img,
labels,
city,
classify_id
)values(
#{userId},
#{packageId},
#{ordersId},
#{ordersNo},
#{createTime},
#{title},
#{type},
#{oldPrice},
#{price},
#{packageImg},
#{content},
#{contentImg},
#{labels},
#{city},
#{classifyId}
)
</insert>
<update id="updateStatusByOrder">
update bl_user_package
set status = #{status}
where orders_id = #{ordersId}
</update>
<select id="findMyPackageList" resultType="com.sqx.modules.bl.order.entity.UserPackage">
select
a.id,
a.user_id,
a.package_id,
a.orders_id,
a.orders_no,
a.create_time,
a.status,
a.title,
a.type,
a.old_price,
a.price,
a.package_img,
a.content,
a.content_img,
a.labels,
a.city,
a.classify_id,
b.value as classifyName,
c.sales,
c.esteem_rate,
(select count(*) from bl_user_package_detail d where d.main_id = a.id) as service_count
from bl_user_package a
left join sys_dict b on a.classify_id = b.id and b.type="服务类型"
left join bl_massage_package c on a.package_id = c.id
where a.user_id = #{params.userId}
and a.type = #{params.type}
<if test="params.title!=null and params.title!=''">
and a.title like concat('%',#{params.title},'%')
</if>
order by a.id desc
</select>
<select id="getMyPackageById" resultType="com.sqx.modules.bl.order.entity.UserPackage">
select
a.id,
a.user_id,
a.package_id,
a.orders_id,
a.orders_no,
a.create_time,
a.status,
a.title,
a.type,
a.old_price,
a.price,
a.package_img,
a.content,
a.content_img,
a.labels,
a.city,
a.classify_id,
b.value as classifyName,
c.sales,
c.esteem_rate,
(select count(*) from bl_user_package_detail d where d.main_id = a.id) as service_count
from bl_user_package a
left join sys_dict b on a.classify_id = b.id and b.type="服务类型"
left join bl_massage_package c on a.package_id = c.id
where a.id = #{id}
</select>
</mapper>