mybatis批量增加和批量修改

批量插入的语句

		INSERT INTO bus_project_maintenance_detail(
			id,
			create_by,
			create_date,
			update_by,
			update_date,
			remarks,
			del_flag,
			projectname,
			year,
			username,
			userid,
			coercion_type,
			compulsory_own_funds,
			compulsory_company_borrowing,
			compulsory_mammon_loan,
			isforceorright,
			people_type,
			mainid
		) VALUES
		 	
		 (
				#{busProjectMaintenanceDetail.id},
				#{busProjectMaintenanceDetail.createBy.id},
				#{busProjectMaintenanceDetail.createDate},
				#{busProjectMaintenanceDetail.updateBy.id},
				#{busProjectMaintenanceDetail.updateDate},
				#{busProjectMaintenanceDetail.remarks},
				#{busProjectMaintenanceDetail.delFlag},
				#{busProjectMaintenanceDetail.projectname},
				#{busProjectMaintenanceDetail.year},
				#{busProjectMaintenanceDetail.username},
				#{busProjectMaintenanceDetail.userid},
				#{busProjectMaintenanceDetail.coercionType},
				#{busProjectMaintenanceDetail.compulsoryOwnFunds},
				#{busProjectMaintenanceDetail.compulsoryCompanyBorrowing},
				#{busProjectMaintenanceDetail.compulsoryMammonLoan},
				#{busProjectMaintenanceDetail.isforceorright},
				#{busProjectMaintenanceDetail.peopleType},
				#{busProjectMaintenanceDetail.mainid}
		)
			
	


批量修改


		UPDATE bus_project_maintenance_detail SET
		compulsory_own_funds =
		
			when #{busProjectMaintenanceDetail.id} then
			#{busProjectMaintenanceDetail.compulsoryOwnFunds}
		
		,compulsory_company_borrowing =
		
			when #{busProjectMaintenanceDetail.id} then
			#{busProjectMaintenanceDetail.compulsoryCompanyBorrowing}
		
		,compulsory_mammon_loan =
		
			when #{busProjectMaintenanceDetail.id} then
			#{busProjectMaintenanceDetail.compulsoryMammonLoan}
		
		where id in
		
			#{busProjectMaintenanceDetail.id}
		
	

你可能感兴趣的:(mybatis批量增加和批量修改)