<?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.ruoyi.syzy.mapper.BusiWishUniversitiesTopMapper">

  <resultMap type="BusiWishUniversitiesTop" id="BusiWishUniversitiesTopResult">
    <result property="id" column="id" />
    <result property="univerid" column="univerId" />
    <result property="code" column="code" />
    <result property="name" column="name" />
    <result property="logo" column="logo" />
    <result property="favorities" column="favorities" />
  </resultMap>

  <sql id="selectBusiWishUniversitiesTopVo">
    select id, univerId, code, name, logo, favorities from b_busi_wish_universities_top
  </sql>

  <select id="selectBusiWishUniversitiesTopList" parameterType="BusiWishUniversitiesTop" resultMap="BusiWishUniversitiesTopResult">
    <include refid="selectBusiWishUniversitiesTopVo" />
    <where>
      <if test="univerid != null "> and univerId = #{univerid}</if>
      <if test="code != null  and code != ''"> and code = #{code}</if>
      <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
      <if test="logo != null  and logo != ''"> and logo = #{logo}</if>
      <if test="favorities != null "> and favorities = #{favorities}</if>
    </where>
    <if test="params.orderBy!=null and params.orderBy != ''"> order by #{params.orderBy} </if>
  </select>

  <select id="selectBusiWishUniversitiesTopById" parameterType="Long" resultMap="BusiWishUniversitiesTopResult">
    <include refid="selectBusiWishUniversitiesTopVo" />
    where id = #{id}
  </select>

  <insert id="insertBusiWishUniversitiesTop" parameterType="BusiWishUniversitiesTop" useGeneratedKeys="true" keyProperty="id">
    insert into b_busi_wish_universities_top
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="univerid != null">univerId,</if>
      <if test="code != null">code,</if>
      <if test="name != null">name,</if>
      <if test="logo != null">logo,</if>
      <if test="favorities != null">favorities,</if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="univerid != null">#{univerid},</if>
      <if test="code != null">#{code},</if>
      <if test="name != null">#{name},</if>
      <if test="logo != null">#{logo},</if>
      <if test="favorities != null">#{favorities},</if>
    </trim>
  </insert>

  <update id="updateBusiWishUniversitiesTop" parameterType="BusiWishUniversitiesTop">
    update b_busi_wish_universities_top
    <trim prefix="SET" suffixOverrides=",">
      <if test="univerid != null">univerId = #{univerid},</if>
      <if test="code != null">code = #{code},</if>
      <if test="name != null">name = #{name},</if>
      <if test="logo != null">logo = #{logo},</if>
      <if test="favorities != null">favorities = #{favorities},</if>
    </trim>
    where id = #{id}
  </update>

  <delete id="deleteBusiWishUniversitiesTopById" parameterType="Long">
    delete from b_busi_wish_universities_top where id = #{id}
  </delete>

  <delete id="deleteBusiWishUniversitiesTopByIds" parameterType="String">
    delete from b_busi_wish_universities_top where id in
    <foreach item="id" collection="array" open="(" separator="," close=")">
      #{id}
    </foreach>
  </delete>
</mapper>