业务service:增删改查

27 篇文章 0 订阅

//业务service增删改查
添加学生信息
package com.imau.service;

import java.util.List;

import com.imau.dao.student.StudentDaoImpl;
import com.imau.entry.Student;

public class StudentService {

private StudentDaoImpl dao;

public StudentService() {
	dao = new StudentDaoImpl();
}

// 查询所有的学生信息
public List<Student> getAll() {

	return dao.query(null, null, null);
}

// 添加学生
public boolean addStu(Student student) {

	int row = dao.add(student);
	return row > 0 ? true : false;
}

public boolean updateStu(Student student) {

	int row = dao.update(student);
	return row > 0 ? true : false;
}

public Student byId(Student student) {

	return dao.find(student);
}

public boolean delById(Student student) {

	int row =  dao.delete(student);
	
	return row > 0 ? true : false;
}


public List<Student> searchStu(String field,Object value) {

	return dao.query(field, "like", value);
}

}
用户查询
package com.imau.service;

import com.imau.dao.user.UserDao;
import com.imau.dao.user.UserDaoImpl;
import com.imau.entry.User;

public class UserService {

private UserDaoImpl dao;

public UserService() {
	dao=new UserDaoImpl();
}

//按照用户名密码查询:admin 123456
public User byNamePass(String uname,String upass) {
	
	User user =new User();
	user.setUname(uname);
	user.setUpass(upass);
		 
	return dao.find(user) ;
}

public boolean editPass(User user) {
	int row=dao.update(user);
	
	return row>0?true:false;
}

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值