SysYxSchoolConsultMapper.xml 8.37 KB
<?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.sincere.student.mapper.SysYxSchoolConsultMapper">
  <resultMap id="BaseResultMap" type="com.sincere.student.model.yx.SysYxSchoolConsult">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="school_id" jdbcType="INTEGER" property="schoolId" />
    <result column="title_desc" jdbcType="VARCHAR" property="titleDesc" />
    <result column="video_url" jdbcType="VARCHAR" property="videoUrl" />
    <result column="context" jdbcType="VARCHAR" property="context" />
    <result column="img_url" jdbcType="VARCHAR" property="imgUrl" />
    <result column="sort" jdbcType="INTEGER" property="sort" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="read_number" jdbcType="INTEGER" property="readNumber" />
    <result column="background" jdbcType="VARCHAR" property="background" />
    <result column="model_list" jdbcType="VARCHAR" property="modelList" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="province" jdbcType="VARCHAR" property="province" />
    <result column="city" jdbcType="VARCHAR" property="city" />
    <result column="area" jdbcType="VARCHAR" property="area" />
  </resultMap>
  <sql id="Base_Column_List">
    id, school_id, title_desc, video_url, context, img_url, sort, status, read_number,
    background, model_list,create_time
  </sql>
  <sql id="Blob_Column_List">
    model_list
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from sys_yx_school_consult
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from sys_yx_school_consult
    where id = #{id,jdbcType=INTEGER}
  </delete>

  <select id="selectList" parameterType="com.sincere.student.dto.yx.AddYxSchoolConsultVo" resultMap="BaseResultMap">
    select
    id, school_id, title_desc, video_url, context, img_url, sort, status, read_number,background,create_time
    from sys_yx_school_consult
    <where>
      <if test="schoolId != null">
        and school_id = #{schoolId}
      </if>
      <if test="titleDesc != null and titleDesc !=''">
        and title_desc = #{titleDesc}
      </if>
    </where>
  </select>

  <select id="getListCount" parameterType="com.sincere.student.dto.yx.AddYxSchoolConsultVo" resultType="java.lang.Integer">
    select
      count(1)
    from sys_yx_school_consult
    <where>
      <if test="schoolId != null">
        and school_id = #{schoolId}
      </if>
      <if test="titleDesc != null and titleDesc !=''">
        and title_desc like #{titleDesc}
      </if>
    </where>
  </select>

  <insert id="insertSelective" parameterType="com.sincere.student.model.yx.SysYxSchoolConsult">
    insert into sys_yx_school_consult
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="schoolId != null">
        school_id,
      </if>
      <if test="titleDesc != null">
        title_desc,
      </if>
      <if test="videoUrl != null">
        video_url,
      </if>
      <if test="context != null">
        context,
      </if>
      <if test="imgUrl != null">
        img_url,
      </if>
      <if test="sort != null">
        sort,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="readNumber != null">
        read_number,
      </if>
      <if test="background != null">
        background,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="modelList != null">
        model_list,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="schoolId != null">
        #{schoolId,jdbcType=INTEGER},
      </if>
      <if test="titleDesc != null">
        #{titleDesc,jdbcType=VARCHAR},
      </if>
      <if test="videoUrl != null">
        #{videoUrl,jdbcType=VARCHAR},
      </if>
      <if test="context != null">
        #{context,jdbcType=VARCHAR},
      </if>
      <if test="imgUrl != null">
        #{imgUrl,jdbcType=VARCHAR},
      </if>
      <if test="sort != null">
        #{sort,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="readNumber != null">
        #{readNumber,jdbcType=INTEGER},
      </if>
      <if test="background != null">
        #{background,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modelList != null">
        #{modelList,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.yx.SysYxSchoolConsult">
    update sys_yx_school_consult
    <set>
      <if test="schoolId != null">
        school_id = #{schoolId,jdbcType=INTEGER},
      </if>
      <if test="titleDesc != null">
        title_desc = #{titleDesc,jdbcType=VARCHAR},
      </if>
      <if test="videoUrl != null">
        video_url = #{videoUrl,jdbcType=VARCHAR},
      </if>
      <if test="context != null">
        context = #{context,jdbcType=VARCHAR},
      </if>
      <if test="imgUrl != null">
        img_url = #{imgUrl,jdbcType=VARCHAR},
      </if>
      <if test="sort != null">
        sort = #{sort,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="readNumber != null">
        read_number = #{readNumber,jdbcType=INTEGER},
      </if>
      <if test="background != null">
        background = #{background,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modelList != null">
        model_list = #{modelList,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>

  <select id="countSort" resultMap="BaseResultMap">
    select * from university_consult where
    <choose>
      <when test="flag ==1">
        sort >= #{sort}
      </when>
      <when test="flag ==2">
        sort >= #{sort} and id != #{id}
      </when>
    </choose>
    order by sort asc
  </select>

  <update id="updateSort" parameterType="com.sincere.student.model.yx.SysYxSchoolConsult">
    update university_consult set sort = #{sort} where id=#{id}
  </update>


  <select id="countConsultList" parameterType="com.sincere.student.dto.yx.QueryCountYxSchoolConsult" resultMap="BaseResultMap">
    select
      ssc.*,ss.province,ss.city,ss.area
    from sys_yx_school_consult ssc
    left join sys_yx_school ss ON ssc.school_id = ss.id
    <where>
      <if test="province != null and province !=''">
        and ss.provnice = #{provnice}
      </if>
      <if test="city != null and city !=''">
        and ss.city = #{city}
      </if>
      <if test="area != null and area !=''">
        and ss.area = #{area}
      </if>
      <if test="startTime != null and startTime.trim() !=''">
        <![CDATA[ and ssc.create_time >= #{startTime} ]]>
      </if>
      <if test="endTime != null and endTime.trim() !=''">
        <![CDATA[ and ssc.create_time < #{endTime} ]]>
      </if>
    </where>
  </select>

<!--  <select id="getCountConsult" parameterType="com.sincere.student.dto.yx.QueryCountYxSchoolConsult" resultType="java.lang.Integer">-->
<!--    select-->
<!--    ssc.*,ss.province,ss.city,ss.area-->
<!--    from sys_yx_school_consult ssc-->
<!--    left join sys_yx_school ss ON ssc.school_id = ss.id-->
<!--    <where>-->
<!--      <if test="province != null and province !=''">-->
<!--        and ss.provnice = #{provnice}-->
<!--      </if>-->
<!--      <if test="city != null and city !=''">-->
<!--        and ss.city = #{city}-->
<!--      </if>-->
<!--      <if test="area != null and area !=''">-->
<!--        and ss.area = #{area}-->
<!--      </if>-->
<!--      <if test="startTime != null and startTime.trim() !=''">-->
<!--        <![CDATA[ and ssc.create_time >= #{startTime} ]]>-->
<!--      </if>-->
<!--      <if test="endTime != null and endTime.trim() !=''">-->
<!--        <![CDATA[ and ssc.create_time < #{endTime} ]]>-->
<!--      </if>-->
<!--    </where>-->
<!--  </select>-->
</mapper>