java开发的ERP5820.docx
《java开发的ERP5820.docx》由会员分享,可在线阅读,更多相关《java开发的ERP5820.docx(109页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、package com.ts017.zjh;import java.text.NumberFormat;import java.util.Iteraator;import java.util.List;import java.util.Map;import java.util.Scannner;import com.tts017.zjh.ddao.IDDeptDAAO;import com.tts017.zjh.ddao.IEEmpDAOO;import com.tts017.zjh.ddao.faactoryy.DAOFFactorry;import com.tts017.zjh.vvo.D
2、eppartmeent;import com.tts017.zjh.vvo.Empployeee;public classs DepaartmenntOperrate privatte IDeeptDAOO dao = nulll;Scanneer scnn = nuull;publicc DepaartmenntOperrate() this.dao = DAOFFactorry.gettIDempptDAOIInstannce();scn = new Scannner(Syystem.in);publicc voidd addDDeparttment() Systeem.outt.prin
3、ntln();Systeem.outt.prinntln( 添加部门门信息);Systeem.outt.prinntln(=);Systeem.outt.prinnt(请输输入部门名称称: );Strinng depptNamee = sccn.nexxt();Deparrtmentt repeeatDeppt = ggetDeppartmeentByNName(ddeptNaame);if (rrepeattDept != nuull) Systtem.ouut.priintln(您输入的的部门名已存存在);retuurn;Deparrtmentt deptt = neew Deppartm
4、eent();dept.setDeeptNamme(depptNamee);booleean fllag = falsee;try flagg = thhis.daao.doCCreatee(deptt); cattch (EExcepttion ee) e.prrintSttackTrrace();if (fflag) Systtem.ouut.priintln(添加部门门成功); elsse Systtem.ouut.priintln(添加部门门失败);publicc voidd delDDeparttment() Systeem.outt.prinntln();Systeem.outt.
5、prinnt(请输输入要删除的的部门编号: );int ddeptIdd = sccn.nexxtInt();Deparrtmentt deptt = geetDepaartmenntByIdd(depttId);if (ddept = nulll) Systtem.ouut.priintln(您输入的的部门不存在在);retuurn;IEmpDDAO emmpDAO = DAOOFactoory.geetIEmppDAOInnstancce();List emps = nulll;try empss = emmpDAO.findBByDepttId(deeptId); cattch (EEx
6、cepttion ee) e.prrintSttackTrrace();if (eemps != nulll) thiss.showwDeparrtmentt(deptt);if (emps.size() 00) Sysstem.oout.prrintlnn(该部门门中有员工存存在,若删除除该部门,则则相应的员工工也会被删除除,确定要删删除吗(y/n)?);Strring oopt = scn.nnext();if (opt.equallsIgnooreCasse(y) boooleann flagg = faalse;trry eempDAOO.doDeeleteBByDepttId(dee
7、ptId);fflag = thiss.dao.doDellete(ddeptIdd); catchh (Excceptioon e) ee.prinntStacckTracce();iff (flaag) SSystemm.out.printtln(删删除部门成功功); else SSystemm.out.printtln(删删除部门失败败); ellse Sysstem.oout.prrintlnn(确定要要删除该部门门信息吗(yy/n)?);Strring oopt = scn.nnext();if (opt.equallsIgnooreCasse(y) boooleann flagg
8、= faalse;trry fflag = thiss.dao.doDellete(ddeptIdd); catchh (Excceptioon e) ee.prinntStacckTracce();iff (flaag) SSystemm.out.printtln(删删除部门成功功); else SSystemm.out.printtln(删删除部门失败败);publicc voidd finddAll() List deppts = null;try deptts = tthis.ddao.fiindAlll(); cattch (EExcepttion ee) e.prrintSttac
9、kTrrace();if (ddepts != nuull & deptts.sizze() != 0) thiss.showwDeparrtmentt(deptts); elsse Systtem.ouut.priintln(没有部门门信息);publicc voidd finddDeparrtmentt() int oopt;do thiss.showwFindMMenu();opt = scnn.nexttInt();swittch (oopt) casee 1:thiis.finndByDeeptId();breeak;casee 2:thiis.finndByDeeptnamme()
10、;breeak;casee 0:retturn; whiile (oopt != 0);publicc voidd finddByDepptnamee() Systeem.outt.prinntln();Systeem.outt.prinnt(请输输入查找的部部门名称: );Strinng depptNamee = sccn.nexxt();Deparrtmentt deptt = geetDepaartmenntByNaame(deeptNamme);if (ddept != nulll) thiss.showwDeparrtmentt(deptt); elsse Systtem.ouut.
11、priintln(相关信息息不存在);publicc voidd finddByDepptId() Systeem.outt.prinntln();Systeem.outt.prinnt(请输输入要查找的的部门号: );int ddeptIdd = sccn.nexxtInt();Deparrtmentt deptt = geetDepaartmenntByIdd(depttId);if (ddept != nulll) thiss.showwDeparrtmentt(deptt); elsse Systtem.ouut.priintln(相关信息息不存在);publicc voidd upd
12、aateDeppartmeent() Systeem.outt.prinntln();Systeem.outt.prinnt(请输输入要更新的的部门编号: );int ddeptIdd = sccn.nexxtInt();Deparrtmentt deptt = geetDepaartmenntByIdd(depttId);if (ddept = nulll) Systtem.ouut.priintln(您输入的的部门不存在在);retuurn;this.showDDeparttment(dept);Systeem.outt.prinntln( 更新新部门信息);Systeem.outt.pr
13、inntln(=);Systeem.outt.prinnt(请输输入新的部门门名称: );Strinng depptNamee = sccn.nexxt();Deparrtmentt repeeatDeppt = ggetDeppartmeentByNName(ddeptNaame);whilee(repeeatDeppt!=nuull)Systtem.ouut.priintln(您输入的的部门名称已已存在,请重重新输入);depttName = scnn.nextt();repeeatDeppt = ggetDeppartmeentByNName(ddeptNaame);Deparrtmen
14、tt newDDept = new Deparrtmentt();newDeept.seetDepttId(deeptId);newDeept.seetDepttName(deptNName);booleean fllag = falsee;try flagg = thhis.daao.doUUpdatee(newDDept); cattch (EExcepttion ee) e.prrintSttackTrrace();if (fflag) Systtem.ouut.priintln(更新员工工信息成功); elsse Systtem.ouut.priintln(更新员工工信息失败);pub
15、licc voidd showwGrouppAvgSaalaryAAboutDDept() Map deptMMap = null;Map avgSSalaryy = nuull;try depttMap = thiss.dao.getDeepartmmentMaap();avgSSalaryy = thhis.daao.gettAveraageSallaryByyGroupp(); cattch (EExcepttion ee) e.prrintSttackTrrace();Systeem.outt.prinntln();Systeem.outt.prinntln(t 部门平平均薪水);Sy
16、steem.outt.prinntln();Systeem.outt.prinntln(t部门编编号t部门门名称t平平均薪水);Systeem.outt.prinntln(=);Iteraator itt = avvgSalaary.keeySet().iteeratorr();NumbeerFormmat foormat = NummberFoormat.getInnstancce();formaat.settMaximmumFraactionnDigitts(1);whilee (it.hasNeext() Inteeger iid = iit.nexxt();Systtem.ouut.p
17、riintln(t + id.intVaalue() + t+ deptMMap.geet(id).getDDeptNaame() + tt+ formaat.forrmat(aavgSallary.gget(idd);Systeem.outt.prinntln();publicc voidd showwEmpCoountAbboutDeept() Map emppCounttMap = nulll;Map deptMMap = null;try empCCountMMap = this.dao.ggetEmppCounttByGrooup();depttMap = thiss.dao.get
18、DeepartmmentMaap(); cattch (EExcepttion ee) e.prrintSttackTrrace();Systeem.outt.prinntln();Systeem.outt.prinntln(t 部门员员工信息);Systeem.outt.prinntln();Systeem.outt.prinntln(t编号t名称tt人数);Systeem.outt.prinntln(=);Iteraator itt = emmpCounntMap.keySeet().iiterattor();whilee (it.hasNeext() Inteeger iid = iit
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 开发 ERP5820
限制150内