ssm使用全注解实现增删改查案例——EmpServiceImpl
生活随笔
收集整理的這篇文章主要介紹了
ssm使用全注解实现增删改查案例——EmpServiceImpl
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
package org.service.impl;import java.util.List;import org.dao.IEmpMapper;
import org.entity.Emp;
import org.service.IEmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;//注入事務
@Component
public class EmpServiceImpl implements IEmpService {//自動注入@Autowiredprivate IEmpMapper empMapper;/*** (非 Javadoc)* <p>Description(描述):刪除 </p>* <p>Title: deleteByPrimaryKey</p>* @param eid* @return* @see org.service.IEmpService#deleteByPrimaryKey(java.lang.Integer)*/@Overridepublic int deleteByPrimaryKey(Integer eid) {// TODO Auto-generated method stubreturn empMapper.deleteByPrimaryKey(eid);}/*** (非 Javadoc)* <p>Description(描述):保存 </p>* <p>Title: insert</p>* @param record* @return* @see org.service.IEmpService#insert(org.entity.Emp)*/@Overridepublic int insert(Emp record) {// TODO Auto-generated method stubreturn empMapper.insert(record);}/*** (非 Javadoc)* <p>Description(描述):根據編號查詢</p>* <p>Title: selectByPrimaryKey</p>* @param eid* @return* @see org.service.IEmpService#selectByPrimaryKey(java.lang.Integer)*/@Overridepublic Emp selectByPrimaryKey(Integer eid) {// TODO Auto-generated method stubreturn empMapper.selectByPrimaryKey(eid);}/*** (非 Javadoc)* <p>Description(描述):修改信息 </p>* <p>Title: updateByPrimaryKey</p>* @param record* @return* @see org.service.IEmpService#updateByPrimaryKey(org.entity.Emp)*/@Overridepublic int updateByPrimaryKey(Emp record) {// TODO Auto-generated method stubreturn empMapper.updateByPrimaryKey(record);}/*** (非 Javadoc)* <p>Description(描述):查詢全部 </p>* <p>Title: findEmpAll</p>* @return* @see org.service.IEmpService#findEmpAll()*/@Overridepublic List<Emp> findEmpAll() {// TODO Auto-generated method stubreturn empMapper.findEmpAll();}/*** (非 Javadoc)* <p>Description(描述):根據部門編號查詢員工 </p>* <p>Title: findEmpByDept</p>* @param did* @return* @see org.service.IEmpService#findEmpByDept(int)*/@Overridepublic List<Emp> findEmpByDept(int did) {return empMapper.findEmpByDept(did);}}
總結
以上是生活随笔為你收集整理的ssm使用全注解实现增删改查案例——EmpServiceImpl的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 红海和蓝海是什么意思 红海和蓝海的含义
- 下一篇: 北平是现在的哪个城市 北平是哪个城市的叫