员工管理JAVA代码 基于java的企业员工管理系统

求一段简单的JAVA代码 要求员工工资管理系统的一个增删改查代码,谢谢了

对数据库进行增删改查?

10年的金州网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。网络营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整金州建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联从事“金州网站设计”,“金州网站推广”以来,每个客户项目都认真落实执行。

以下是 sql server 2013+java.实现的是对MSC对象的增删改查.

需要下载连接驱动程序:com.microsoft.sqlserver.jdbc.SQLServerDriver

网上搜一下就行

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

class MSC

{

public String MscID;

public String MscName;

public String MscCompany;

public float MscLongitude;

public float MscLatitude;

public float MscAltitude;

public MSC(String MscID, String MscName, String MscCompany,

float MscLongitude, float MscLatitude,float MscAltitude){

this.MscID = MscID;

this.MscName = MscName;

this.MscCompany = MscCompany;

this.MscLongitude =MscLongitude;

this.MscLatitude = MscLatitude;

this.MscAltitude = MscAltitude;

}

}

public class sqlserverjdbc {

public Connection getConnection(){

String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; //加载JDBC驱动

String dbURL = "jdbc:sqlserver://localhost:1433; DatabaseName=gsm"; //连接服务器和数据库sample

String userName = "sa"; //默认用户名

String userPwd = "123"; //密码

Connection dbConn = null;

try {

Class.forName(driverName);

dbConn =DriverManager.getConnection(dbURL, userName, userPwd);

} catch (Exception e) {

e.printStackTrace();

}

return dbConn;

}

public void printUserInfo(){

Connection con = getConnection();

Statement sta = null;

ResultSet rs = null;

System.out.println("打印表格MSC信息");

try {

sta = con.createStatement();

rs = sta.executeQuery("select * from MSC信息");

System.out.println("MscID\tMscName\tMscCompany\tMscLongitude\tMscLatitude\tMscAltitude");

while(rs.next()){

System.out.println(rs.getString("MscID")+"\t"+

rs.getString("MscName")+"\t"+

rs.getString("MscCompany")+"\t"+

rs.getFloat("MscLongitude")+"\t"+

rs.getFloat("MscLatitude")+"\t"+

rs.getFloat("MscAltitude"));

}

con.close();

sta.close();

rs.close();

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

System.out.println("打印完成\n");

}

public void delete(String MscID){

Connection con = getConnection();

String sql = "delete from MSC信息 where MscID = " + MscID;

PreparedStatement pst;

System.out.println("删除表格MSC信息中 ID = "+MscID+"的记录");

try {

pst = con.prepareStatement(sql);

pst.execute();

pst.close();

con.close();

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println("记录删除失败!!!");

}

System.out.println("记录删除成功!!!\n");

}

public void insert(MSC msc){

Connection con = getConnection();

String sql = "insert into MSC信息 values(?,?,?,?,?,?)";

PreparedStatement pst;

System.out.println("插入一条记录");

try {

pst = con.prepareStatement(sql);

pst.setString(1, msc.MscID);

pst.setString(2, msc.MscName);

pst.setString(3, msc.MscCompany);

pst.setFloat(4, msc.MscLongitude);

pst.setFloat(5, msc.MscLatitude);

pst.setFloat(6, msc.MscAltitude);

pst.execute();

pst.close();

con.close();

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println("插入失败!!!");

}

System.out.println("插入成功!!!\n");

}

//更新MscID的MscName

public void updateMscName(String MscID, String MscName){

Connection con = getConnection();

String sql = "update MSC信息 set MscName = ? where MscID = ?";

PreparedStatement pst;

System.out.println("修改一条记录");

try {

pst = con.prepareStatement(sql);

pst.setString(1, MscName);

pst.setString(2, MscID);

pst.execute();

pst.close();

con.close();

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println("修改失败!!!");

}

System.out.println("修改成功!!!\n");

}

public static void main(String args[]){

sqlserverjdbc sql = new sqlserverjdbc();

sql.printUserInfo();

sql.delete("1111");

sql.printUserInfo();

sql.updateMscName("5215", "联想");

sql.printUserInfo();

sql.insert(new MSC("1111", "中兴" ," 中兴", (float)12.2, (float)3.4,(float)45.5));

sql.printUserInfo();

}

}

java编程:某公司员工管理系统 有员工列表功能可以根据员工属性进行升、降排序,

ordey by 排序的字段 升序

ordey by 排序的字段 desc 降序

注:排序的字段可通过参数传递过来!望采纳!!!

简单的JAVA员工信息管理系统源码怎么做

1)每个员工的信息包括:编号、姓名、性别、出生年月、学历、职务、电话、住址等。

