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

31 lines
1.7 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.artificer.dao.CollectArtificerDao">
<select id="selectArtificerListByCollectUserId" resultType="com.sqx.modules.artificer.entity.Artificer">
select a.*,u.consortia_id as consortiaId,(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 collect_artificer o where o.artificer_id=a.artificer_id and classify=1) as collectCount,
(select count(*) from taking_commnt c where c.artificer_id=a.artificer_id ) as commentCount,
(st_distance (point (a.longitude, a.latitude),point(#{longitude},#{latitude}) ) *111195) as distance,c.consortia_name
from artificer a
left join tb_user u on u.user_id=a.user_id
left join consortia c on u.consortia_id = c.consortia_id
where
a.artificer_id in (select artificer_id from collect_artificer where user_id=#{userId} and classify=1)
order by a.create_time desc
</select>
<select id="selectCountByUserId" resultType="Integer">
select count(*) from collect_artificer
where artificer_id=#{artificerId}
<if test="startTime!=null and startTime!=''">
and date_format(create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime!=''">
and date_format(create_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
</if>
</select>
</mapper>