123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <?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.coach.mapper.CoachInfoMapper">
- <resultMap type="CoachInfo" id="CoachInfoResult">
- <result property="id" column="id" />
- <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" />
- <result property="password" column="password" />
- <result property="status" column="status" />
- </resultMap>
- <select id="selectCoachInfoUrlList" parameterType="com.miaxis.coach.dto.CoachInfoDTO" resultType="com.miaxis.coach.dto.CoachInfoVO">
- SELECT c.*,ci.file_url,ce.totel_stars,
- (2 * 6378.137 * ASIN(SQRT(POW( SIN( PI( ) * ( #{lon}- s.poi_lon ) / 360 ), 2 ) + COS( PI( ) * #{lat} / 180 ) * COS( s.poi_lat * PI( ) / 180 ) * POW( SIN( PI( ) * ( #{lat}- 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>
- </where>
- <if test="orderName!=null and orderType!=null">
- order by ${orderName} ${orderType}
- </if>
- </select>
- <sql id="selectCoachInfoVo">
- select id,coachnum, name, sex, inscode, idcard, mobile, address, photo, dripermitted, teachpermitted, district, employstatus, stop_train, wechar, openid, create_time, update_time, fabulous,password,status 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="deleteCoachInfoByIds" parameterType="String">
- delete from coach_info where coachnum in
- <foreach item="coachnum" collection="array" open="(" separator="," close=")">
- #{coachnum}
- </foreach>
- </delete>
- <select id="queryList" resultType="com.miaxis.coach.vo.CoachInfoPcVO">
- SELECT
- ci.`id`,
- ci.`coachnum`,
- ci.`name`,
- ci.`sex`,
- ci.`inscode`,
- ci.`idcard`,
- ci.`status`,
- ci.`mobile`
- FROM
- coach_info ci
- join school_info d on ci.inscode= d.inscode
- <where>
- ci.`status` = '0'
- <if test="name != null and name != ''"> and ci.`name` like concat('%', #{name}, '%')</if>
- <if test="coachnum != null and coachnum != ''"> and ci.coachnum = #{coachnum}</if>
- <if test="mobile != null and mobile != ''"> and ci.mobile = #{mobile}</if>
- </where>
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- </select>
- <!--密码重置-->
- <update id="resetPassword">
- UPDATE
- coach_info ci
- SET password = #{password}
- <where>
- and ci.id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- (#{id})
- </foreach>
- </where>
- </update>
- <!--pc删除教练(逻辑删除)-->
- <update id="removeCoach">
- UPDATE
- coach_info ci
- SET ci.status = '1'
- <where>
- and ci.id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- (#{id})
- </foreach>
- </where>
- </update>
- </mapper>
|