首页 > 其他分享 >11.21

11.21

时间:2023-12-18 12:33:18浏览次数:26  
标签:name attendancesystem 11.21 where id Select String

今天实现Mapper类

LogOnMapper

package com.example.mapper;

import com.example.pojo.Department;
import com.example.pojo.Staff;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface LogONMapper {
    @Select("select * from attendancesystem.staff where JobID=#{username} and Password=#{password}")
    Staff getByUser(String username, String password);

    @Select("select * from attendancesystem.department")
    List<Department> selectCount();

    @Select("select count(*) from attendancesystem.staff")
    int count();

    @Insert("insert into attendancesystem.staff (JobID, Name, Sex, Birthday, Department, Role, Password) VALUES (#{jobID},#{name},#{sex},#{birthday},#{department},#{role},#{password})")
    void addStaff(String jobID, String name, String sex, LocalDate birthday, String department, String role, String password);

    @Update("update attendancesystem.staff set Name=#{name},Sex=#{sex}, Birthday=#{birthday} where JobID=#{jobID}")
    void updateStaff(String jobID, String name, String sex, LocalDate birthday);

    @Select("select * from attendancesystem.staff where JobID like  concat (#{t},'%')")
    List<Staff> getStaff(String t);

    @Delete("delete from attendancesystem.staff where JobID=#{id}")
    void deleteStaff(String id);

    @Select("select count(*) from attendancesystem.department where DepartmentID=#{id}")
    int aDep(String id);

    @Select("select count(*) from attendancesystem.department where DepartmentName=#{name}")
    int bDep(String name);

    @Insert("insert into attendancesystem.department (DepartmentID, DepartmentName) VALUES (#{departmentID},#{departmentName})")
    void addDep(String departmentID, String departmentName);

    @Update("update attendancesystem.department set DepartmentName=#{departmentName} where DepartmentID=#{departmentID}")
    void updateDep(String departmentID, String departmentName);

    @Select("select count(*) from attendancesystem.staff where Department=#{id}")
    int cDep(String id);

    @Delete("delete from attendancesystem.department where DepartmentID=#{id}")
    void deleteDep(String id);

    @Select("select count(*) from attendancesystem.staff where Role=#{name} ")
    int dDep(String name);

    @Update("update attendancesystem.staff set Role=#{name} where JobID=#{id}")
    void updateRole(String id, String name);

    @Select("select * from attendancesystem.staff where JobID=#{id}")
    Staff selectById(String id);

    @Update("update attendancesystem.staff set Password=#{password} where JobID=#{id}")
    void update(String id, String password);
}

StaffMapper

package com.example.mapper;

import com.example.pojo.Attendance;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface StaffMapper {
    @Select("select count(*) from attendancesystem.attendance")
    int count();
@Insert("insert into attendancesystem.attendance (ID,AttendanceTime,JobID,Name,Sex,Department,AttendanceType,Notes,ApprovedType) VALUES(#{id},#{attendanceTime},#{jobID},#{name}, #{sex},#{department},#{attendanceType},#{notes},#{approvedType})" )
    void addStaff(int id, String attendanceTime, String jobID, String name, String sex, String department, int attendanceType, String notes, String approvedType);
@Select("select * from  attendancesystem.attendance where AttendanceType IN (2, 3) and ApprovedType=#{i}")
    List<Attendance> low(int i);
@Update("update attendancesystem.attendance set ApprovedType=#{i} where AttendanceType= #{type} and Name=#{name}")
    void approve(String name, String type, String i);
}

 

标签:name,attendancesystem,11.21,where,id,Select,String
From: https://www.cnblogs.com/zzqq1314/p/17910885.html

相关文章

  • 11.21
    1.用结构体存放如下表中的数据,然后输出每个人的姓名和实发工资(实发工资=基本工资+浮动工资-支出)姓名基本工资浮动工资支出Tom1240.00800.0075.00Lucy1360.00900.0050.00Jack1560.001000.0080.00程序代码:#inclu......
  • 11.21
    今日学习内容<%@pageimport="java.sql.*"%><%@pageimport="java.sql.DriverManager"%><%--CreatedbyIntelliJIDEA.TochangethistemplateuseFile|Settings|FileTemplates.--%><%@pagecontentType="text/htm......
  • 11.21
    Java是一门面向对象编程语言,不仅吸收了C++语言的各种优点,还摒弃了C++里难以理解的多继承、指针等概念,因此Java语言具有功能强大和简单易用两个特征。Java语言作为静态面向对象编程语言的代表,极好地实现了面向对象理论,允许程序员以优雅的思维方式进行复杂的编程。......
  • 11.21学习小结 //LCA
    倍增求LCA参考博文:https://www.cnblogs.com/hulean/p/11144059.html参考博文:https://www.cnblogs.com/jvxie/p/4854719.html·记录每个点的深度,和往前2^i的祖先。·先把两个点提到同一高度,再统一开始跳。不可以直接跳到相同祖先处,因为可能是LCA的祖先·裸板子:洛谷P3379wa......
  • 11.21b级请假审批实现了
           <!DOCTYPEhtml><htmlxmlns:th="http://www.thymeleaf.org"><head><metacharset="UTF-8"><metaname="renderer"content="webkit"><metahttp-equiv=......
  • 11.21打卡
    1.复制IP(93)有效IP地址 正好由四个整数(每个整数位于 0 到 255 之间组成,且不能含有前导 0),整数之间用 '.' 分隔。例如:"0.1.2.201" 和"192.168.1.1" 是 有效 IP地址,但是 "0.011.255.245"、"192.168.1.312" 和 "[email protected]" 是 无效 IP地址。给定一个只......
  • 11.21每日总结
    实验内容与完成情况:(一) 编程实现以下指定功能,并用Hadoop提供的HBaseShell命令完成相同任务:  List列出hbase的表  查看表中的数据并且向指定表中添加数据。  删除列族。  统计表的行数和删除表。(二) HBase数据库操作1.创建表。     ......
  • 11.21
    昨天没闲话。3yy今天评价学校水龙头:你在二楼是找不到几个正常的水龙头的。说的很对,因为二楼的水龙头歪的比正常的还多。放假时候B站主页给我推了galgame?看来我调教的挺好。游戏名叫《他和她和她的恋爱》我去,纯爱神作(然而并不是),看了这游戏的讲解给我震撼到了,这剧情是牛的吧,世界......
  • 每日总结11.21
    HBase数据库操作(1)createTable(StringtableName,String[]fields)创建表,参数tableName为表的名称,字符串数组fields为存储记录各个字段名称的数组。要求当HBase已经存在名为tableName的表的时候,先删除原有的表,然后再创建新的表。(2)addRecord(StringtableName,Stringrow,Stri......
  • 聪明办法学Python_task1_11.20-11.21
    聪明办法学Python_task1_11.20-11.211.task011.1Python灵魂三问1.2Python环境配置2.task022.1注释2.2基本控制台输出2.3错误2.4基本控制台输入2.5导入模块1.task01:Python简介/安装1.1Python灵魂三问为什么学Python?Python是全球最流行的编程语言......