| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- <?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.ylx.massage.mapper.MaTechnicianMapper">
- <resultMap type="MaTechnician" id="MaTechnicianResult">
- <result property="id" column="id" />
- <result property="teName" column="te_name" />
- <result property="teNickName" column="te_nick_name" />
- <result property="teSex" column="te_sex" />
- <result property="tePhone" column="te_phone" />
- <result property="teAddress" column="te_address" />
- <result property="teAreaCode" column="te_area_code" />
- <result property="teAge" column="te_age" />
- <result property="teAvatar" column="te_avatar" />
- <result property="openService" column="openService" />
- <result property="lifePhotos" column="life_photos" />
- <result property="avatar" column="avatar" />
- <result property="teBrief" column="te_brief" />
- <result property="serviceState" column="service_state" />
- <result property="nStatus2" column="n_status2" />
- <result property="merchantStatus" column="merchant_status" />
- <result property="postState" column="post_state" />
- <result property="techType" column="tech_type" />
- <result property="teIsEnable" column="te_is_enable" />
- <result property="auditStatus" column="audit_status" />
- <result property="createUser" column="create_user" />
- <result property="updateUser" column="update_user" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="isDelete" column="is_delete" />
- <result property="nStar" column="n_star" />
- <result property="nNum" column="n_num" />
- <result property="isRecommend" column="is_recommend" />
- </resultMap>
- <sql id="selectMaTechnicianVo">
- select id, te_name, te_nick_name, te_sex, te_phone, te_address, te_area_code, te_age, te_avatar,
- openService, life_photos, avatar, te_brief, service_state, ns_status2, merchant_status,
- post_state, tech_type, te_is_enable, audit_status, create_user, update_user, create_time,
- update_time, is_delete, n_star, n_num, is_recommend
- from ma_technician
- </sql>
- <select id="selectMaTechnicianList" parameterType="MaTechnician" resultMap="MaTechnicianResult">
- <include refid="selectMaTechnicianVo"/>
- <where>
- <if test="teName != null and teName != ''"> and te_name like concat('%', #{teName}, '%')</if>
- <if test="teNickName != null and teNickName != ''"> and te_nick_name like concat('%', #{teNickName}, '%')</if>
- <if test="teSex != null "> and te_sex = #{teSex}</if>
- <if test="tePhone != null and tePhone != ''"> and te_phone = #{tePhone}</if>
- <if test="teAddress != null and teAddress != ''"> and te_address = #{teAddress}</if>
- <if test="openService != null "> and openService = #{openService}</if>
- <if test="teAge != null "> and te_age = #{teAge}</if>
- <if test="teAvatar != null and teAvatar != ''"> and te_avatar = #{teAvatar}</if>
- <if test="lifePhotos != null and lifePhotos != ''"> and life_photos = #{lifePhotos}</if>
- <if test="teBrief != null and teBrief != ''"> and te_brief = #{teBrief}</if>
- <if test="serviceState != null "> and service_state = #{serviceState}</if>
- <if test="nsStatus2 != null "> and ns_status2 = #{nsStatus2}</if>
- <if test="merchantStatus != null and merchantStatus != ''"> and merchant_status = #{merchantStatus}</if>
- <if test="postState != null "> and post_state = #{postState}</if>
- <if test="techType != null "> and tech_type = #{techType}</if>
- <if test="teIsEnable != null "> and te_is_enable = #{teIsEnable}</if>
- <if test="auditStatus != null "> and audit_status = #{auditStatus}</if>
- <if test="isRecommend != null "> and is_recommend = #{isRecommend}</if>
- <if test="createUser != null "> and create_user = #{createUser}</if>
- <if test="updateUser != null "> and update_user = #{updateUser}</if>
- <if test="isDelete != null "> and is_delete = #{isDelete}</if>
- </where>
- </select>
- <select id="selectMaTechnicianById" parameterType="Long" resultMap="MaTechnicianResult">
- <include refid="selectMaTechnicianVo"/>
- where id = #{id}
- </select>
- <insert id="insertMaTechnician" parameterType="MaTechnician" useGeneratedKeys="true" keyProperty="id">
- insert into ma_technician
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="teName != null and teName != ''">te_name,</if>
- <if test="teNickName != null and teNickName != ''">te_nick_name,</if>
- <if test="teSex != null">te_sex,</if>
- <if test="tePhone != null and tePhone != ''">te_phone,</if>
- <if test="teAddress != null">te_address,</if>
- <if test="teAreaCode != null and teAreaCode != ''">te_area_code,</if>
- <if test="teAge != null">te_age,</if>
- <if test="teAvatar != null and teAvatar != ''">te_avatar,</if>
- <if test="openService != null">openService,</if>
- <if test="teProject != null and teProject != ''">te_project,</if>
- <if test="lifePhotos != null and lifePhotos != ''">life_photos,</if>
- <if test="avatar != null and avatar != ''">avatar,</if>
- <if test="teBrief != null and teBrief != ''">te_brief,</if>
- <if test="serviceState != null">service_state,</if>
- <if test="nStatus2 != null">n_status2,</if>
- <if test="merchantStatus != null and merchantStatus != ''">merchant_status,</if>
- <if test="postState != null">post_state,</if>
- <if test="techType != null">tech_type,</if>
- <if test="teIsEnable != null">te_is_enable,</if>
- <if test="auditStatus != null">audit_status,</if>
- <if test="createBy != null">create_by,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="isDelete != null">is_delete,</if>
- <if test="nStar != null">n_star,</if>
- <if test="nNum != null">n_num,</if>
- <if test="isRecommend != null">is_recommend,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="teName != null and teName != ''">#{teName},</if>
- <if test="teNickName != null and teNickName != ''">#{teNickName},</if>
- <if test="teSex != null">#{teSex},</if>
- <if test="tePhone != null and tePhone != ''">#{tePhone},</if>
- <if test="teAddress != null">#{teAddress},</if>
- <if test="teAreaCode != null and teAreaCode != ''">#{teAreaCode},</if>
- <if test="teAge != null">#{teAge},</if>
- <if test="teAvatar != null and teAvatar != ''">#{teAvatar},</if>
- <if test="openService != null">#{openService},</if>
- <if test="teProject != null and teProject != ''">#{teProject},</if>
- <if test="lifePhotos != null and lifePhotos != ''">#{lifePhotos},</if>
- <if test="avatar != null and avatar != ''">#{avatar},</if>
- <if test="teBrief != null and teBrief != ''">#{teBrief},</if>
- <if test="serviceState != null">#{serviceState},</if>
- <if test="nStatus2 != null">#{nStatus2},</if>
- <if test="merchantStatus != null and merchantStatus != ''">#{merchantStatus},</if>
- <if test="postState != null">#{postState},</if>
- <if test="techType != null">#{techType},</if>
- <if test="teIsEnable != null">#{teIsEnable},</if>
- <if test="auditStatus != null">#{auditStatus},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="isDelete != null">#{isDelete},</if>
- <if test="nStar != null">#{nStar},</if>
- <if test="nNum != null">#{nNum},</if>
- <if test="isRecommend != null">#{isRecommend},</if>
- </trim>
- </insert>
- <update id="updateMaTechnician" parameterType="MaTechnician">
- update ma_technician
- <trim prefix="SET" suffixOverrides=",">
- <if test="teName != null and teName != ''">te_name = #{teName},</if>
- <if test="teNickName != null and teNickName != ''">te_nick_name = #{teNickName},</if>
- <if test="teSex != null">te_sex = #{teSex},</if>
- <if test="tePhone != null and tePhone != ''">te_phone = #{tePhone},</if>
- <if test="teAddress != null and teAddress != ''">te_address = #{teAddress},</if>
- <if test="teAreaCode != null and teAreaCode != ''">te_area_code = #{teAreaCode},</if>
- <if test="teAge != null">te_age = #{teAge},</if>
- <if test="teAvatar != null and teAvatar != ''">te_avatar = #{teAvatar},</if>
- <if test="openService != null">openService = #{openService},</if>
- <if test="lifePhotos != null and lifePhotos != ''">life_photos = #{lifePhotos},</if>
- <if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
- <if test="teBrief != null and teBrief != ''">te_brief = #{teBrief},</if>
- <if test="serviceState != null">service_state = #{serviceState},</if>
- <if test="nsStatus2 != null">ns_status2 = #{nsStatus2},</if>
- <if test="merchantStatus != null and merchantStatus != ''">merchant_status = #{merchantStatus},</if>
- <if test="postState != null">post_state = #{postState},</if>
- <if test="techType != null">tech_type = #{techType},</if>
- <if test="teIsEnable != null">te_is_enable = #{teIsEnable},</if>
- <if test="auditStatus != null">audit_status = #{auditStatus},</if>
- <if test="createUser != null">create_user = #{createUser},</if>
- <if test="updateUser != null">update_user = #{updateUser},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="isDelete != null">is_delete = #{isDelete},</if>
- <if test="nStar != null">n_star = #{nStar},</if>
- <if test="nNum != null">n_num = #{nNum},</if>
- <if test="isRecommend != null">is_recommend = #{isRecommend},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteMaTechnicianById" parameterType="Long">
- delete from ma_technician where id = #{id}
- </delete>
- <delete id="deleteMaTechnicianByIds" parameterType="String">
- delete from ma_technician where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <resultMap type="com.ylx.massage.domain.vo.MaTechnicianMerchantListVO" id="MaTechnicianMerchantListResult">
- <result property="merchantId" column="merchant_id"/>
- <result property="teName" column="te_name"/>
- <result property="teNickName" column="te_nick_name"/>
- <result property="teSex" column="te_sex"/>
- <result property="teSexName" column="te_sex_name"/>
- <result property="teAvatar" column="te_avatar"/>
- <result property="tePhone" column="te_phone"/>
- <result property="nStar" column="n_star"/>
- <result property="serviceState" column="service_state"/>
- <result property="serviceStateName" column="service_state_name"/>
- <result property="nNum" column="n_num"/>
- <result property="onlineTime" column="online_time"/>
- <result property="teProject" column="te_project"/>
- <result property="postState" column="post_state"/>
- <result property="isRecommend" column="is_recommend"/>
- <result property="techType" column="tech_type"/>
- <result property="techTypeName" column="tech_type_name"/>
- <result property="merchantStatus" column="merchant_status"/>
- <result property="merchantStatusName" column="merchant_status_name"/>
- <result property="createTime" column="create_time"/>
- </resultMap>
- <select id="selectMerchantList" resultMap="MaTechnicianMerchantListResult">
- SELECT
- t.id AS merchant_id,
- t.te_name,
- t.te_nick_name,
- t.te_sex,
- CASE t.te_sex
- WHEN 0 THEN '女'
- WHEN 1 THEN '男'
- ELSE ''
- END AS te_sex_name,
- t.te_avatar,
- t.te_phone,
- t.n_star,
- t.service_state,
- CASE t.service_state
- WHEN 0 THEN '服务中'
- WHEN 1 THEN '待接单'
- WHEN 2 THEN '休息中'
- ELSE ''
- END AS service_state_name,
- t.n_num,
- IFNULL(sign_data.online_time, 0) AS online_time,
- t.te_project,
- t.post_state,
- t.is_recommend,
- t.tech_type,
- CASE t.tech_type
- WHEN 0 THEN '正式用户'
- WHEN 1 THEN '虚拟用户'
- ELSE ''
- END AS tech_type_name,
- t.merchant_status,
- CASE t.merchant_status
- WHEN '0' THEN '正常'
- WHEN '1' THEN '限制接单'
- WHEN '2' THEN '冻结'
- WHEN '3' THEN '注销'
- ELSE ''
- END AS merchant_status_name,
- t.create_time
- FROM ma_technician t
- LEFT JOIN (
- SELECT js_id, SUM(IFNULL(online_time, 0)) AS online_time
- FROM t_sign
- WHERE is_delete = 0
- GROUP BY js_id
- ) sign_data ON sign_data.js_id = t.id
- <where>
- t.is_delete = 0
- <if test="dto != null">
- <!-- 商户姓名 -->
- <if test="dto.teName != null and dto.teName != ''">
- AND t.te_name LIKE CONCAT('%', #{dto.teName}, '%')
- </if>
- <!-- 商户昵称 -->
- <if test="dto.teNickName != null and dto.teNickName != ''">
- AND t.te_nick_name LIKE CONCAT('%', #{dto.teNickName}, '%')
- </if>
- <!-- 服务类目 -->
- <if test="dto.openService != null">
- AND t.openService = #{dto.openService}
- </if>
- <!-- 手机号 -->
- <if test="dto.tePhone != null and dto.tePhone != ''">
- AND t.te_phone LIKE CONCAT('%', #{dto.tePhone}, '%')
- </if>
- <!-- 注册开始时间 -->
- <if test="dto.beginCreateTime != null and dto.beginCreateTime != ''">
- AND t.create_time >= #{dto.beginCreateTime}
- </if>
- <!-- 注册结束时间 -->
- <if test="dto.endCreateTime != null and dto.endCreateTime != ''">
- AND t.create_time <= #{dto.endCreateTime}
- </if>
- <!-- 上架状态 -->
- <if test="dto.postState != null">
- AND t.post_state = #{dto.postState}
- </if>
- <!-- 性别 -->
- <if test="dto.teSex != null">
- AND t.te_sex = #{dto.teSex}
- </if>
- <!-- 服务状态 -->
- <if test="dto.serviceState != null">
- AND t.service_state = #{dto.serviceState}
- </if>
- <!-- 用户类型 -->
- <if test="dto.techType != null">
- AND t.tech_type = #{dto.techType}
- </if>
- </if>
- </where>
- ORDER BY t.create_time DESC
- </select>
- <!-- 首页按摩商户推荐列表-->
- <select id="getMerchantRecommend" resultType="com.ylx.massage.domain.vo.MerchantVo">
- SELECT
- t.id AS merchantId,
- t.te_name AS teName,
- t.n_star AS nStar,
- t.n_num AS nNum,
- p.price AS price,
- ST_Distance_Sphere(
- POINT(a.longitude, a.latitude),
- POINT(#{dto.longitude}, #{dto.latitude})
- ) / 1000 AS distance
- FROM ma_technician t
- LEFT JOIN t_address a ON t.id = a.merchant_id
- LEFT JOIN(
- SELECT p.user_id AS user_id ,
- p.project_current_price AS price
- FROM ma_project p
- WHERE p.is_delete = 0
- ORDER BY p.project_current_price ASC
- LIMIT 1
- ) p ON t.id = p.user_d
- WHERE
- t.is_delete = 0
- and a.user_type = 2
- and a.type = 1
- and a.is_delete = 0
- ORDER BY t.n_num DESC
- LIMIT 5
- </select>
- </mapper>
|