You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
3.4 KiB
88 lines
3.4 KiB
<?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.score.dao.TStudentMapper">
|
|
<resultMap id="BaseResultMap" type="com.score.bean.TStudent">
|
|
<!--
|
|
WARNING - @mbggenerated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
<id column="student_no" jdbcType="INTEGER" property="studentNo" />
|
|
<result column="student_name" jdbcType="VARCHAR" property="studentName" />
|
|
<result column="student_sex" jdbcType="VARCHAR" property="studentSex" />
|
|
<result column="stu_pass" jdbcType="VARCHAR" property="stuPass" />
|
|
</resultMap>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
<!--
|
|
WARNING - @mbggenerated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
delete from t_student
|
|
where student_no = #{studentNo,jdbcType=INTEGER}
|
|
</delete>
|
|
<insert id="insert" parameterType="com.score.bean.TStudent">
|
|
insert into t_student (student_no,student_name, student_sex, stu_pass
|
|
)
|
|
values (#{studentNo,jdbcType=INTEGER},#{studentName,jdbcType=VARCHAR}, #{studentSex,jdbcType=VARCHAR}, #{stuPass,jdbcType=VARCHAR}
|
|
)
|
|
</insert>
|
|
<update id="updateByPrimaryKey" parameterType="com.score.bean.TStudent">
|
|
<!--
|
|
WARNING - @mbggenerated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
update t_student
|
|
set student_name = #{studentName,jdbcType=VARCHAR},
|
|
student_sex = #{studentSex,jdbcType=VARCHAR},
|
|
stu_pass = #{stuPass,jdbcType=VARCHAR}
|
|
where student_no = #{studentNo,jdbcType=INTEGER}
|
|
</update>
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
<!--
|
|
WARNING - @mbggenerated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
select student_no, student_name, student_sex, stu_pass
|
|
from t_student
|
|
where student_no = #{studentNo,jdbcType=INTEGER}
|
|
</select>
|
|
<select id="selectAll" resultMap="BaseResultMap" parameterType="com.score.bean.TStudent">
|
|
<!--
|
|
WARNING - @mbggenerated
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
-->
|
|
select student_no, student_name, student_sex, stu_pass
|
|
from t_student
|
|
where 1=1
|
|
<if test="studentName !=null and studentName !=''">
|
|
and student_name like concat('%',#{studentName},'%')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectFinalScore" parameterType="com.score.bean.TStudent" resultType="java.util.Map">
|
|
SELECT IFNULL(a.score,0) score1,IFNULL(b.score,0)
|
|
score2,IFNULL(c.score,0) score3 FROM (
|
|
SELECT (sum(score_value)) score FROM t_score WHERE score_type='1' AND
|
|
student_id=#{studentNo}
|
|
)a,
|
|
(
|
|
SELECT (sum(score_value)) score FROM t_score WHERE score_type='2' AND
|
|
student_id=#{studentNo}
|
|
|
|
) b,
|
|
(
|
|
SELECT sum(score_value) score FROM t_score WHERE score_type='3' AND
|
|
student_id=#{studentNo}
|
|
)c
|
|
</select>
|
|
<select id="selectloginStudent" resultMap="BaseResultMap" parameterType="com.score.bean.TStudent">
|
|
select student_no, student_name, student_sex, stu_pass
|
|
from t_student
|
|
where 1=1
|
|
<if test="studentNo !=null and studentNo !=''">
|
|
and student_no =#{studentNo}
|
|
</if>
|
|
<if test="stuPass !=null and stuPass !=''">
|
|
and stu_pass =#{stuPass}
|
|
</if>
|
|
</select>
|
|
</mapper> |