(2)系统的功能包括:

(a)查询:按特定条件查找员工。

(b)修改:按编号对某个员工的某项信息进行修改。

(c)插入:加入新员工的信息。

(d)删除:按编号删除已离职员工的信息。

(e)排序:按特定条件对所有员工的信息进行排序。

JAVA员工管理小程序

Employee类:

public class Employee {

private int id;

private String name;

private int age;

private String email;

public int getId() {

return id;

}

public void setId(int id) {

this.id = id;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public int getAge() {

return age;

}

public void setAge(int age) {

this.age = age;

}

public String getEmail() {

return email;

}

public void setEmail(String email) {

this.email = email;

}

}

Manager类:

import java.util.ArrayList;

import java.util.List;

public class Manager {

public static ListEmployee employees = new ArrayListEmployee();

public static void addEmployee(Employee employee){

employees.add(employee);

}

public static void deleteEmployee(Employee employee){

employees.remove(employee);

}

public static void updateEmployee(Employee employee){

int len = employees.size();

for(int i=0;ilen;i++){

Employee e = employees.get(i);

if(e.getId() == employee.getId()){

deleteEmployee(e);

addEmployee(employee);

}

}

}

public static Employee selectEmployeeById(int id){

int len = employees.size();

if(len!=0){

Employee emp = new Employee();

for(int i=0;ilen;i++){

Employee e = employees.get(i);

if(e.getId() == id){

emp = e;

}

}

return emp;

}else{

return null;

}

}

public static Employee selectEmployeeByName(String name){

int len = employees.size();

if(len!=0){

Employee emp = new Employee();

for(int i=0;ilen;i++){

Employee e = employees.get(i);

if(e.getName().equals(name)){

emp = e;

}

}

return emp;

}else{

return null;

}

}

public static void printEmployees(){

int len = employees.size();

if(len != 0){

for(int i=0;ilen;i++){

System.out.println(employees.get(i).getId()+":\t"+

employees.get(i).getName()+"\t"+

employees.get(i).getAge()+"\t"+

employees.get(i).getEmail());

}

}else{

System.out.println("无员工");

}

}

}

测试EmpManaTest类:

public class EmpManaTest {

public static void main(String[] args) {

Employee e = new Employee();

e.setId(1);

e.setName("zz");

e.setAge(20);

e.setEmail("zz@163.com");

Manager.addEmployee(e);

Employee e2 = new Employee();

e2.setId(2);

e2.setName("scof");

e2.setAge(18);

e2.setEmail("scofield@mail.com");

Manager.addEmployee(e2);

System.out.println("添加员工后:");

Manager.printEmployees();

System.out.println("----------------------------------------------");

Employee emp = new Employee();

emp.setId(1);

emp.setName("virus");

emp.setAge(30);

emp.setEmail("virus@163.com");

Manager.updateEmployee(emp);

System.out.println("修改员工后:");

Manager.printEmployees();

System.out.println("----------------------------------------------");

System.out.println("查询员工ByID:");

Employee empSelectId = Manager.selectEmployeeById(1);

System.out.println(empSelectId.getName());

System.out.println("----------------------------------------------");

System.out.println("查询员工ByName:");

Employee empSelectName = Manager.selectEmployeeByName("virus");

System.out.println(empSelectName.getEmail());

System.out.println("----------------------------------------------");

System.out.println("删除一个员工后:");

Manager.deleteEmployee(emp);

Manager.printEmployees();

}

}

这个是不是你想要的...........


本文名称:员工管理JAVA代码 基于java的企业员工管理系统
网页地址:http://hbruida.cn/article/doiigdp.html