mapper
@Insert("INSERT INTO collection_plan " +
"(co_id,co_num,co_group_ids,co_content,co_start_time,co_end_time,co_status,co_plan_name,co_pids) " +
"values " +
"(nextval('collection_plan_seq'),#{coNum,jdbcType=VARCHAR},#{coGroupIds,jdbcType=VARCHAR},#{coContent,jdbcType=VARCHAR},#{coStartTime,jdbcType=DATE},#{coEndTime,jdbcType=DATE},'false',#{coPlanName,jdbcType=VARCHAR},#{coPids,jdbcType=VARCHAR}) " +
"RETURNING co_id")
@Options(useGeneratedKeys=true, keyProperty="coId", keyColumn="coId")
void addPlanByObject(CollectionPlan collplan);
- sql 中 returning ID
- 注解添加 @Options
- 方法无返回值 void
service
int addPlanByObject(CollectionPlan collplan);
serviceImpl
@Override
public int addPlanByObject(CollectionPlan collplan) {
collmaper.addPlanByObject(collplan);
return collplan.getCoId();
}