|
@@ -0,0 +1,154 @@
|
|
|
+<?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.miaxis.app.coach.mapper.CoachInfoMapper">
|
|
|
+
|
|
|
+ <resultMap type="CoachInfo" id="CoachInfoResult">
|
|
|
+ <result property="coachnum" column="coachnum" />
|
|
|
+ <result property="name" column="name" />
|
|
|
+ <result property="sex" column="sex" />
|
|
|
+ <result property="inscode" column="inscode" />
|
|
|
+ <result property="idcard" column="idcard" />
|
|
|
+ <result property="mobile" column="mobile" />
|
|
|
+ <result property="address" column="address" />
|
|
|
+ <result property="photo" column="photo" />
|
|
|
+ <result property="dripermitted" column="dripermitted" />
|
|
|
+ <result property="teachpermitted" column="teachpermitted" />
|
|
|
+ <result property="district" column="district" />
|
|
|
+ <result property="employstatus" column="employstatus" />
|
|
|
+ <result property="stopTrain" column="stop_train" />
|
|
|
+ <result property="wechar" column="wechar" />
|
|
|
+ <result property="openid" column="openid" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ <result property="fabulous" column="fabulous" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="selectCoachInfoUrlList" parameterType="CoachInfo" resultMap="CoachInfoResult">
|
|
|
+ SELECT c.*,ci.file_url,ce.totel_starts,
|
|
|
+ (2 * 6378.137 * ASIN(SQRT(POW( SIN( PI( ) * ( 120- s.poi_lon ) / 360 ), 2 ) + COS( PI( ) * 34 / 180 ) * COS( s.poi_lat * PI( ) / 180 ) * POW( SIN( PI( ) * ( 34- s.poi_lat ) / 360 ), 2 )) ) ) AS distance FROM coach_info c
|
|
|
+ join school_info s
|
|
|
+ on c.inscode = s.inscode
|
|
|
+ LEFT JOIN coach_images ci
|
|
|
+ ON c.photo = ci.id
|
|
|
+ left join coach_evaluate ce
|
|
|
+ on c.coachnum = ce.coachnum
|
|
|
+ <where>
|
|
|
+ <if test="teachpermitted != null and teachpermitted != ''"> and teachpermitted = #{teachpermitted}</if>
|
|
|
+ <if test="sex != null and sex != ''"> and sex = #{sex}</if>
|
|
|
+ <if test="starts != null coachnum sex != ''"> and ce.totel_starts = #{starts}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <sql id="selectCoachInfoVo">
|
|
|
+ select coachnum, name, sex, inscode, idcard, mobile, address, photo, dripermitted, teachpermitted, district, employstatus, stop_train, wechar, openid, create_time, update_time, fabulous from coach_info
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectCoachInfoList" parameterType="CoachInfo" resultMap="CoachInfoResult">
|
|
|
+ <include refid="selectCoachInfoVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
|
+ <if test="sex != null "> and sex = #{sex}</if>
|
|
|
+ <if test="inscode != null and inscode != ''"> and inscode = #{inscode}</if>
|
|
|
+ <if test="idcard != null and idcard != ''"> and idcard = #{idcard}</if>
|
|
|
+ <if test="mobile != null and mobile != ''"> and mobile = #{mobile}</if>
|
|
|
+ <if test="address != null and address != ''"> and address = #{address}</if>
|
|
|
+ <if test="photo != null "> and photo = #{photo}</if>
|
|
|
+ <if test="dripermitted != null and dripermitted != ''"> and dripermitted = #{dripermitted}</if>
|
|
|
+ <if test="teachpermitted != null and teachpermitted != ''"> and teachpermitted = #{teachpermitted}</if>
|
|
|
+ <if test="district != null and district != ''"> and district = #{district}</if>
|
|
|
+ <if test="employstatus != null "> and employstatus = #{employstatus}</if>
|
|
|
+ <if test="stopTrain != null "> and stop_train = #{stopTrain}</if>
|
|
|
+ <if test="wechar != null and wechar != ''"> and wechar = #{wechar}</if>
|
|
|
+ <if test="openid != null and openid != ''"> and openid = #{openid}</if>
|
|
|
+ <if test="fabulous != null "> and fabulous = #{fabulous}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectCoachInfoById" parameterType="String" resultMap="CoachInfoResult">
|
|
|
+ <include refid="selectCoachInfoVo"/>
|
|
|
+ where coachnum = #{coachnum}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertCoachInfo" parameterType="CoachInfo">
|
|
|
+ insert into coach_info
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="coachnum != null">coachnum,</if>
|
|
|
+ <if test="name != null">name,</if>
|
|
|
+ <if test="sex != null">sex,</if>
|
|
|
+ <if test="inscode != null">inscode,</if>
|
|
|
+ <if test="idcard != null">idcard,</if>
|
|
|
+ <if test="mobile != null">mobile,</if>
|
|
|
+ <if test="address != null">address,</if>
|
|
|
+ <if test="photo != null">photo,</if>
|
|
|
+ <if test="dripermitted != null">dripermitted,</if>
|
|
|
+ <if test="teachpermitted != null">teachpermitted,</if>
|
|
|
+ <if test="district != null">district,</if>
|
|
|
+ <if test="employstatus != null">employstatus,</if>
|
|
|
+ <if test="stopTrain != null">stop_train,</if>
|
|
|
+ <if test="wechar != null">wechar,</if>
|
|
|
+ <if test="openid != null">openid,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="fabulous != null">fabulous,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="coachnum != null">#{coachnum},</if>
|
|
|
+ <if test="name != null">#{name},</if>
|
|
|
+ <if test="sex != null">#{sex},</if>
|
|
|
+ <if test="inscode != null">#{inscode},</if>
|
|
|
+ <if test="idcard != null">#{idcard},</if>
|
|
|
+ <if test="mobile != null">#{mobile},</if>
|
|
|
+ <if test="address != null">#{address},</if>
|
|
|
+ <if test="photo != null">#{photo},</if>
|
|
|
+ <if test="dripermitted != null">#{dripermitted},</if>
|
|
|
+ <if test="teachpermitted != null">#{teachpermitted},</if>
|
|
|
+ <if test="district != null">#{district},</if>
|
|
|
+ <if test="employstatus != null">#{employstatus},</if>
|
|
|
+ <if test="stopTrain != null">#{stopTrain},</if>
|
|
|
+ <if test="wechar != null">#{wechar},</if>
|
|
|
+ <if test="openid != null">#{openid},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="fabulous != null">#{fabulous},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateCoachInfo" parameterType="CoachInfo">
|
|
|
+ update coach_info
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="name != null">name = #{name},</if>
|
|
|
+ <if test="sex != null">sex = #{sex},</if>
|
|
|
+ <if test="inscode != null">inscode = #{inscode},</if>
|
|
|
+ <if test="idcard != null">idcard = #{idcard},</if>
|
|
|
+ <if test="mobile != null">mobile = #{mobile},</if>
|
|
|
+ <if test="address != null">address = #{address},</if>
|
|
|
+ <if test="photo != null">photo = #{photo},</if>
|
|
|
+ <if test="dripermitted != null">dripermitted = #{dripermitted},</if>
|
|
|
+ <if test="teachpermitted != null">teachpermitted = #{teachpermitted},</if>
|
|
|
+ <if test="district != null">district = #{district},</if>
|
|
|
+ <if test="employstatus != null">employstatus = #{employstatus},</if>
|
|
|
+ <if test="stopTrain != null">stop_train = #{stopTrain},</if>
|
|
|
+ <if test="wechar != null">wechar = #{wechar},</if>
|
|
|
+ <if test="openid != null">openid = #{openid},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="fabulous != null">fabulous = #{fabulous},</if>
|
|
|
+ </trim>
|
|
|
+ where coachnum = #{coachnum}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteCoachInfoById" parameterType="String">
|
|
|
+ delete from coach_info where coachnum = #{coachnum}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteCoachInfoByIds" parameterType="String">
|
|
|
+ delete from coach_info where coachnum in
|
|
|
+ <foreach item="coachnum" collection="array" open="(" separator="," close=")">
|
|
|
+ #{coachnum}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|