123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- <?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.school.mapper.SchoolInfoMapper">
- <resultMap type="SchoolInfo" id="SchoolInfoResult">
- <result property="id" column="id" />
- <result property="inscode" column="inscode" />
- <result property="name" column="name" />
- <result property="sname" column="sname" />
- <result property="address" column="address" />
- <result property="legalPersonIdNumber" column="legal_person_id_number" />
- <result property="responsiblePerson" column="responsible_person" />
- <result property="legalPersonName" column="legal_person_name" />
- <result property="areaName" column="area_name" />
- <result property="areaCode" column="area_code" />
- <result property="tel" column="tel" />
- <result property="wechar" column="wechar" />
- <result property="registrationDate" column="registration_date" />
- <result property="licenseNumber" column="license_number" />
- <result property="licenseWord" column="license_word" />
- <result property="licenseValidPeriodFrom" column="license_valid_period_from" />
- <result property="licenseValidPeriodEnd" column="license_valid_period_end" />
- <result property="credibilityGrade" column="credibility_grade" />
- <result property="credibilityScore" column="credibility_score" />
- <result property="vehicleSum" column="vehicle_sum" />
- <result property="regcapital" column="regcapital" />
- <result property="bizlicense" column="bizlicense" />
- <result property="poiLon" column="poi_lon" />
- <result property="poiLat" column="poi_lat" />
- <result property="removed" column="removed" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="initialReceiptDate" column="initial_receipt_date" />
- <result property="businessStatusName" column="business_status_name" />
- <result property="pxcx" column="pxcx" />
- <result property="yzCode" column="yzCode" />
- </resultMap>
- <select id="selectSchoolInfoUrlList" parameterType="com.miaxis.school.dto.SchoolInfoDTO" resultType="com.miaxis.school.vo.SchoolInfoVO">
- SELECT s.*,(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 school_info s
- LEFT JOIN (SELECT * FROM school_images i WHERE i.is_top = 1) i
- ON s.inscode = i.inscode
- left join (SELECT inscode,avg(e.total_starts) as starts FROM school_evaluate e GROUP BY inscode) m
- on s.inscode = m.inscode
- <where>
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
- <if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
- <if test="pxcx != null and pxcx != ''"> and pxcx like concat('%', #{pxcx}, '%')</if>
- </where>
- <if test="orderName!=null and orderType!=null">
- order by ${orderName} ${orderType}
- </if>
- </select>
- <select id="selectSchoolInfoEvalList" parameterType="com.miaxis.school.dto.SchoolInfoEvalDTO" resultType="com.miaxis.school.vo.SchoolInfoEvalVO">
- SELECT s.inscode,s.name,m.stars,m.total
- FROM school_info s
- left join (SELECT inscode,avg(e.total_starts) as stars,count(1) as total FROM school_evaluate e GROUP BY inscode) m
- on s.inscode = m.inscode
- <where>
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
- <if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
- <if test="pxcx != null and pxcx != ''"> and sname like concat('%', #{pxcx}, '%')</if>
- </where>
- order by stars desc
- </select>
- <sql id="selectSchoolInfoVo">
- select id,inscode, name, sname, address, legal_person_id_number, responsible_person, legal_person_name, area_name, area_code, tel, wechar, registration_date, license_number, license_word, license_valid_period_from, license_valid_period_end, credibility_grade, credibility_score, vehicle_sum, regcapital, bizlicense, poi_lon, poi_lat, removed, create_time, update_time, initial_receipt_date, business_status_name, pxcx, yz_code from school_info
- </sql>
- <select id="selectSchoolInfoList" parameterType="SchoolInfo" resultMap="SchoolInfoResult">
- <include refid="selectSchoolInfoVo"/>
- <where>
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
- <if test="sname != null and sname != ''"> and sname like concat('%', #{sname}, '%')</if>
- <if test="address != null and address != ''"> and address = #{address}</if>
- <if test="legalPersonIdNumber != null and legalPersonIdNumber != ''"> and legal_person_id_number = #{legalPersonIdNumber}</if>
- <if test="responsiblePerson != null and responsiblePerson != ''"> and responsible_person = #{responsiblePerson}</if>
- <if test="legalPersonName != null and legalPersonName != ''"> and legal_person_name like concat('%', #{legalPersonName}, '%')</if>
- <if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
- <if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
- <if test="tel != null and tel != ''"> and tel = #{tel}</if>
- <if test="wechar != null and wechar != ''"> and wechar = #{wechar}</if>
- <if test="registrationDate != null "> and registration_date = #{registrationDate}</if>
- <if test="licenseNumber != null and licenseNumber != ''"> and license_number = #{licenseNumber}</if>
- <if test="licenseWord != null and licenseWord != ''"> and license_word = #{licenseWord}</if>
- <if test="licenseValidPeriodFrom != null "> and license_valid_period_from = #{licenseValidPeriodFrom}</if>
- <if test="licenseValidPeriodEnd != null "> and license_valid_period_end = #{licenseValidPeriodEnd}</if>
- <if test="credibilityGrade != null and credibilityGrade != ''"> and credibility_grade = #{credibilityGrade}</if>
- <if test="credibilityScore != null and credibilityScore != ''"> and credibility_score = #{credibilityScore}</if>
- <if test="vehicleSum != null "> and vehicle_sum = #{vehicleSum}</if>
- <if test="regcapital != null "> and regcapital = #{regcapital}</if>
- <if test="bizlicense != null and bizlicense != ''"> and bizlicense = #{bizlicense}</if>
- <if test="poiLon != null "> and poi_lon = #{poiLon}</if>
- <if test="poiLat != null "> and poi_lat = #{poiLat}</if>
- <if test="removed != null "> and removed = #{removed}</if>
- <if test="initialReceiptDate != null "> and initial_receipt_date = #{initialReceiptDate}</if>
- <if test="businessStatusName != null and businessStatusName != ''"> and business_status_name like concat('%', #{businessStatusName}, '%')</if>
- <if test="pxcx != null and pxcx != ''"> and pxcx = #{pxcx}</if>
- <if test="yzCode != null and yzCode != ''"> and yz_code = #{yz_code}</if>
- </where>
- </select>
- <select id="selectSchoolInfoById" parameterType="String" resultMap="SchoolInfoResult">
- <include refid="selectSchoolInfoVo"/>
- where inscode = #{inscode}
- </select>
- <insert id="insertSchoolInfo" parameterType="SchoolInfo">
- insert into school_info
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="inscode != null">inscode,</if>
- <if test="name != null">name,</if>
- <if test="sname != null">sname,</if>
- <if test="address != null">address,</if>
- <if test="legalPersonIdNumber != null">legal_person_id_number,</if>
- <if test="responsiblePerson != null">responsible_person,</if>
- <if test="legalPersonName != null">legal_person_name,</if>
- <if test="areaName != null">area_name,</if>
- <if test="areaCode != null">area_code,</if>
- <if test="tel != null">tel,</if>
- <if test="wechar != null">wechar,</if>
- <if test="registrationDate != null">registration_date,</if>
- <if test="licenseNumber != null">license_number,</if>
- <if test="licenseWord != null">license_word,</if>
- <if test="licenseValidPeriodFrom != null">license_valid_period_from,</if>
- <if test="licenseValidPeriodEnd != null">license_valid_period_end,</if>
- <if test="credibilityGrade != null">credibility_grade,</if>
- <if test="credibilityScore != null">credibility_score,</if>
- <if test="vehicleSum != null">vehicle_sum,</if>
- <if test="regcapital != null">regcapital,</if>
- <if test="bizlicense != null">bizlicense,</if>
- <if test="poiLon != null">poi_lon,</if>
- <if test="poiLat != null">poi_lat,</if>
- <if test="removed != null">removed,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="initialReceiptDate != null">initial_receipt_date,</if>
- <if test="businessStatusName != null">business_status_name,</if>
- <if test="pxcx != null">pxcx,</if>
- <if test="yzCode != null">yz_code,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="inscode != null">#{inscode},</if>
- <if test="name != null">#{name},</if>
- <if test="sname != null">#{sname},</if>
- <if test="address != null">#{address},</if>
- <if test="legalPersonIdNumber != null">#{legalPersonIdNumber},</if>
- <if test="responsiblePerson != null">#{responsiblePerson},</if>
- <if test="legalPersonName != null">#{legalPersonName},</if>
- <if test="areaName != null">#{areaName},</if>
- <if test="areaCode != null">#{areaCode},</if>
- <if test="tel != null">#{tel},</if>
- <if test="wechar != null">#{wechar},</if>
- <if test="registrationDate != null">#{registrationDate},</if>
- <if test="licenseNumber != null">#{licenseNumber},</if>
- <if test="licenseWord != null">#{licenseWord},</if>
- <if test="licenseValidPeriodFrom != null">#{licenseValidPeriodFrom},</if>
- <if test="licenseValidPeriodEnd != null">#{licenseValidPeriodEnd},</if>
- <if test="credibilityGrade != null">#{credibilityGrade},</if>
- <if test="credibilityScore != null">#{credibilityScore},</if>
- <if test="vehicleSum != null">#{vehicleSum},</if>
- <if test="regcapital != null">#{regcapital},</if>
- <if test="bizlicense != null">#{bizlicense},</if>
- <if test="poiLon != null">#{poiLon},</if>
- <if test="poiLat != null">#{poiLat},</if>
- <if test="removed != null">#{removed},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="initialReceiptDate != null">#{initialReceiptDate},</if>
- <if test="businessStatusName != null">#{businessStatusName},</if>
- <if test="pxcx != null">#{pxcx},</if>
- <if test="yzCode != null">#{yzCode},</if>
- </trim>
- </insert>
- <update id="updateSchoolInfo" parameterType="SchoolInfo">
- update school_info
- <trim prefix="SET" suffixOverrides=",">
- <if test="name != null">name = #{name},</if>
- <if test="sname != null">sname = #{sname},</if>
- <if test="address != null">address = #{address},</if>
- <if test="legalPersonIdNumber != null">legal_person_id_number = #{legalPersonIdNumber},</if>
- <if test="responsiblePerson != null">responsible_person = #{responsiblePerson},</if>
- <if test="legalPersonName != null">legal_person_name = #{legalPersonName},</if>
- <if test="areaName != null">area_name = #{areaName},</if>
- <if test="areaCode != null">area_code = #{areaCode},</if>
- <if test="tel != null">tel = #{tel},</if>
- <if test="wechar != null">wechar = #{wechar},</if>
- <if test="registrationDate != null">registration_date = #{registrationDate},</if>
- <if test="licenseNumber != null">license_number = #{licenseNumber},</if>
- <if test="licenseWord != null">license_word = #{licenseWord},</if>
- <if test="licenseValidPeriodFrom != null">license_valid_period_from = #{licenseValidPeriodFrom},</if>
- <if test="licenseValidPeriodEnd != null">license_valid_period_end = #{licenseValidPeriodEnd},</if>
- <if test="credibilityGrade != null">credibility_grade = #{credibilityGrade},</if>
- <if test="credibilityScore != null">credibility_score = #{credibilityScore},</if>
- <if test="vehicleSum != null">vehicle_sum = #{vehicleSum},</if>
- <if test="regcapital != null">regcapital = #{regcapital},</if>
- <if test="bizlicense != null">bizlicense = #{bizlicense},</if>
- <if test="poiLon != null">poi_lon = #{poiLon},</if>
- <if test="poiLat != null">poi_lat = #{poiLat},</if>
- <if test="removed != null">removed = #{removed},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="initialReceiptDate != null">initial_receipt_date = #{initialReceiptDate},</if>
- <if test="businessStatusName != null">business_status_name = #{businessStatusName},</if>
- <if test="pxcx != null">pxcx = #{pxcx},</if>
- <if test="yzCode != null">yz_code = #{yzCode},</if>
- </trim>
- where inscode = #{inscode}
- </update>
- <delete id="deleteSchoolInfoById" parameterType="String">
- delete from school_info where inscode = #{inscode}
- </delete>
- <delete id="deleteSchoolInfoByIds" parameterType="String">
- delete from school_info where inscode in
- <foreach item="inscode" collection="array" open="(" separator="," close=")">
- #{inscode}
- </foreach>
- </delete>
- <!-- pc驾校列表查询 -->
- <select id="queryList" resultType="com.miaxis.school.vo.SchoolInfoPcVO">
- SELECT
- s.`id`,
- s.`inscode`,
- s.`name`,
- s.`sname`,
- s.`address`,
- s.`responsible_person` as responsiblePerson,
- s.`area_name` as areaName,
- s.`tel`,
- s.`removed`,
- s.`registration_date` as registrationDate,
- s.`credibility_score` as credibilityScore,
- s.`create_time` as createTime
- FROM
- school_info s
- <where>
- <if test="removed == null"> and s.`removed` = '0'</if>
- <if test="removed == '2'.toString()"> and exists(SELECT `removed` FROM `school_info`) </if>
- <if test="removed != null and removed != '' and removed != '2'.toString()"> and s.`removed` = #{removed}</if>
- <if test="id != null and id != ''"> and s.id = #{id}</if>
- <if test="inscode != null and inscode != ''"> and s.inscode = #{inscode}</if>
- <if test="name != null and name != ''"> and s.`name` like concat('%', #{name}, '%')</if>
- <if test="address != null and address != ''"> and s.address = #{address}</if>
- <if test="areaName != null and areaName != ''"> and s.area_name = #{areaName}</if>
- <if test="tel != null and tel != ''"> and s.tel = #{tel}</if>
- <if test="credibilityScore != null and credibilityScore != ''"> and s.credibility_score = #{credibilityScore}</if>
- <if test="startTime neq null and startTime neq '' ">
- and DATE_FORMAT(s.create_time,'%Y-%m-%d') >= #{startTime}
- </if>
- <if test="endTime neq null and endTime neq '' ">
- and DATE_FORMAT(s.create_time,'%Y-%m-%d') <= #{endTime}
- </if>
- </where>
- </select>
- <!-- pc查询驾校详情 -->
- <select id="getSchoolInfoDetail" resultType="com.miaxis.school.vo.SchoolInfoDetailPcVO">
- SELECT
- s.`inscode`,
- s.`name`,
- s.`sname`,
- s.`address`,
- s.`legal_person_id_number` as legalPersonIdNumber,
- s.`legal_person_name` as legalPersonName,
- s.`responsible_person` as responsiblePerson,
- s.`area_name` as areaName,
- s.`tel`,
- s.`wechar`,
- s.`registration_date` as registrationDate,
- s.`license_number` as licenseNumber,
- s.`license_word` as licenseWord,
- s.`license_valid_period_from` as licenseValidPeriodFrom,
- s.`license_valid_period_end` as licenseValidPeriodEnd,
- s.`credibility_grade` as credibilityGrade,
- s.`credibility_score` as credibilityScore,
- s.`vehicle_sum` as vehicleSum,
- s.`regcapital`,
- s.`bizlicense`,
- s.`removed`,
- s.`business_status_name` as businessStatusName,
- s.`create_time` as createTime
- FROM
- school_info s
- where s.`id` = #{id}
- </select>
- <!--pc删除驾校(逻辑删除)-->
- <update id="updateByInscode">
- UPDATE
- school_info s
- SET s.removed = '1'
- <where>
- and s.id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- (#{id})
- </foreach>
- </where>
- </update>
- </mapper>
|