CREATEOR REPLACE PROCEDURE InsertPROJECT(PNAMEin IN VARCHAR2,PCONTENTin IN VARCHAR2,ENAMEin IN VARCHAR2,Informo OUT VARCHAR2) AS n1 NUMBER;--两个自增 n2 NUMBER; BEGIN select PROJECTSEQ.nextval into n1 from dual; INSERTinto CPROJECT(PID,PNAME,PCONTENT,PTIME) values (n1,PNAMEin,PCONTENTin,SYSDATE); select EPMAPPERSEQ.nextval into n2 from dual; INSERTINTO EPMAPPER(EPID,EID,PID) VALUES(n2,(SELECT e.EID FROM EMPINFO e WHERE e.ENAME=ENAMEin),n1); SELECT ENAME INTO Informo FROM EMPINFO e WHERE e.ENAME=ENAMEin; END;
<!-- 更新项目 --> <updateid="updateProject"parameterType="top.eshyee.entity.EProject"> UPDATE CPROJECT p SET p.PNAME=#{pName},p.PCONTENT=#{pContent},p.PTIME=SYSDATE WHERE PID=#{pId} </update>
CREATEOR REPLACE PROCEDURE delproject(PIDin IN NUMBER,PNameout OUT VARCHAR2) AS BEGIN SELECT PNAME INTO PNameout from CPROJECT WHERE PID=PIDin ; DELETEFROM EPMAPPER WHERE PID=PIDin; DELETEFROM CPROJECT WHERE PID=PIDin; END;
<!-- project查询 EID--> <selectid="queryprojectWithEid"resultType="HashMap"parameterType="int"> SELECT DISTINCT * FROM ( <includerefid="projectJoinAll"></include> ) WHERE EID=#{eId} </select> <!-- project查询 DID --> <selectid="queryprojectWithDid"resultType="HashMap"parameterType="int"> SELECT DISTINCT * FROM ( <includerefid="projectJoinAll"></include> ) WHERE DID=#{dId} </select> <!-- project查询 模糊项目名称 --> <selectid="queryprojectWithPName"resultType="HashMap"parameterType="int"> SELECT DISTINCT * FROM ( <includerefid="projectJoinAll"></include> ) WHERE PNAME like '%${pName}%' </select> <!-- 连接三个表 --> <sqlid="projectJoinAll"> SELECT A.*,B.EPID,C.* FROM EMPINFO A ,EPMAPPER B ,CPROJECT C WHERE A.EID=B.EID AND B.PID=C.PID </sql>