<?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.system.mapper.MingxueQueryMapper">

	<resultMap type="SysMingxueZhiYuan" id="SysMingxueZhiYuanResult">
		<result property="year" column="year" />
		<result property="location" column="location" />
		<result property="level" column="level" />
		<result property="type" column="type" />
		<result property="marjorId" column="marjorId" />
		<result property="universityId" column="universityId" />
		<result property="universityName" column="universityName" />
		<result property="marjorName" column="marjorName" />
		<result property="marjorBelongs" column="marjorBelongs" />
		<result property="marjorDirection" column="marjorDirection" />
		<result property="courseRemark0" column="courseRemark0" />
		<result property="courseRemark1" column="courseRemark1" />
		<result property="course0" column="course0" />
		<result property="course1" column="course1" />
		<result property="course2" column="course2" />
		<result property="score" column="score" />
		<result property="seat" column="seat" />
		<result property="num" column="num" />
		<result property="numReal" column="numReal" />
		<result property="scoreRealTop" column="scoreRealTop" />
		<result property="seatRealTop" column="seatRealTop" />
		<result property="scoreRealAverage" column="scoreRealAverage" />
		<result property="seatRealAverage" column="seatRealAverage" />
		<result property="createTime" column="createTime" />
		<result property="status" column="status" />
		<result property="ylxx" column="ylxx" />
		<result property="ylxk" column="ylxk" />
		<result property="yjsy" column="yjsy" />
		<result property="dlxy" column="dlxy" />
		<result property="mbgx" column="mbgx" />
		<result property="typer" column="typer" />
	</resultMap>

	<select id="selectMingxueList" parameterType="SysMingxueQueryCondition" resultMap="SysMingxueZhiYuanResult">
		select
			a.year, a.level, a.marjorId, a.universityId, a.universityName, a.marjorName, a.marjorBelongs, a.marjorDirection, a.courseRemark0, a.courseRemark1, a.course0, a.course1, a.course2, a.score, a.seat, a.num, a.numReal, a.scoreRealTop, a.seatRealTop, a.scoreRealAverage, a.seatRealAverage,b.location as location, b.ylxx, b.ylxk, b.yjsy, b.dlxy, b.mbgx,b.type as typer
		from
			b_busi_wish_university_submit_marjors a, b_busi_wish_universities b
		<where>
			<if test="score != null and score != ''">
				AND a.score &lt; #{score}
			</if>
			<if test="mode != null and mode != ''">
				AND a.course0 = #{mode}
			</if>
			<if test="location != null and location != ''">
				AND b.location = #{location}
			</if>
			<if test="type != null">
				AND a.type = #{type}
			</if>
			<if test="op != null and op != ''">
				AND a.level = #{op}
			</if>
			<if test="marjorRoot != null and marjorRoot != ''">
				and b.type = #{marjorRoot}
			</if>
			<if test="startNo != null and startNo != ''">
				limit #{startNo}, #{limit}
			</if>
		</where>
	</select>

	<select id="selectMingxueListWithJsonFormat" parameterType="SysMingxueQueryCondition" resultMap="SysMingxueZhiYuanResult">
		select
			a.year, a.level, a.marjorId, a.universityId, a.universityName, a.marjorName, a.marjorBelongs, a.marjorDirection, a.courseRemark0, a.courseRemark1, a.course0, a.course1, a.course2, a.score, a.seat, a.num, a.numReal, a.scoreRealTop, a.seatRealTop, a.scoreRealAverage, a.seatRealAverage,b.location as location, b.ylxx, b.ylxk, b.yjsy, b.dlxy, b.mbgx,b.type as typer
		from
			b_busi_wish_university_submit_marjors a, b_busi_wish_universities b
		<where>
			a.universityId = b.id
			<if test="score != null and score != ''">
				AND a.score &lt; #{score}
			</if>
			<if test="mode != null and mode != ''">
				AND a.course0 = #{mode}
			</if>
			<if test="location != null and location != ''">
				AND b.location = #{location}
			</if>
			<if test="type != null">
				AND a.type = #{type}
			</if>
			<if test="op != null and op != ''">
				AND a.level = #{op}
			</if>
			<if test="marjorRoot != null and marjorRoot != ''">
				and b.type = #{marjorRoot}
			</if>
			group by a.universityId order by a.score desc
			<if test="startNo != null and startNo != ''">
				limit #{startNo}, #{limit}
			</if>
		</where>
	</select>

	<select id="selectSchoolJsonStr" parameterType="SysMingxueJson" resultType="String">
		select
			`json`
		from
			all_wangnian_zhiyuantianbao_data
		<where>
			<if test="universityId != null and universityId != ''">
				AND universityId = #{universityId}
			</if>
			<if test="year != null and year != ''">
				AND scoreYear = #{year}
			</if>
			<if test="location != null and location != ''">
				AND location = #{location}
			</if>
			limit 1
		</where>
	</select>

</mapper>