直接贴代码,DAO接口中的方法:
//通过em_id和年假天数来创建 public void CreateVacationByEmIdvCount(String emId,int vCount) throws Exception;
mybatis 映射文件:
<!--通过em_id和年假天数插入 --> <insert id="CreateVacationByEmIdvCount" > insert into t_vacation select e.em_id,e.dp_id,e.work_years,#{1},'',GETDATE() from t_employer e left outer join t_department d on e.dp_id = d.dp_id where e.em_id = #{0} </insert>
注意:
1. 用 #{0}和#{1}来引用第一个和第二个参数
2. parameterType参数不能再写了