1. 程式人生 > 遊戲 >基努·裡維斯稱如果華納想做《黑客帝國》新遊戲 他會出演

基努·裡維斯稱如果華納想做《黑客帝國》新遊戲 他會出演

外來鍵在temperature表中,

<?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.hp.mapper.StuMapper">
<resultMap id="Stu" type="com.hp.pojo.Student">
<id property="stuid" column="stuid"/>
<result property="username" column="username"/>
<result property="pwd" column="pwd"/>
<result property="stuname" column="stuname"/>
<result property="sex" column="sex"/>
<result property="status" column="status"/>
<association property="temperature" column="id" javaType="com.hp.pojo.Temperature">
<id property="id" column="id"></id>
<result property="createtime" column="createtime"/>
<result property="wd" column="wd"/>
</association>
</resultMap>

<select id="login" resultType="com.hp.pojo.Student">
select * from student where username=#{username} and pwd=#{pwd}
</select>
<select id="findStu" resultMap="Stu">
<!-- sadsda-->
-- SELECT t.*, s.username,s.pwd,s.stuname,s.sex,s.status FROM temperature t right JOIN student s ON s.stuid = t.stuid
/*SELECT t.*,s.username,s.pwd,s.stuname,s.sex,s.status FROM temperature t INNER JOIN
(SELECT stuid,MAX(id) id FROM temperature GROUP BY stuid ) t1 ON t1.id=t.id RIGHT JOIN student s ON t.stuid=s.stuid*/
SELECT t.id,t.createtime,t.wd,s.* FROM temperature t LEFT JOIN (SELECT stuid,MAX(id) id FROM temperature GROUP BY stuid )
t1 ON t.id=t1.id RIGHT JOIN student s ON t.stuid=s.`stuid`
and stuname like #{stuname}
</select>

<insert id="addStu">
INSERT INTO student(username,pwd,stuname,sex,status) VALUES (#{username},#{pwd},#{stuname},#{sex},#{status})
</insert>
<update id="editStu">
update student set username=#{username},pwd=#{pwd},stuname=#{stuname},sex=#{sex},status=#{status} where stuid=#{stuid}
</update>
<update id="tingStu">
update student set status=1 where stuid=#{stuid}
</update>
</mapper>