sadjv3_java/src/main/resources/mapper/artificer/ArtificerDao.xml

223 lines
10 KiB
XML
Raw Normal View History

2024-06-05 19:12:15 +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.sqx.modules.artificer.dao.ArtificerDao">
<select id="selectArtificerList" resultType="com.sqx.modules.artificer.entity.Artificer">
2024-06-15 20:39:41 +08:00
select * from (select a.*,u.phone,s.code as classifyName,u.status as artificerStatus,u.consortia_id,c.consortia_name,
2024-06-05 19:12:15 +08:00
(select count(*) from collect_artificer o where o.artificer_id=a.artificer_id and classify=1) as collectCount,
(select count(*) from orders o where o.artificer_id=a.artificer_id and o.status in (3,5)) as ordersCount,
ifnull((select avg(c.score) from taking_commnt c where c.artificer_id=a.artificer_id ),0.00) as ordersScore,
(select count(*) from taking_commnt c where c.artificer_id=a.artificer_id ) as commentCount,
2024-06-15 20:39:41 +08:00
(st_distance (point (a.longitude, a.latitude),point(#{longitude},#{latitude}) ) *111195) as distance,
2024-06-20 16:41:00 +08:00
v.vip_name as technicianTypeName,v.rate as technicianTypeRate ,(CASE WHEN DATEDIFF(CURDATE(), a.create_time) &lt;=7 THEN 1 ELSE 2 END) AS isNewer
2024-06-05 19:12:15 +08:00
from artificer a
left join tb_user u on a.user_id=u.user_id
left join sys_dict s on s.id=a.classify_id
2024-06-15 20:39:41 +08:00
left join vip_details v on a.technician_type = v.vip_name_type and v.vip_type = 1
left join consortia c on u.consortia_id = c.consortia_id
2024-06-05 19:12:15 +08:00
where u.is_authentication=2
<if test="status!=null and status!=0 and status!=-1">
and a.status=#{status}
</if>
2024-06-14 10:37:42 +08:00
<if test="isStart!=null and isStart!=0">
and a.is_start=#{isStart}
</if>
2024-06-05 19:12:15 +08:00
<if test="classifyId!=null and classifyId!=0">
and classify_id=#{classifyId}
</if>
2024-06-21 14:07:12 +08:00
<if test="technicianType!=null and technicianType!=0">
and a.technician_type=#{technicianType}
</if>
2024-06-05 19:12:15 +08:00
<if test="massageTypeId!=null">
and a.artificer_id in (select artificer_id from artificer_massage where massage_type_id =#{massageTypeId})
</if>
<if test="artificerName!=null and artificerName!=''">
and artificer_name like concat('%',#{artificerName},'%')
</if>
<if test="city!=null and city!=''">
and a.city=#{city}
</if>
<if test="phone!=null and phone!=''">
and u.phone=#{phone}
</if>
<if test="authentication!=null">
and u.is_authentication=2
</if>
<if test="user!=null">
and a.longitude is not null and a.latitude is not null
</if>
) b
<if test="by!=null and by==1">
order by
<if test="status!=null and status==-1">
status asc,
</if>
distance asc
</if>
<if test="by!=null and by==2">
order by
<if test="status!=null and status==-1">
status asc,
</if>
distance asc
</if>
<if test="by!=null and by==3">
order by
<if test="status!=null and status==-1">
status asc,
</if>
artificer_sales desc
</if>
<if test="by!=null and by==4">
order by
<if test="status!=null and status==-1">
status asc,
</if>
credit_score desc
</if>
</select>
<select id="selectArtificerById" resultType="com.sqx.modules.artificer.entity.Artificer">
2024-06-15 20:39:41 +08:00
select a.*,u.phone,u.status as artificerStatus,u.consortia_id as consortiaId,c.consortia_name,
2024-06-05 19:12:15 +08:00
(select count(*) from orders o where o.artificer_id = a.artificer_id and o.status in (3,5)) as ordersCount,
2024-06-15 20:39:41 +08:00
(select code from sys_dict o where o.id = a.classify_id) as classifyName,
(select count(*) from collect_artificer o where o.artificer_id = a.artificer_id and classify = 1) as collectCount,
(select count(*) from collect_artificer o where o.artificer_id = a.artificer_id and o.user_id = #{userId} and classify = 1) as myCollectCount,
ifnull((select avg(c.score) from taking_commnt c where c.artificer_id = a.artificer_id), 0.00) as ordersScore,
(st_distance(point(a.longitude, a.latitude), point(#{longitude}, #{latitude})) * 111195) as distance,
2024-06-20 16:41:00 +08:00
v.vip_name as technicianTypeName,v.rate as technicianTypeRate ,(CASE WHEN DATEDIFF(CURDATE(), a.create_time) &lt;=7 THEN 1 ELSE 2 END) AS isNewer
2024-06-05 19:12:15 +08:00
from artificer a
2024-06-15 20:39:41 +08:00
left join tb_user u on a.user_id = u.user_id
left join sys_dict s on s.id=a.classify_id
left join vip_details v on a.technician_type = v.vip_name_type and v.vip_type = 1
left join consortia c on u.consortia_id = c.consortia_id
2024-06-05 19:12:15 +08:00
where a.artificer_id = #{artificerId}
</select>
<select id="selectArtificerByUserId" resultType="com.sqx.modules.artificer.entity.Artificer">
select a.*,
(select count(*) from orders o where o.artificer_id = a.artificer_id and o.status in (3,5)) as ordersCount,
ifnull((select avg(c.score) from taking_commnt c where c.artificer_id = a.artificer_id),
0.00) as ordersScore
from artificer a
left join tb_user u on a.user_id = u.user_id
where a.user_id = #{artificerId}
</select>
<select id="selectArtificerByStatus" resultType="int">
select count(*)
from artificer_massage
where artificer_id = #{userId}
and status = #{status}
</select>
<select id="selectArtificerMoneyList" resultType="Map">
select * from (
select ifnull(sum(o.artificer_money),0.00) as money,count(*) as counts,o.artificer_id as artificerId,a.artificer_name as
artificerName,a.user_id as userId
from artificer a
left join orders o on a.artificer_id=o.artificer_id
where o.`status` in (3,5)
<if test="title!=null and title!=''">
and massage_type_id in (select massage_type_id from massage_type where title like concat('%',#{title},'%'))
</if>
<if test="startTime!=null and startTime!=''">
and date_format(end_times,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime!=''">
and date_format(end_times,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
</if>
<if test="classifyId !=null and classifyId!=''">
and massage_type_id in (select massage_type_id from massage_type where classify_id =#{classifyId})
</if>
group by o.artificer_id
) a order by money desc
</select>
<select id="selectUserListByConsortiaId" resultType="com.sqx.modules.artificer.entity.Artificer">
select a.*,u.phone,
u.status as artificerStatus,
(select count(*) from collect_artificer o where o.artificer_id=a.artificer_id and classify=1) as collectCount,
(select count(*) from orders o where o.artificer_id=a.artificer_id and o.status in (3,5)) as ordersCount,
ifnull((select avg(c.score) from taking_commnt c where c.artificer_id=a.artificer_id ),0.00) as ordersScore,
(select count(*) from taking_commnt c where c.artificer_id=a.artificer_id ) as commentCount,
(select ifnull(sum(o.shop_money),0.00) as money from orders o
where o.shop_user_id=#{shopId}
and o.artificer_id=(select artificer_id from artificer a where a.user_id=u.user_id)
and status in (3,5)
<if test="flag!=null and flag==1">
and date_format(o.end_times,'%Y-%m-%d')=date_format(#{time},'%Y-%m-%d')
</if>
<if test="flag!=null and flag==2">
and date_format(o.end_times,'%Y-%m')=date_format(#{time},'%Y-%m')
</if>
<if test="flag!=null and flag==3">
and date_format(o.end_times,'%Y')=date_format(#{time},'%Y')
</if>
) as money
from tb_user u
left join artificer a on a.user_id=u.user_id
where u.consortia_id=#{consortiaId} and u.is_shop is null and a.artificer_id is not null
<if test="userName!=null and userName!=''">
and u.user_name like concat('%',#{userName},'%')
</if>
<if test="phone!=null and phone!=''">
and u.phone like concat('%',#{phone},'%')
</if>
order by u.create_time desc
</select>
<select id="selectArtificerMassageDuration" resultType="java.lang.Integer">
SELECT
t.duration
FROM
artificer_massage m
LEFT JOIN massage_type t ON t.massage_type_id = m.massage_type_id
WHERE
m.artificer_id = #{artificerId}
AND t.STATUS = 1
AND t.parent_id = "0"
ORDER BY
t.duration DESC
LIMIT 1
2024-06-14 10:37:42 +08:00
</select>
2024-06-05 19:12:15 +08:00
2024-06-14 10:37:42 +08:00
<select id="getHomeStartArtificerList" resultType="com.sqx.modules.artificer.entity.Artificer">
2024-06-15 20:39:41 +08:00
select a.artificer_id,artificer_name,artificer_img,s.code as classifyName,a.content,v.vip_name as technicianTypeName,a.city
2024-06-14 10:37:42 +08:00
from artificer a
inner join tb_user u on a.user_id=u.user_id
inner join sys_dict s on s.id=a.classify_id
2024-06-15 20:39:41 +08:00
left join vip_details v on a.technician_type = v.vip_name_type and v.vip_type = 1
2024-06-14 10:37:42 +08:00
where u.is_authentication=2
<if test="status!=null and status!=0 and status!=-1">
2024-06-15 20:39:41 +08:00
and u.status=#{status}
2024-06-14 10:37:42 +08:00
</if>
<if test="isStart!=null and isStart!=0">
and a.is_start=#{isStart}
</if>
<if test="city!=null and city!=''">
and a.city=#{city}
</if>
2024-06-15 20:39:41 +08:00
order by artificer_sales desc
2024-06-05 19:12:15 +08:00
</select>
2024-06-19 21:11:16 +08:00
<select id="getYxjsList" resultType="com.sqx.modules.artificer.entity.Artificer">
select a.* from artificer a
inner join tb_user u on a.user_id=u.user_id
where u.status = 1
2024-06-21 13:13:14 +08:00
and yn_jfgz = 1
2024-06-19 21:11:16 +08:00
</select>
2024-06-20 21:41:15 +08:00
<select id="selectInlineList" resultType="com.sqx.modules.artificer.entity.Artificer">
select a.* from artificer a
inner join tb_user u on a.user_id=u.user_id
where u.status = 1
<if test="status">
and a.status = ${status}
</if>
</select>
2024-06-05 19:12:15 +08:00
</mapper>