202201080136 qijun
This commit is contained in:
parent
a692fcf6c3
commit
7bfcfc22df
|
@ -4,10 +4,11 @@ import edu.qijun.pojo.Account;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import edu.qijun.pojo.Student;
|
import edu.qijun.pojo.Student;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface AccountMapper {
|
public interface AccountMapper {
|
||||||
|
|
||||||
List<Student> getStudents();
|
List<Student> getStudents();
|
||||||
void insertAccount(Account account);
|
void insertAccount(Account account); // 添加了 @Param 注解
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,6 @@ public interface ScoreMapper {
|
||||||
|
|
||||||
void deleteById(Integer id); // 修正了方法名
|
void deleteById(Integer id); // 修正了方法名
|
||||||
|
|
||||||
void deleteByIds(@Param("ids") List<Integer> ids);
|
void deleteByIds(List<Integer> ids);
|
||||||
// 假设你想要删除多个ID,通常复数形式更合适
|
// 假设你想要删除多个ID,通常复数形式更合适
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package edu.qijun.mapper;
|
||||||
import edu.qijun.pojo.Student;
|
import edu.qijun.pojo.Student;
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@ public interface StudentMapper {
|
||||||
List<Student> getAll();
|
List<Student> getAll();
|
||||||
|
|
||||||
|
|
||||||
Student getById(String id);
|
Student getById(Integer id);
|
||||||
|
|
||||||
|
|
||||||
Student getByCondition(Integer len,Integer gender);
|
List<Student> getByCondition(Integer len,Integer gender);
|
||||||
|
|
||||||
void insertStudent(Student student);
|
void insertStudent(Student student);
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ public class Student extends BaseEntity{
|
||||||
private String name;
|
private String name;
|
||||||
private Integer gender;
|
private Integer gender;
|
||||||
private LocalDate birthday;
|
private LocalDate birthday;
|
||||||
|
//private Integer createBy;
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
<select id="selectAccount" resultType="Account">
|
<select id="selectAccount" resultType="Account">
|
||||||
SELECT * FROM account WHERE id = #{id}
|
SELECT * FROM account WHERE id = #{id}
|
||||||
</select>
|
</select>
|
||||||
<insert id="insertAccount" useGeneratedKeys="true" keyProperty="id" parameterType="edu.qijun.pojo.Account">
|
<insert id="insertAccount" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into account(account, password, role, create_by, create_time)
|
insert into account(account, password, role, create_by, create_time)
|
||||||
values(#{account}, #{password}, #{role}, #{createBy}, #{createTime})
|
values(#{account}, #{password}, #{role}, #{createBy}, #{createTime})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
<select id="getStudents" resultType="edu.qijun.pojo.Student">
|
<select id="getStudents" resultType="edu.qijun.pojo.Student">
|
||||||
SELECT id, name, age, create_by, create_time
|
SELECT id, name, age, create_by, create_time
|
||||||
FROM student
|
FROM student
|
||||||
|
|
|
@ -8,10 +8,8 @@
|
||||||
values(#{studentId}, #{courseId}, #{score}, #{createBy}, #{createTime})
|
values(#{studentId}, #{courseId}, #{score}, #{createBy}, #{createTime})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertStudent" useGeneratedKeys="true" keyProperty="id">
|
|
||||||
insert into student (name, gender, birthday, create_by, create_time)
|
|
||||||
values (#{name}, #{gender}, #{birthday}, #{createBy}, #{createTime})
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
|
|
||||||
<delete id="deleteById">
|
<delete id="deleteById">
|
||||||
|
@ -21,7 +19,7 @@
|
||||||
<delete id="deleteByIds">
|
<delete id="deleteByIds">
|
||||||
DELETE FROM score WHERE id IN
|
DELETE FROM score WHERE id IN
|
||||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
#{ids}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
|
@ -15,9 +15,12 @@
|
||||||
<if test="updateBy != null">update_by=#{updateBy},</if>
|
<if test="updateBy != null">update_by=#{updateBy},</if>
|
||||||
<if test="updateTime != null">update_time=#{updateTime}</if>
|
<if test="updateTime != null">update_time=#{updateTime}</if>
|
||||||
</set>
|
</set>
|
||||||
where id=#{id}
|
<where>
|
||||||
|
id=#{id}
|
||||||
|
</where>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<select id="getAll" resultType="edu.qijun.pojo.Student">
|
<select id="getAll" resultType="edu.qijun.pojo.Student">
|
||||||
<include refid="commonSelect"></include>
|
<include refid="commonSelect"></include>
|
||||||
|
|
||||||
|
@ -42,5 +45,8 @@
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue