<?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.BBusiWishUniversityMarjorsMapper">

  <resultMap type="BBusiWishUniversityMarjors" id="BBusiWishUniversityMarjorsResult">
    <result property="id" column="id" />
    <result property="universityId" column="universityId" />
    <result property="marjorsId" column="marjorsId" />
    <result property="name" column="name" />
    <result property="type" column="type" />
    <result property="level" column="level" />
    <result property="remark" column="remark" />
    <result property="createTime" column="createTime" />
    <result property="status" column="status" />
  </resultMap>

  <sql id="selectBBusiWishUniversityMarjorsVo">
    select id, universityId, marjorsId, name, type, level, remark, createTime, status from b_busi_wish_university_marjors
  </sql>

  <select id="selectBBusiWishUniversityMarjorsList" parameterType="BBusiWishUniversityMarjors" resultMap="BBusiWishUniversityMarjorsResult">
    <include refid="selectBBusiWishUniversityMarjorsVo" />
    <where>
      <if test="universityId != null  and universityId != ''"> and universityId = #{universityId}</if>
      <if test="marjorsId != null  and marjorsId != ''"> and marjorsId = #{marjorsId}</if>
      <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
      <if test="type != null  and type != ''"> and type = #{type}</if>
      <if test="level != null  and level != ''"> and level = #{level}</if>
      <if test="createTime != null "> and createTime = #{createTime}</if>
      <if test="status != null "> and status = #{status}</if>
    </where>
    <if test="params.orderBy!=null and params.orderBy != ''"> order by #{params.orderBy} </if>
  </select>

  <select id="selectBBusiWishUniversityMarjorsById" parameterType="Long" resultMap="BBusiWishUniversityMarjorsResult">
    <include refid="selectBBusiWishUniversityMarjorsVo" />
    where id = #{id}
  </select>

  <insert id="insertBBusiWishUniversityMarjors" parameterType="BBusiWishUniversityMarjors" useGeneratedKeys="true" keyProperty="id">
    insert into b_busi_wish_university_marjors
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="universityId != null">universityId,</if>
      <if test="marjorsId != null">marjorsId,</if>
      <if test="name != null">name,</if>
      <if test="type != null">type,</if>
      <if test="level != null">level,</if>
      <if test="remark != null">remark,</if>
      <if test="createTime != null">createTime,</if>
      <if test="status != null">status,</if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="universityId != null">#{universityId},</if>
      <if test="marjorsId != null">#{marjorsId},</if>
      <if test="name != null">#{name},</if>
      <if test="type != null">#{type},</if>
      <if test="level != null">#{level},</if>
      <if test="remark != null">#{remark},</if>
      <if test="createTime != null">#{createTime},</if>
      <if test="status != null">#{status},</if>
    </trim>
  </insert>

  <update id="updateBBusiWishUniversityMarjors" parameterType="BBusiWishUniversityMarjors">
    update b_busi_wish_university_marjors
    <trim prefix="SET" suffixOverrides=",">
      <if test="universityId != null">universityId = #{universityId},</if>
      <if test="marjorsId != null">marjorsId = #{marjorsId},</if>
      <if test="name != null">name = #{name},</if>
      <if test="type != null">type = #{type},</if>
      <if test="level != null">level = #{level},</if>
      <if test="remark != null">remark = #{remark},</if>
      <if test="createTime != null">createTime = #{createTime},</if>
      <if test="status != null">status = #{status},</if>
    </trim>
    where id = #{id}
  </update>

  <delete id="deleteBBusiWishUniversityMarjorsById" parameterType="Long">
    delete from b_busi_wish_university_marjors where id = #{id}
  </delete>

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